2010-06-02 10:43:29 +02:00
|
|
|
#!/usr/bin/env python
|
|
|
|
"""Thomas R. N. Jansson (tjansson@tjansson.dk)
|
|
|
|
16-MAY-2010
|
|
|
|
"""
|
|
|
|
|
|
|
|
# The SNMP traps for the NetApp filer can be found in
|
2018-08-02 02:03:42 +02:00
|
|
|
# /net/netappfiler/vol0/etc/mib/traps.dat if the filer is
|
2010-06-02 10:43:29 +02:00
|
|
|
# NFS automounted mounted on server.
|
|
|
|
# Example: the SNMP id for cpuBusyTimePerCent is
|
2018-08-02 02:03:42 +02:00
|
|
|
# snmp.1.3.6.1.4.1.789.1.2.1.3.0
|
|
|
|
# and retrival of this value is done by
|
2010-06-02 10:43:29 +02:00
|
|
|
# snmpget -v 1 -c public netappfiler 1.3.6.1.4.1.789.1.2.1.3.0
|
|
|
|
#
|
2018-08-02 02:03:42 +02:00
|
|
|
# Requires snmpget and assumes public community.
|
2010-06-02 10:43:29 +02:00
|
|
|
|
|
|
|
import commands
|
|
|
|
import sys
|
|
|
|
|
|
|
|
# Provided a servername and a snmpid it returns the value stripped of bogus information.
|
|
|
|
def snmpget(iservername,isnmpid):
|
2018-08-02 02:03:42 +02:00
|
|
|
runcmd = 'snmpget -v 1 -c public ' + iservername + ' ' + isnmpid
|
2010-06-02 10:43:29 +02:00
|
|
|
output = commands.getoutput(runcmd)
|
|
|
|
return output.split()[3]
|
|
|
|
|
|
|
|
# The interface number corresponds to vif1 on the tested netapp
|
2012-08-29 02:07:36 +02:00
|
|
|
servername = sys.argv[0].split('_')[1]
|
2010-06-02 10:43:29 +02:00
|
|
|
cifsConnectedUsers = '1.3.6.1.4.1.789.1.7.2.9.0'
|
|
|
|
cifsNSessions = '1.3.6.1.4.1.789.1.7.2.12.0'
|
|
|
|
cifsNOpenFiles = '1.3.6.1.4.1.789.1.7.2.13.0'
|
|
|
|
|
|
|
|
# Using config
|
|
|
|
if len(sys.argv) == 2 and sys.argv[1] == "config":
|
|
|
|
print 'graph_title CIFS usage on '+servername
|
|
|
|
print 'graph_args --base 1000 -l 0'
|
|
|
|
print 'graph_vlabel number'
|
2017-02-23 04:00:39 +01:00
|
|
|
print 'graph_category fs'
|
2018-08-02 02:03:42 +02:00
|
|
|
print 'graph_info This graph shows CIFS usage on '+servername
|
2010-06-02 10:43:29 +02:00
|
|
|
|
|
|
|
print 'cifsConnectedUsers.label ConnectedUsers'
|
2014-12-05 00:37:42 +01:00
|
|
|
print 'cifsConnectedUsers.info The current number of CIFS users on the filer'
|
2018-08-02 02:03:42 +02:00
|
|
|
|
2010-06-02 10:43:29 +02:00
|
|
|
print 'cifsNSessions.label NumberOfSessions'
|
|
|
|
print 'cifsNSessions.info The current number of active CIFS session on the filer'
|
2018-08-02 02:03:42 +02:00
|
|
|
|
2010-06-02 10:43:29 +02:00
|
|
|
print 'cifsNOpenFiles.label NumberOfOpenfiles'
|
|
|
|
print 'cifsNOpenFiles.info The number of open CIFS files and directories on the filer'
|
|
|
|
sys.exit(0)
|
|
|
|
|
|
|
|
# Gathers info from the servers and gathers data
|
|
|
|
print 'cifsConnectedUsers.value '+snmpget(servername,cifsConnectedUsers)
|
|
|
|
print 'cifsNSessions.value '+snmpget(servername,cifsNSessions)
|
|
|
|
print 'cifsNOpenFiles.value '+snmpget(servername,cifsNOpenFiles)
|