prd_raid.po 1.42 KB
Newer Older
1
prd_raid_updatedata()
Vinicius Ruoso's avatar
Vinicius Ruoso committed
2 3 4 5
{
    UPDATA="$*"
}

6
prd_raid_www()
Vinicius Ruoso's avatar
Vinicius Ruoso committed
7 8 9 10 11 12 13 14 15
{
    PVALUE="$*"

    OUT="false"
    SYNC="false"
    FAULTY="false"
    MISSINGPART="false"
    MISSINGDISK="false"
    NOINFO="false"
16
    IOERROR="false"
Vinicius Ruoso's avatar
Vinicius Ruoso committed
17

18 19 20 21 22 23 24
    echo "$PVALUE" | grep -q "OUT_OF_RAID" && OUT="true"
    echo "$PVALUE" | grep -q "SYNCHRONIZING_RAID" && SYNC="true"
    echo "$PVALUE" | grep -q "FAULTY" && FAULTY="true"
    echo "$PVALUE" | grep -q "[1-9]_MISSING" && MISSINGPART="true"
    echo "$PVALUE" | grep -q "sd[a,b]_MISSING" && MISSINGDISK="true"
    echo "$PVALUE" | grep -q "NOINFO" && NOINFO="true"
    echo "$PVALUE" | grep -q "IOERROR" && IOERROR="true"
Vinicius Ruoso's avatar
Vinicius Ruoso committed
25

26 27 28 29 30 31
    PSTATETYPE="prd_raid_out_st:$OUT prd_raid_sync_st:$SYNC"
    PSTATETYPE="$PSTATETYPE prd_raid_faulty_st:$FAULTY"
    PSTATETYPE="$PSTATETYPE prd_raid_misspart_st:$MISSINGPART"
    PSTATETYPE="$PSTATETYPE prd_raid_noinfo_st:$NOINFO"
    PSTATETYPE="$PSTATETYPE prd_raid_missdisk_st:$MISSINGDISK"
    PSTATETYPE="$PSTATETYPE prd_raid_ioerror_st:$IOERROR"
Vinicius Ruoso's avatar
Vinicius Ruoso committed
32

33 34 35 36
    if test "$OUT" = "true" || test "$SYNC" = "true" || \
       test "$FAULTY" = "true" || test "$MISSINGPART" = "true" || \
       test "$MISSINGDISK" = "true" || test "$NOINFO" = "true" || \
       test "$IOERROR" = "true"; then
Vinicius Ruoso's avatar
Vinicius Ruoso committed
37 38 39
          PSTATUS=red
    fi

40
    if echo "$PVALUE" | grep -q "OK"; then
Vinicius Ruoso's avatar
Vinicius Ruoso committed
41 42
        PVALUE="OK"
    else
43
        PVALUE="$(echo "$PVALUE" | cut -d"+" -f3)"
Vinicius Ruoso's avatar
Vinicius Ruoso committed
44 45 46
    fi
}

47
getcolumninfo()
Vinicius Ruoso's avatar
Vinicius Ruoso committed
48 49 50 51
{
    WEBINTERFACE=true
    COLNAME="RAID"
}