1
2
3
4
5
6
7
8
9 """
10 Agent zephir informant de la personnalisation de Samba
11 """
12
13 from zephir.monitor.agentmanager.agent import Agent
14 from zephir.monitor.agentmanager.data import HTMLData, TableData
15 from zephir.monitor.agentmanager import status
16 from os import listdir
17
20 Agent.__init__(self, name, **params)
21 self.table = TableData([
22 ('share', 'Partages personnalisés', {'align':'center'}, None)])
23
24 self.table2 = TableData([
25 ('script', 'Scripts de connexion personnalisés', {'align':'center'}, None)])
26 self.data = [self.table, HTMLData('<br>'), self.table2]
27
29 sharepath = '/usr/share/eole/backend/conf/'
30 scriptpath = '/home/netlogon/scripts/'
31 tscripts = ['users', 'groups', 'os', 'machine']
32 noresult = '** AUCUN **'
33
34
35 try:
36 allshare = listdir(sharepath)
37 except:
38 allshare = []
39 res1 = []
40 for share in allshare :
41
42 if share.endswith('.conf') and share != 'smb.conf' :
43 res1.append({ 'share' : share[0:-5] })
44 if res1 == [] :
45 res1.append({ 'share' : noresult })
46
47
48 res2 = []
49 for tscript in tscripts:
50 try:
51 allscript = listdir(scriptpath+tscript)
52 except:
53 allscript = []
54 for script in allscript:
55
56 if script.endswith('.bat'):
57 res2.append({ 'script' : tscript+' : '+script[0:-4] })
58 if res2 == [] :
59 res2.append({ 'script' : noresult })
60
61
62 return { 'statistics' : res1,
63 'statistics2' : res2 }
64
65
67 Agent.write_data(self)
68 if self.last_measure is not None:
69 self.table.table_data = self.last_measure.value['statistics']
70 self.table2.table_data = self.last_measure.value['statistics2']
71
74