Lines 5-21
Link Here
|
5 |
|
5 |
|
6 |
apc_nis - Plugin to monitor APC UPS via the nis port of apcupsd |
6 |
apc_nis - Plugin to monitor APC UPS via the nis port of apcupsd |
7 |
|
7 |
|
8 |
=cut |
8 |
=head1 CONFIGURATION |
|
|
9 |
|
10 |
The following configuration parameters are used by this plugin |
11 |
|
12 |
[apc_nis] |
13 |
env.host - hostname to connect to |
14 |
env.port - port number to connect to |
15 |
|
16 |
=head2 DEFAULT CONFIGURATION |
17 |
|
18 |
[apc_nis] |
19 |
env.host 127.0.0.1 |
20 |
env.port 3551 |
9 |
|
21 |
|
10 |
# |
22 |
=head1 MAGIC MARKERS |
11 |
# |
23 |
|
12 |
# Parameters: |
24 |
#%# family=contrib |
13 |
# |
25 |
|
14 |
# config (required) |
26 |
=cut |
15 |
# |
|
|
16 |
# Magic markers (optional - used by munin-config and some installation |
17 |
# scripts): |
18 |
#%# family=contrib |
19 |
|
27 |
|
20 |
use IO::Socket; |
28 |
use IO::Socket; |
21 |
use strict; |
29 |
use strict; |
Lines 25-32
if($ARGV[0] and $ARGV[0] eq "autoconfig") {
Link Here
|
25 |
exit 0; |
33 |
exit 0; |
26 |
} |
34 |
} |
27 |
|
35 |
|
|
|
36 |
my $host = exists $ENV{'host'} ? $ENV{'host'} : "127.0.0.1"; |
37 |
my $port = exists $ENV{'port'} ? $ENV{'port'} : "3551"; |
38 |
|
28 |
if($ARGV[0] and $ARGV[0] eq "config") { |
39 |
if($ARGV[0] and $ARGV[0] eq "config") { |
29 |
print "graph_title apcupsd\n"; |
40 |
print "graph_title apcupsd $host:$port\n"; |
30 |
print "graph_args -l 0 --base 1000\n"; |
41 |
print "graph_args -l 0 --base 1000\n"; |
31 |
print "graph_vlabel A bit of all (Volt, time, %)\n"; |
42 |
print "graph_vlabel A bit of all (Volt, time, %)\n"; |
32 |
print "battery_volt.label batt volt (V)\n"; |
43 |
print "battery_volt.label batt volt (V)\n"; |
Lines 50-60
if($ARGV[0] and $ARGV[0] eq "config") {
Link Here
|
50 |
exit 0; |
61 |
exit 0; |
51 |
} |
62 |
} |
52 |
|
63 |
|
53 |
my $server = "localhost"; |
|
|
54 |
my $port = "3551"; |
55 |
|
56 |
my $sock = new IO::Socket::INET ( |
64 |
my $sock = new IO::Socket::INET ( |
57 |
PeerAddr => $server, |
65 |
PeerAddr => $host, |
58 |
PeerPort => $port, |
66 |
PeerPort => $port, |
59 |
Proto => 'tcp' |
67 |
Proto => 'tcp' |
60 |
); |
68 |
); |
61 |
- |
|
|