To monitor for Apache config file errors in Zabbix do the following:
1. Create monitor test script at /etc/zabbix/apache_configtest.pl with the following contents:
1 2 3 4 5 6 7 8 |
#!/usr/bin/perl my $result = `/usr/sbin/apachectl configtest 2>&1`; if ($result =~ /Syntax\ OK/ ) { print "0"; } else { print "1"; }; |
2. Add the following line to the end of /etc/zabbix/zabbix_agentd.conf:
1 |
UserParameter=apache.configtest,/etc/zabbix/apache_configtest.pl |
3. From the Zabbix web interface add an Item for the new monitor at Configuration -> Items -> Create Item with the following settings:
1 2 3 4 5 6 |
Description: Apache config has errors Type: Zabbix Agent Key: apache.configtest Type of information: Numeric Status: Active Applications: Apache |
Other fields can be left at default.
4. Add a Trigger for the new Item at Configuration -> Triggers -> Create Trigger with the following settings:
1 2 3 |
Name: Apache config has errors Expression: {host:apache.configtest.last(0)}=1 Severity: Hight |
Other fields can be left at default.