System information

58 System Analysis and Tuning Guide
5 Execute rcnagios restart and rcnsca restart.
Proceed as follows on the client you want to monitor:
Procedure3.3: Monitoring a Remote Host Resource with Nagios (client)
1 Install nagios-nsca-client on the host you want to monitor.
2 Write your test scripts (for example a script that checks the disk usage) like this:
#!/bin/bash
NAGIOS_SERVER=10.10.4.166
THIS_HOST=foobar
#
# Write own test algorithm here
#
# Execute On SUCCESS:
echo "$THIS_HOST;diskcheck;0;OK: test ok" \
| send_nsca -H $NAGIOS_SERVER -p 5667 -c /etc/nagios/
send_nsca.cfg -d ";"
# Execute On Warning:
echo "$THIS_HOST;diskcheck;1;Warning: test warning" \
| send_nsca -H $NAGIOS_SERVER -p 5667 -c /etc/nagios/
send_nsca.cfg -d ";"
# Execute On FAILURE:
echo "$THIS_HOST;diskcheck;2;CRITICAL: test critical" \
| send_nsca -H $NAGIOS_SERVER -p 5667 -c /etc/nagios/
send_nsca.cfg -d ";"
3 Insert a new cron entry with crontab -e. A typical cron entry could look like
this:
*/5 * * * * /directory/to/check/program/check_diskusage
3.5 Troubleshooting
Error: ABC 'XYZ' specified in ... '...' is not defined
anywhere!
Make sure that you have defined all necessary objects correctly. Be careful with
the spelling.