collectd-nagios: Implement the "-m" option (treat NaNs as critical).
[collectd.git] / src / collectd-nagios.pod
1 =head1 NAME
2
3 collectd-nagios - Nagios plugin for querying collectd
4
5 =head1 SYNOPSIS
6
7 collectd-nagios B<-s> I<socket> B<-n> I<value_spec> B<-H> I<hostname> I<[options]>
8
9 =head1 DESCRIPTION
10
11 This small program is the glue between collectd and nagios. collectd collects
12 various performance statistics which it provides via the C<unixsock plugin>,
13 see L<collectd-unixsock(5)>. This program is called by Nagios, connects to the
14 UNIX socket and reads the values from collectd. It then returns B<OKAY>,
15 B<WARNING> or B<CRITICAL> depending on the values and the ranges provided by
16 Nagios.
17
18 =head1 ARGUMENTS AND OPTIONS
19
20 The following arguments and options are required and understood by
21 collectd-nagios. The order of the arguments generally doesn't matter, as long
22 as no argument is passed more than once.
23
24 =over 4
25
26 =item B<-s> I<socket>
27
28 Path of the UNIX socket opened by collectd's C<unixsock plugin>.
29
30 =item B<-n> I<value_spec>
31
32 The value to read from collectd. The argument is in the form
33 C<plugin[-instance]/type[-instance]>.
34
35 =item B<-H> I<hostname>
36
37 Hostname to query the values for.
38
39 =item B<-d> I<data_source>
40
41 Each I<value_spec> may be made of multiple "data sources". With this option you
42 can select one or more data sources. To select multiple data sources simply
43 specify this option again. If multiple data sources are examined they are
44 handled according to the consolidation function given with the B<-g> option.
45
46 =item B<-g> B<none>I<|>B<average>I<|>B<sum>
47
48 When multiple data sources are selected from a value spec, they can be handled
49 differently depending on this option. The values of the following meaning:
50
51 =over 4
52
53 =item B<none>
54
55 No consolidation if done and the warning and critical regions are applied to
56 each value independently.
57
58 =item B<average>
59
60 The warning and critical ranges are applied to the average of all values.
61
62 =item B<sum>
63
64 The warning and critical ranges are applied to the sum of all values.
65
66 =item B<percentage>
67
68 The warning and critical ranges are applied to the ratio (in percent) of the
69 first value and the sum of all values. A warning is returned if the first
70 value is not defined or if all values sum up to zero.
71
72 =back
73
74 =item B<-c> I<range>
75
76 =item B<-w> I<range>
77
78 Set the critical (B<-c>) and warning (B<-w>) ranges. These options mostly
79 follow the normal syntax of Nagios plugins. The general format is
80 "I<min>B<:>I<max>". If a value is smaller than I<min> or bigger than I<max>, a
81 I<warning> or I<critical> status is returned, otherwise the status is
82 I<success>.
83
84 The tilde sign (B<~>) can be used to explicitly specify infinity. If B<~> is
85 used as a I<min> value, negative infinity is used. In case of I<max>, it is
86 interpreted as positive infinity.
87
88 If the first character of the I<range> is the atE<nbsp>sign (B<@>), the meaning
89 of the range will be inverted. I.E<nbsp>e. all values I<within> the range will
90 yield a I<warning> or I<critical> status, while all values I<outside> the range
91 will result in a I<success> status.
92
93 I<min> (and the colon) may be omitted,
94 I<min> is then assumed to be zero. If I<max> (but not the trailing colon) is
95 omitted, I<max> is assumed to be positive infinity.
96
97 =item B<-m>
98
99 If this option is given, "Not a Number" (NaN) is treated as I<critical>. By
100 default, the I<none> consolidation reports NaNs as I<warning>. Other
101 consolidations simply ignore NaN values.
102
103 =back
104
105 =head1 RETURN VALUE
106
107 As usual for Nagios plugins, this program writes a short, one line status
108 message to STDOUT and signals success or failure with it's return value. It
109 exits with a return value of B<0> for I<success>, B<1> for I<warning> and B<2>
110 for I<critical>. If the values are not available or some other error occurred,
111 it returns B<3> for I<unknown>.
112
113 =head1 SEE ALSO
114
115 L<collectd(1)>,
116 L<collectd.conf(5)>,
117 L<collectd-unixsock(5)>,
118 L<http://nagios.org/>
119
120 =head1 AUTHOR
121
122 Florian Forster E<lt>octoE<nbsp>atE<nbsp>verplant.orgE<gt>
123
124 =cut