Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / netapp / snmp__netapp_cifs @ 17f78427

Historique | Voir | Annoter | Télécharger (1,95 ko)

1
#!/usr/bin/env python
2
"""Thomas R. N. Jansson (tjansson@tjansson.dk)
3
16-MAY-2010
4
"""
5

    
6
# The SNMP traps for the NetApp filer can be found in
7
# /net/netappfiler/vol0/etc/mib/traps.dat if the filer is
8
# NFS automounted mounted on server.
9
# Example: the SNMP id for cpuBusyTimePerCent is
10
# snmp.1.3.6.1.4.1.789.1.2.1.3.0
11
# and retrival of this value is done by
12
# snmpget -v 1 -c public netappfiler 1.3.6.1.4.1.789.1.2.1.3.0
13
#
14
# Requires snmpget and assumes public community.
15

    
16
import commands
17
import sys
18

    
19
# Provided a servername and a snmpid it returns the value stripped of bogus information.
20
def snmpget(iservername,isnmpid):
21
    runcmd = 'snmpget -v 1 -c public ' + iservername + ' ' + isnmpid
22
    output = commands.getoutput(runcmd)
23
    return output.split()[3]
24

    
25
# The interface number corresponds to vif1 on the tested netapp
26
servername          = sys.argv[0].split('_')[1]
27
cifsConnectedUsers  = '1.3.6.1.4.1.789.1.7.2.9.0'
28
cifsNSessions       = '1.3.6.1.4.1.789.1.7.2.12.0'
29
cifsNOpenFiles      = '1.3.6.1.4.1.789.1.7.2.13.0'
30

    
31
# Using config
32
if len(sys.argv) == 2 and sys.argv[1]  == "config":
33
    print 'graph_title CIFS usage on '+servername
34
    print 'graph_args --base 1000 -l 0'
35
    print 'graph_vlabel number'
36
    print 'graph_category fs'
37
    print 'graph_info This graph shows CIFS usage on '+servername
38

    
39
    print 'cifsConnectedUsers.label ConnectedUsers'
40
    print 'cifsConnectedUsers.info The current number of CIFS users on the filer'
41

    
42
    print 'cifsNSessions.label NumberOfSessions'
43
    print 'cifsNSessions.info The current number of active CIFS session on the filer'
44

    
45
    print 'cifsNOpenFiles.label NumberOfOpenfiles'
46
    print 'cifsNOpenFiles.info The number of open CIFS files and directories on the filer'
47
    sys.exit(0)
48

    
49
# Gathers info from the servers and gathers data
50
print 'cifsConnectedUsers.value '+snmpget(servername,cifsConnectedUsers)
51
print 'cifsNSessions.value '+snmpget(servername,cifsNSessions)
52
print 'cifsNOpenFiles.value '+snmpget(servername,cifsNOpenFiles)