forked from munin-monitoring/munin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsnmp__print_pages
executable file
·95 lines (65 loc) · 2.05 KB
/
snmp__print_pages
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/usr/bin/perl -w
=encoding utf8
=head1 NAME
snmp__print_supplies - SNMP plugin to monitor pages printed on
printers adhering to RFC1759.
=head1 APPLICABLE SYSTEMS
Any SNMP capable printer adhering to RFC1759. Using a command such
as "munin-node-configure --snmp xerox.skillingstad.no --snmpversion 2c
--snmpcommunity public | sh -x" should auto-detect all applicable
interfaces.
=head1 CONFIGURATION
As a rule SNMP plugins need site specific configuration. The default
configuration (shown here) will only work on insecure sites/devices:
[snmp_*]
env.version 2
env.community public
In general SNMP is not very secure at all unless you use SNMP version
3 which supports authentication and privacy (encryption). But in any
case the community string for your devices should not be "public".
Please see 'perldoc Munin::Plugin::SNMP' for further configuration
information.
=head1 MAGIC MARKERS
#%# family=snmpauto
#%# capabilities=snmpconf
=head1 BUGS
For printers having duplex module: pages != number of sheets
=head1 AUTHOR
Copyright (C) 2006-2009 Rune Nordbøe Skillingstad
=head1 LICENSE
GPLv2
=cut
use strict;
use Munin::Plugin;
use Munin::Plugin::SNMP;
my $oid = '1.3.6.1.2.1.43.10.2.1.4.1.1';
my $response;
if(defined $ARGV[0] and $ARGV[0] eq "snmpconf") {
print "require ${oid}.\n";
exit 0;
}
my ($session, $error);
# SNMP needed for both config and fetch.
$session = Munin::Plugin::SNMP->session();
if(!defined ($session)) {
die "Croaking: $error";
}
if(defined $ARGV[0] and $ARGV[0] eq "config") {
my ($host,undef,$version) = Munin::Plugin::SNMP->config_session();
print "host_name $host\n" unless $host eq 'localhost';
print "graph_title Pages
graph_args --base 1000 -l 0
graph_vlabel Printed pages pr minute
graph_scale no
graph_category printing
graph_info This graph numer of printed pages
graph_total Total
pages.label pages
pages.draw AREA
pages.type DERIVE
pages.cdef pages,60,*
pages.info pages printed pr minute
";
exit 0;
}
print "pages.value ", $session->get_single($oid), "\n";