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
|
=cut
TITLE=Configuration - Scripts
DESCRIPTION=script definition for the port-collector
KEYWORDS=configuration,scripts,port-collector
DOCTOP=index
DOCPREV=configfile-rrds
DOCNEXT=configfile-times
=pod
=head1 Configuration - Scripts
The C<script XXX> files are describing how to query a given port for
its status and are used by the L<port-collector>. They look like:
send GET / HTTP/1\.0\n\n
timeout 5
port 80
infopattern ^Server:\s+(.*)$
valuepattern ^Content-length:\s*(\d+)
ok ^HTTP/\d\.\d 200
warn ^HTTP/\d\.\d [45]\d\d
This example is taken from the supplied C<config-base> and queries an
HTTP server for its root page. First, it sends the "send" text, which
in this case is a minimal HTTP request, and waits no more than 5 seconds.
After the port is closed from the remote end, or the timeout expires,
any text which was returned is examined by the various tests. In this
case, if the web-server sends back a line beginning something like
"HTTP/1.1 200", the port will be marked as "OK". Similarly, there are
"warn", "error" and "critical" statuses possible.
The C<port> is optional and C<getservbyname> will be called on the
script name, if port isn't specified. This also lets you have multiple
scripts for the same port, using different names for the script.
The C<infopattern> is optional, and supplies a pattern which will be matched
against each line in the result. If there is a match, files will be created
in the data directory for that host called C<INFOn-rrdname>, where C<n> will
be in the range 1..9 and C<rrdname> will be the name of this rrd, converted to
a file-name. The files will contain matches for parenthesised items in the
regular expression. E.G. in the example above, a file will be created called
C<INFO1-http> which will contain whatever the web-server said its
type and version was.
Similarly, the C<valuepattern> is also optional, but the matches will be returned
as collected items called C<value1> through C<value9>. In the example, this
would cause the collector to return a line like:
hostname timestamp value1 1022
An RRD definition could use this by including a line like:
data pagesize=value1 GAUGE:600:0:10000
For a working example, look at the RRD definition for weathernetwork.
|