Changeset 865
- Timestamp:
- 03/30/05 02:39:49 (7 years ago)
- Files:
-
- people/ilmari/modularisation-branch/node/node.d/snmp__cpuload.in (modified) (3 diffs)
- people/ilmari/modularisation-branch/node/node.d/snmp__load.in (modified) (3 diffs)
- people/ilmari/modularisation-branch/node/node.d/snmp__processes.in (modified) (3 diffs)
- people/ilmari/modularisation-branch/node/node.d/snmp__users.in (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
people/ilmari/modularisation-branch/node/node.d/snmp__cpuload.in
r864 r865 69 69 70 70 use strict; 71 use Net::SNMP;71 use Munin::Plugin::SNMP; 72 72 73 73 my $DEBUG = 0; 74 my $MAXLABEL = 20; 75 76 my $host = $ENV{host} || undef; 77 my $port = $ENV{port} || 161; 78 my $community = $ENV{community} || "public"; 79 my $iface = $ENV{interface} || undef; 80 81 my $response; 74 my $hrProcessorLoad = '1.3.6.1.2.1.25.3.3.1.2'; 82 75 83 76 if (defined $ARGV[0] and $ARGV[0] eq "snmpconf") 84 77 { 85 print "require 1.3.6.1.2.1.25.3.3.1.2.1 [0-9]\n"; # Number78 print "require $hrProcessorLoad.1 [0-9]\n"; # Number 86 79 exit 0; 87 80 } 88 81 89 if ($0 =~ /^(?:|.*\/)snmp_([^_]+)_users$/) 90 { 91 $host = $1; 92 if ($host =~ /^([^:]+):(\d+)$/) 93 { 94 $host = $1; 95 $port = $2; 96 } 97 } 98 elsif (!defined($host)) 99 { 100 print "# Debug: $0 -- $1\n" if $DEBUG; 101 die "# Error: couldn't understand what I'm supposed to monitor."; 102 } 103 104 my ($session, $error) = Net::SNMP->session( 105 -hostname => $host, 106 -community => $community, 107 -port => $port 108 ); 82 my ($session, $error) = Munin::Plugin::SNMP->session(); 109 83 110 84 if (!defined ($session)) … … 115 89 if (defined $ARGV[0] and $ARGV[0] eq "config") 116 90 { 117 print "host_name $host\n";91 print "host_name ", $session->hostname(), "\n"; 118 92 print "graph_title CPU utilisation 119 93 graph_args --base 1000 -l 0 -u 100 … … 130 104 } 131 105 132 print "cpu.value ", &get_single ($session, "1.3.6.1.2.1.25.3.3.1.2.1"), "\n"; 133 134 sub get_single 135 { 136 my $handle = shift; 137 my $oid = shift; 138 139 print "# Getting single $oid...\n" if $DEBUG; 140 141 $response = $handle->get_request ($oid); 142 143 if (!defined $response->{$oid}) 144 { 145 return undef; 146 } 147 else 148 { 149 return $response->{$oid}; 150 } 151 } 152 106 print "cpu.value ", $session->get_single("$hrProcessorLoad.1"), "\n"; people/ilmari/modularisation-branch/node/node.d/snmp__load.in
r864 r865 66 66 67 67 use strict; 68 use Net::SNMP;68 use Munin::Plugin::SNMP; 69 69 70 70 my $DEBUG = 0; 71 my $MAXLABEL = 20; 72 73 my $host = $ENV{host} || undef; 74 my $port = $ENV{port} || 161; 75 my $community = $ENV{community} || "public"; 76 my $iface = $ENV{interface} || undef; 77 78 my $response; 71 my $laLoad = "1.3.6.1.4.1.2021.10.1.3"; 79 72 80 73 if (defined $ARGV[0] and $ARGV[0] eq "snmpconf") 81 74 { 82 print "require 1.3.6.1.4.1.2021.10.1.3.2 [0-9]\n"; # Number75 print "require $laLoad.2 [0-9]\n"; 83 76 exit 0; 84 77 } 85 78 86 if ($0 =~ /^(?:|.*\/)snmp_([^_]+)_load$/) 87 { 88 $host = $1; 89 if ($host =~ /^([^:]+):(\d+)$/) 90 { 91 $host = $1; 92 $port = $2; 93 } 94 } 95 elsif (!defined($host)) 96 { 97 print "# Debug: $0 -- $1\n" if $DEBUG; 98 die "# Error: couldn't understand what I'm supposed to monitor."; 99 } 100 101 my ($session, $error) = Net::SNMP->session( 102 -hostname => $host, 103 -community => $community, 104 -port => $port 105 ); 79 my ($session, $error) = Munin::Plugin::SNMP->session(); 106 80 107 81 if (!defined ($session)) … … 112 86 if (defined $ARGV[0] and $ARGV[0] eq "config") 113 87 { 114 print "host_name $host\n";88 print 'host_name ', $session->hostname(), "\n"; 115 89 print "graph_title Load average 116 90 graph_args --base 1000 -l 0 … … 126 100 } 127 101 128 print "load.value ", &get_single ($session, "1.3.6.1.4.1.2021.10.1.3.2"), "\n"; 129 130 sub get_single 131 { 132 my $handle = shift; 133 my $oid = shift; 134 135 print "# Getting single $oid...\n" if $DEBUG; 136 137 $response = $handle->get_request ($oid); 138 139 if (!defined $response->{$oid}) 140 { 141 return undef; 142 } 143 else 144 { 145 return $response->{$oid}; 146 } 147 } 148 102 print "load.value ", $session->get_single("$laLoad.2"), "\n"; people/ilmari/modularisation-branch/node/node.d/snmp__processes.in
r864 r865 63 63 64 64 use strict; 65 use Net::SNMP;65 use Munin::Plugin::SNMP; 66 66 67 67 my $DEBUG = 0; 68 my $MAXLABEL = 20; 69 70 my $host = $ENV{host} || undef; 71 my $port = $ENV{port} || 161; 72 my $community = $ENV{community} || "public"; 73 my $iface = $ENV{interface} || undef; 74 75 my $response; 68 my $hrSystemProcesses = '1.3.6.1.2.1.25.1.6'; 76 69 77 70 if (defined $ARGV[0] and $ARGV[0] eq "snmpconf") 78 71 { 79 print "require 1.3.6.1.2.1.25.1.6.0 [0-9]\n"; # Number72 print "require $hrSystemProcesses.0 [0-9]\n"; # Number 80 73 exit 0; 81 74 } 82 75 83 if ($0 =~ /^(?:|.*\/)snmp_([^_]+)_processes$/) 84 { 85 $host = $1; 86 if ($host =~ /^([^:]+):(\d+)$/) 87 { 88 $host = $1; 89 $port = $2; 90 } 91 } 92 elsif (!defined($host)) 93 { 94 print "# Debug: $0 -- $1\n" if $DEBUG; 95 die "# Error: couldn't understand what I'm supposed to monitor."; 96 } 97 98 my ($session, $error) = Net::SNMP->session( 99 -hostname => $host, 100 -community => $community, 101 -port => $port 102 ); 76 my ($session, $error) = Munin::Plugin::SNMP->session(); 103 77 104 78 if (!defined ($session)) … … 109 83 if (defined $ARGV[0] and $ARGV[0] eq "config") 110 84 { 111 print "host_name $host\n";85 print "host_name ", $session->hostname(), "\n"; 112 86 print "graph_title Number of Processes 113 87 graph_args --base 1000 -l 0 … … 123 97 } 124 98 125 print "processes.value ", &get_single ($session, "1.3.6.1.2.1.25.1.6.0"), "\n"; 126 127 sub get_single 128 { 129 my $handle = shift; 130 my $oid = shift; 131 132 print "# Getting single $oid...\n" if $DEBUG; 133 134 $response = $handle->get_request ($oid); 135 136 if (!defined $response->{$oid}) 137 { 138 return undef; 139 } 140 else 141 { 142 return $response->{$oid}; 143 } 144 } 145 99 print "processes.value ", $session->get_single("$hrSystemProcesses.0"), "\n"; people/ilmari/modularisation-branch/node/node.d/snmp__users.in
r864 r865 66 66 67 67 use strict; 68 use Net::SNMP;68 use Munin::Plugin::SNMP; 69 69 70 70 my $DEBUG = 0; 71 my $MAXLABEL = 20; 72 73 my $host = $ENV{host} || undef; 74 my $port = $ENV{port} || 161; 75 my $community = $ENV{community} || "public"; 76 my $iface = $ENV{interface} || undef; 77 78 my $response; 71 my $hrSystemNumUsers = '1.3.6.1.2.1.25.1.5'; 79 72 80 73 if (defined $ARGV[0] and $ARGV[0] eq "snmpconf") 81 74 { 82 print "require 1.3.6.1.2.1.25.1.5.0 [0-9]\n"; # Number75 print "require $hrSystemNumUsers.0 [0-9]\n"; # Number 83 76 exit 0; 84 77 } 85 78 86 if ($0 =~ /^(?:|.*\/)snmp_([^_]+)_users$/) 87 { 88 $host = $1; 89 if ($host =~ /^([^:]+):(\d+)$/) 90 { 91 $host = $1; 92 $port = $2; 93 } 94 } 95 elsif (!defined($host)) 96 { 97 print "# Debug: $0 -- $1\n" if $DEBUG; 98 die "# Error: couldn't understand what I'm supposed to monitor."; 99 } 100 101 my ($session, $error) = Net::SNMP->session( 102 -hostname => $host, 103 -community => $community, 104 -port => $port 105 ); 79 my ($session, $error) = Munin::Plugin::SNMP->session(); 106 80 107 81 if (!defined ($session)) … … 112 86 if (defined $ARGV[0] and $ARGV[0] eq "config") 113 87 { 114 print "host_name $host\n";88 print "host_name ", $session->hostname(), "\n"; 115 89 print "graph_title Number of users 116 90 graph_args --base 1000 -l 0 … … 127 101 } 128 102 129 print "users.value ", &get_single ($session, "1.3.6.1.2.1.25.1.5.0"), "\n"; 130 131 sub get_single 132 { 133 my $handle = shift; 134 my $oid = shift; 135 136 print "# Getting single $oid...\n" if $DEBUG; 137 138 $response = $handle->get_request ($oid); 139 140 if (!defined $response->{$oid}) 141 { 142 return undef; 143 } 144 else 145 { 146 return $response->{$oid}; 147 } 148 } 149 103 print "users.value ", $session->get_single("$hrSystemNumUsers.0"), "\n";
