Projet

Général

Profil

Révision d85c9292

IDd85c9292b370b127b91eb66e18574de198b2f63e
Parent 1658621c
Enfant 55ae8c77

Ajouté par Thomas R. N. Jansson il y a presque 14 ans

Initial version

Voir les différences:

plugins/other/netapp_cpu_
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
snmpid      = "1.3.6.1.4.1.789.1.2.1.3.0"
26
warning     = 80
27
critical    = 95 
28
servername  = sys.argv[0].split('_')[2]
29

  
30
if len(sys.argv) == 2 and sys.argv[1]  == "config":
31
    print 'graph_title CPU usage on', servername
32
    print 'graph_args --base 1000 -r --lower-limit 0 --upper-limit 100'
33
    print 'graph_vlabel %'
34
    print 'graph_scale no'
35
    print 'graph_info This graph shows how CPU time is spent.'
36
    print 'graph_period second'
37
    print 'graph_category netapp'
38

  
39
    print 'usage.label cpu_usage '
40
    print 'usage.draw STACK'
41
    print 'usage.warning ', warning
42
    print 'usage.critical ', critical
43
    print 'usage.type DERIVE'
44
    print 'usage.info CPU time spent by normal programs and daemons'
45
    sys.exit(0)
46

  
47
# Gathers info from the servers and gathers data
48
print 'usage.value '+snmpget(servername,snmpid)

Formats disponibles : Unified diff