Configuring Nagios
Create Host Definitions
$cat /etc/nagios3/conf.d/www.gbweb.net.cfg # A simple configuration file for monitoring the local host # This can serve as an example for configuring other servers; # Custom services specific to this host are added here, but services # defined in nagios2-common_services.cfg may also apply. define host{ use generic-host ; Name of host template to use host_name www.gbweb.net alias GBwebNet Webserver address www.gbweb.net }
Create Hostgroups
$cat /etc/nagios3/conf.d/www.gbweb.net.cfg define hostgroup { hostgroup_name http-servers alias HTTP servers members www.gbweb.net,www.soul2solechiropractic.co.uk,jakebrown.gbweb.net,wiki.gbweb.net } define hostgroup { hostgroup_name https-servers alias Secure HTTP servers members catchy.gbweb.net,webmail.gbmail.biz,monitoring.gbweb.net }
Configure service definitions
$cat /etc/nagios3/conf.d/services_nagios2.cfg #check that web services are running define service { hostgroup_name http-servers service_description HTTP check_command check_http!H $host_name use generic-service notification_interval 0 ; set > 0 if you want to be renotified } define service { hostgroup_name https-servers service_description Secure HTTP check_command check_http!-ssl -H $host_name use generic-service notification_interval 0 ; set > 0 if you want to be renotified } define service { hostgroup_name dns-servers service_description Bind check_commandcheck_dns!gbweb.net use generic-service notification_interval 0 ; set > 0 if you want to be renotified }
change global command config
Some services need to have their global config changed Authoritative DNS lookups changed from:
$ cat ../../nagios-plugins/config/dns.cfg #'check_dns' command definition define command{ command_namecheck_dns command_line/usr/lib/nagios/plugins/check_dns -H www.google.co.uk-s '$HOSTADDRESS$' }
To:
$ cat ../../nagios-plugins/config/dns.cfg #'check_dns' command definition define command{ command_name check_dns command_line /usr/lib/nagios/plugins/check_dns -H $ARG1$ -s '$HOSTADDRESS$' }
$ARG1$ allow the first argument to the service definition to be used instead
Allow External commands
To allow the Nagios front end to execute commands:
Edit /etc/nagios3/nagios.cfg
check_external_commands=1
set permissions
Make sure that the user www-data is in the group nagios in /etc/group chmod g+rx /var/lib/nagios3/rw