Projet

Général

Profil

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

root / plugins / netapp / snmp__netapp_cpu @ 17f78427

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

1 d85c9292 Thomas R. N. Jansson
#!/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 17f78427 Lars Kruse
# /net/netappfiler/vol0/etc/mib/traps.dat if the filer is
8 d85c9292 Thomas R. N. Jansson
# NFS automounted mounted on server.
9
# Example: the SNMP id for cpuBusyTimePerCent is
10 17f78427 Lars Kruse
# snmp.1.3.6.1.4.1.789.1.2.1.3.0
11
# and retrival of this value is done by
12 d85c9292 Thomas R. N. Jansson
# snmpget -v 1 -c public netappfiler 1.3.6.1.4.1.789.1.2.1.3.0
13
#
14 17f78427 Lars Kruse
# Requires snmpget and assumes public community.
15 d85c9292 Thomas R. N. Jansson
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 17f78427 Lars Kruse
critical    = 95
28 a2170c36 Diego Elio Pettenò
servername  = sys.argv[0].split('_')[1]
29 d85c9292 Thomas R. N. Jansson
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 a4710dc1 dipohl
    print 'graph_category cpu'
38 d85c9292 Thomas R. N. Jansson
39
    print 'usage.label cpu_usage '
40
    print 'usage.draw STACK'
41
    print 'usage.warning ', warning
42
    print 'usage.critical ', critical
43
    print 'usage.info CPU time spent by normal programs and daemons'
44
    sys.exit(0)
45
46
# Gathers info from the servers and gathers data
47
print 'usage.value '+snmpget(servername,snmpid)