Download
On this page you will find examples for configuration files.
Example 1: Error messages from FCAL-Devices
Usage as nagios-plugin to monitor FCAL-devices on a Solaris system. This is a basic example which scans for patterns in /var/adm/messages.
Example 2: Again, but this time as passive service using send_nsca
Using the following configfile you can run check_logfiles as standalone-script. If error messages are found in the messages file, a summary notification is sent to the NSCA server at the end of the check_logfile run.
Example 3: Again, but this time with a notification for each single hit
If you want a notification every time a line matching one of your patterns is found, use the following modified configfile. Be careful: If you expect hundreds of these lines, your server will be flooded.
Example 4: Check the correct function of the syslog service
In the following example a message will be sent to the syslog service imediately after check_logfiles starts up. After a delay of 5 seconds (which should be enough for the message to make it into the logfile) the logfile will be scanned for this message. If it cannot be found, this is counted as a critical error.
Example 5: Monitoring HP Service Guard
Here we look for typical error messages of the cluster software. The value HPUX of the rotation-parameter means, that both syslog.log and maybe OLDsyslog.log are scanned.
Example 6: Monitoring the LVM under HP-UX
In this example we look for typical logical volume manager error messages.
Example 7: Simple monitor for a SUN server’s hardware health
If failures or errors exist in the system, prtdiag -l outputs this information to syslogd. If a corresponding error message is found in the messages file, a defect was detected.
Example 8: Monitoring of SUN hardware by sending SNMP-traps
In this example we scan /var/adm/messages for patterns indicating upcoming hardware trouble. In this scenario check_logfiles runs not as a nagios-plugin but as a standalone script, which sends a snmp-trap if matching lines were found. Sending the trap is done by an external script which gets the needed information via environment variables.
Here just one single trap is sent at the end of check_logfile’s runtime. If you want a trap for each single matching line, move the $postscript definition as script definition inside the search.
Jörg Linge was so kind to contribute the following script:
Example 9: Monitoring SUN hardware using NSCA
Instead of SNMP-traps one could also report the errors to a nagios server using send_nsca. Here also check_logfiles runs as standalone script.
Example 10: Scan Linux logfiles as an unprivileged user
At the startup of check_logfiles the file attributes of the logfile are modified such that the nagios user can read them.
For this you need an entry in /etc/sudoers:
qqnagio ALL = (root) NOPASSWD: /usr/bin/setfacl
Should the sudo-command fail, then its exitcode of 1 together with the supersmartprescript-option forces check_logfiles to abort with a warning.
If you find the following line in /etc/sudoers
Defaults requiretty
it must be commented out.
Example 11: Monitoring Apache under Windows for intrusion attempts
Because of the ‘\’ Windows path names have to be set in single quotes.
Example 12: Revoke hits with the help of a script
Scripts of type supersmart can help you to take a more accurate look at matching lines and, if necessary, modify them.
Example 13: Monitoring of Fibre Channel Links
Using the type “virtual” one can monitor files in the /proc or /sys directory. In the following example the cable is pulled from an Emulex LPe1150 adapter.
Example 14: Forwarding of the Windows Eventlogs to a Unix-Syslogserver
If a messages file is composed of multiple servers’ events, because you forward the Windows eventlog to a Unix system, using the syslogclient option allows a directed search for messages coming from a specific Windows system.
Example 15: Searching the AIX errpt
AIX writes many messages in the so called Error Report which can be readout with the errpt command. With type=errpt you can instruct check_logfiles to scan errpt’s output instead of a real logfile.
Example 16: Windows EventLog forwarding with templates
If there are messages originating from different syslog clients in a logfile, they can be prefiltered with the name of such a client. To avoid definitions for each single client, you can use templates.
With templates you can formulate multiple searches in one configfile and pick only specific ones according to the type of the host. Without templates you would have to write a definition for each host.
For “normal” Windows-Clients you would run:
And for cluster servers:
Example 17: Oracle Alertlog
Oracle databases write their error messages into an alert log. Paying attention to these messages helps you detect potential problems before they cause a production outage. (please also refer to type => “oraclealertlog”)
Example 17a: Oracle RAC Clusterware Alertlog
Daniel Graef sent in this example for the monitoring of an Oracle Clusterware Alertlog. Thanks a lot!
Example 18: IPMI System Event Log
This example shows how to look for power supply problems by reading the IPMI System Event Log with theipmitool sel list command.
Example 19: Passive Checkresults which cannot be assigned
Passive Checkresults, which cannot be assigned a host or a service (e.g. because of a typo) are silently dropped (Apart from a notice in nagios.log). With this method, Nagios is able to send out a notification if this occurs. This was Augustinus’ idea.
Here just one single trap is sent at the end of check_logfile’s runtime. If you want a trap for each single matching line, move the $postscript definition as script definition inside the search.
For this you need an entry in /etc/sudoers:
qqnagio ALL = (root) NOPASSWD: /usr/bin/setfacl
Should the sudo-command fail, then its exitcode of 1 together with the supersmartprescript-option forces check_logfiles to abort with a warning.
If you find the following line in /etc/sudoers
Defaults requiretty
it must be commented out.
No comments:
Post a Comment