Configuration - Scripts
The script XXX
files are describing how to query a given port for
its status and are used by the 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 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 port
is optional and 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 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 INFOn-rrdname
, where n
will
be in the range 1..9 and 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
INFO1-http
which will contain whatever the web-server said its
type and version was.
Similarly, the valuepattern
is also optional, but the matches will be returned
as collected items called value1
through 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.
[