1
2 """Etat des montages
3 """
4
5 import os,commands
6 from zephir.monitor.utils import list2list_to_table
7 from agent import Agent
8
10 """Bilan de l'etat des montages
11 """
23
25 """Appel et traitement des commandes
26 """
27
28 cmd_montages = "df -kP"
29 cmd_info = "/bin/cat /proc/mounts"
30
31 mnt = commands.getoutput(cmd_montages)
32 inf = commands.getoutput(cmd_info)
33
34 lmnt = mnt.splitlines()
35 linf = inf.splitlines()
36
37
38 d_type = {}
39 for lin in linf :
40 d_type[lin.split()[0]]=lin.split()[2]
41
42
43 lmnt=lmnt[1:]
44 liste = [['montage','partition','type','utilisation','libre (mo)','utilisé (mo)','taille (mo)']]
45 for lmn in lmnt :
46 l = []
47 l.append(lmn.split()[5])
48 l.append(lmn.split()[0])
49 try :
50 l.append(d_type[lmn.split()[0]])
51 except:
52 l.append("?")
53 l.append(lmn.split()[4])
54 l.append( int(lmn.split()[3])/1024 )
55 l.append( int(lmn.split()[2])/1024 )
56 l.append( int(lmn.split()[1])/1024 )
57 liste.append(l)
58
59 if int(lmn.split()[4][:-1]) > 95:
60
61 if lmn.count('iso9660') == 0:
62 self.set_status("0")
63
64 return liste
65
66 if __name__ == "__main__":
67 MontagesAgent()
68