root / plugins / snmp / snmp__brocade_temp_module_ @ e5ce7492
Historique | Voir | Annoter | Télécharger (2,69 ko)
| 1 | 4f432c59 | Benjamin Ryzman | #!/usr/bin/perl -w |
|---|---|---|---|
| 2 | |||
| 3 | =head1 MAGIC MARKERS |
||
| 4 | |||
| 5 | #%# family=snmpauto |
||
| 6 | #%# capabilities=snmpconf |
||
| 7 | |||
| 8 | =cut |
||
| 9 | |||
| 10 | use strict; |
||
| 11 | use Munin::Plugin; |
||
| 12 | use Munin::Plugin::SNMP; |
||
| 13 | |||
| 14 | my $DEBUG=$ENV{'MUNIN_DEBUG'};
|
||
| 15 | |||
| 16 | # This is the snmpwalk: |
||
| 17 | # snAgentTempSensorDescr.1.1 = STRING: "Line module 1, sensor 1 temperature" |
||
| 18 | # snAgentTempSensorDescr.1.2 = STRING: "Line module 1, sensor 2 temperature" |
||
| 19 | # snAgentTempSensorDescr.1.3 = STRING: "Line module 1, sensor 3 temperature" |
||
| 20 | # snAgentTempSensorDescr.1.4 = STRING: "Line module 1, sensor 4 temperature" |
||
| 21 | # snAgentTempSensorDescr.2.1 = STRING: "Line module 2, sensor 1 temperature" |
||
| 22 | # snAgentTempSensorDescr.2.2 = STRING: "Line module 2, sensor 2 temperature" |
||
| 23 | # snAgentTempSensorDescr.2.3 = STRING: "Line module 2, sensor 3 temperature" |
||
| 24 | # snAgentTempSensorDescr.2.4 = STRING: "Line module 2, sensor 4 temperature" |
||
| 25 | # snAgentTempSensorDescr.3.1 = STRING: "Active management module temperature" |
||
| 26 | # snAgentTempSensorDescr.3.2 = STRING: "Active management module temperature" |
||
| 27 | # snAgentTempValue.1.1 = INTEGER: 100 |
||
| 28 | # snAgentTempValue.1.2 = INTEGER: 106 |
||
| 29 | # snAgentTempValue.1.3 = INTEGER: 82 |
||
| 30 | # snAgentTempValue.1.4 = INTEGER: 72 |
||
| 31 | # snAgentTempValue.2.1 = INTEGER: 74 |
||
| 32 | # snAgentTempValue.2.2 = INTEGER: 102 |
||
| 33 | # snAgentTempValue.2.3 = INTEGER: 70 |
||
| 34 | # snAgentTempValue.2.4 = INTEGER: 74 |
||
| 35 | # snAgentTempValue.3.1 = INTEGER: 78 |
||
| 36 | # snAgentTempValue.3.2 = INTEGER: 84 |
||
| 37 | |||
| 38 | my $brcdIp = '1.3.6.1.4.1.1991'; |
||
| 39 | my $snAgentTempTable = "$brcdIp.1.1.2.13.1"; |
||
| 40 | my $snAgentTempSensorDescr = "$snAgentTempTable.1.3"; |
||
| 41 | my $snAgentTempValue = "$snAgentTempTable.1.4"; |
||
| 42 | |||
| 43 | |||
| 44 | if (defined $ARGV[0] and $ARGV[0] eq "snmpconf") {
|
||
| 45 | print "index $snAgentTempTable.1.3.\n"; |
||
| 46 | print "require $snAgentTempSensorDescr. [1-9]\n"; |
||
| 47 | print "require $snAgentTempValue. [1-9]\n"; |
||
| 48 | exit 0; |
||
| 49 | } |
||
| 50 | |||
| 51 | my $module = 0; |
||
| 52 | |||
| 53 | if ($Munin::Plugin::me =~ /_module_(\d+)$/) {
|
||
| 54 | $module = $1; |
||
| 55 | } else {
|
||
| 56 | die "Could not determine module number from ".$Munin::Plugin::me."\n"; |
||
| 57 | } |
||
| 58 | |||
| 59 | my ($session,$error); |
||
| 60 | |||
| 61 | $session = Munin::Plugin::SNMP->session(-translate => [ -nosuchinstance => undef ]); |
||
| 62 | |||
| 63 | my $sensor = 1; |
||
| 64 | if ($ARGV[0] and $ARGV[0] eq "config") {
|
||
| 65 | my ($host,undef,$version) = Munin::Plugin::SNMP->config_session(); |
||
| 66 | |||
| 67 | print "host_name $host\n" unless $host eq 'localhost'; |
||
| 68 | print "graph_title Module $module |
||
| 69 | graph_args --base 1000 --lower-limit 0 |
||
| 70 | graph_vlabel °C |
||
| 71 | graph_category system |
||
| 72 | graph_scale no\n"; |
||
| 73 | |||
| 74 | my $descr = undef; |
||
| 75 | while (defined ($descr = $session->get_single("$snAgentTempSensorDescr.$module.$sensor"))) {
|
||
| 76 | print "sensor$sensor.label $descr\n"; |
||
| 77 | $sensor ++; |
||
| 78 | } |
||
| 79 | exit 0; |
||
| 80 | } |
||
| 81 | |||
| 82 | my $value = undef; |
||
| 83 | while (defined ($value = $session->get_single("$snAgentTempValue.$module.$sensor"))) {
|
||
| 84 | $value /= 2; |
||
| 85 | print "sensor$sensor.value $value\n"; |
||
| 86 | $sensor++; |
||
| 87 | } |
||
| 88 | # vim:ft=perl |
