Hallo zusammen,
ich bastle in Thema für Superkaramba, wo RAIDs dynamisch abgefragt und dazugehörige Infos ausgegeben werden sollen. Bin schon weiter gekommen, doch habe ein kleines Problem.
Bei dem Thema ist auch Python im Einsatz.
Ich möchte
schön auswerten.
Jeder RAID-Verbund wird über Python automatisch angezeigt.
(Ausschnitt)
Ich bekomme dann für jedes Kästchen aus der ersten Zeile:
FRAGE:
Wie komme ich auf folgende 2 Zeilen bei jedem RAID???
Also ich brauche so etwas als Ausgabe (von mir aus in einer Zeile)
auf die erste Zeile komme ich mit
-Python
-Bash (zB. md4)
Das ist wichtig, um dann je nach mdX Stati für UU, U_, _U oder __ abfragen zu können.
Das Ganze soll so aussehen
ich bastle in Thema für Superkaramba, wo RAIDs dynamisch abgefragt und dazugehörige Infos ausgegeben werden sollen. Bin schon weiter gekommen, doch habe ein kleines Problem.
Bei dem Thema ist auch Python im Einsatz.
Ich möchte
Code:
dma@Phenom940:~> cat /proc/mdstat
Personalities : [raid0] [raid1] [raid10] [raid6] [raid5] [raid4]
md4 : active raid10 sdk1[0] sdl1[1]
976760672 blocks super 1.0 2 near-copies [2/2] [UU]
bitmap: 2/466 pages [8KB], 1024KB chunk
md3 : active raid10 sdi1[0] sdj1[1]
976760672 blocks super 1.0 2 near-copies [2/2] [UU]
bitmap: 2/466 pages [8KB], 1024KB chunk
md2 : active raid10 sdb1[0] sdd1[1]
625130336 blocks super 1.0 2 near-copies [2/2] [UU]
bitmap: 5/299 pages [20KB], 1024KB chunk
md1 : active raid10 sda4[0] sdc4[1]
576781536 blocks super 1.0 2 near-copies [2/2] [UU]
bitmap: 2/5 pages [8KB], 65536KB chunk
md0 : active raid10 sda3[0] sdc3[1]
46138592 blocks super 1.0 2 near-copies [2/2] [UU]
bitmap: 1/1 pages [4KB], 65536KB chunk
Jeder RAID-Verbund wird über Python automatisch angezeigt.
(Ausschnitt)
Code:
for RAIDS in NumberOfRAIDS:
#...set the RAID Box and show name of this RAID Array (mdX)...
#box
karamba.createImage(widget, 72, Base_y_RAID+35, RAID_Box)
#RAID name
RAID = karamba.createText(widget, 75, Base_y_RAID+35+texty, 140,40, RAIDS)
karamba.changeTextColor(widget, RAID, Red_Topic, Green_Topic, Blue_Topic)
karamba.changeTextSize(widget,RAID,18)
#...and set RAID icons and Infos in boxes
if "md" in RAIDS:
karamba.createImage(widget, 80, Base_y_RAID+65, "img/RAIDok.png")
RAID_Devices_Title_Text=karamba.createText(widget, 120, Base_y_RAID+35+texty, 140,40, 'RAID Devices:')
RAID_Devices_Typ=os.popen("cat /proc/mdstat |grep "+str(RAIDS)+"|sed 's/"+str(RAIDS)+" : //g'|awk '{print $2}'").read()
RAID_Devices=os.popen("cat /proc/mdstat |grep "+str(RAIDS)+"|sed 's/"+str(RAIDS)+" : //g'|awk '{print $3,$4,$5,$6}'").read()
RAID_Devices_Text=karamba.createText(widget, 120, Base_y_RAID+50+texty, 200,40, RAID_Devices)
RAID_Devices_Typ_Text=karamba.createText(widget, 120, Base_y_RAID+62+texty, 140,40, RAID_Devices_Typ)
RAID_Chunk_Text=karamba.createText(widget, 120, Base_y_RAID+75+texty, 140,40, 'Chunk:')
else:
pass
RAID_list.append(RAID)
Ich bekomme dann für jedes Kästchen aus der ersten Zeile:
Code:
mdX : active raidX sdkX sdlX
FRAGE:
Wie komme ich auf folgende 2 Zeilen bei jedem RAID???
Also ich brauche so etwas als Ausgabe (von mir aus in einer Zeile)
Code:
md4 : active raid10 sdk1[0] sdl1[1]
976760672 blocks super 1.0 2 near-copies [2/2] [UU]
bitmap: 2/466 pages [8KB], 1024KB chunk
auf die erste Zeile komme ich mit
-Python
Code:
RAID_Devices=os.popen("cat /proc/mdstat |grep "+str(RAIDS)+"|sed 's/"+str(RAIDS)+" : //g'|awk '{print $3,$4,$5,$6}'").read()
-Bash (zB. md4)
Code:
cat /proc/mdstat |grep md4|sed 's/md4 : //g'|awk '{print $3,$4,$5,$6}'
Das ist wichtig, um dann je nach mdX Stati für UU, U_, _U oder __ abfragen zu können.
Das Ganze soll so aussehen
