Monitoring Agent test configuration examples
When adding internal or external tests for Monitoring Agents to the sgagent.conf file, you can use the following examples as a guide.
Internal Test Example
In this example, the test checks that server1 is listening to traffic on port 80. In this example, the port information and the IP address of the server are required in the
command
definition. The test is performed every two minutes, and if there is a failure, the server is excluded from the Server Pool. If the test fails, the /etc/init.d/port start
script is run. If the subsequent tests succeed within 10 minutes of the failure, recovery occurs and the server returns to the OK state: test “port listening test”
interval 2:00
action exclude
host server1
script /etc/init.d/port start
recovery 10:00
command portlistening 80 192.168.1.1
External Test Example
In this example, the external test script test.sh is run. There are three attempts to run the test before it is considered failed, and the tester waits for one second before the test is timed out. The test is run every 10 minutes, and if there is a failure an alert is generated:test “multiple_services”
interval 10:00
action alert
command external 3 1000 /usr/lib/server/test.sh 192.168.1.1