Nagios on Debian
For monitoring my server I decided to give Nagios a try. The install is very straightforward:
omega:~# aptitude install nagios3-core
This also installs the packages nagios-plugins, nagios-plugins-basic, nagios-plugins-standard and nagios3-common. The only thing Debian specific in the /usr/share/doc/nagios3-common/README.Debian is a note about running external commands from Nagios:
/etc/init.d/nagios3 stop dpkg-statoverride --update --add nagios www-data 2710 /var/lib/nagios3/rw dpkg-statoverride --update --add nagios nagios 751 /var/lib/nagios3 /etc/init.d/nagios3 start
A service startup file is added in /etc/init.d/nagios3 and the service is immediately started after the package install:
omega:/etc/init.d# ps xa|grep nagios 14937 pts/0 S+ 0:00 grep nagios 24092 ? SNs 0:00 /usr/sbin/nagios3 -d /etc/nagios3/nagios.cfg
I also immediately got two emails from Nagios, one telling me a filesystem is getting full and one telling me that a lot of processes are running on my server. I knew this last bit already.
Configuration
The main config file is right where I expect it, /etc/nagios3/nagios.cfg. Lots of parameters there, but most very comprehensive and well documented. The configured logfile /var/log/nagios3/nagios.log immediately shows the emailed alerts in a human readable format and the /etc/nagios3/command.cfg immediately shows how I got the emails I got:
define command{
command_name notify-host-by-email
....
This is just one of the more important command definitions in this file but there are a few others as well, I’m already getting the hang of this thing after 10 minutes or so.
nagios.cfg also sets two config_dir parameters, /etc/nagios-plugins/config and /etc/nagios3/conf.d. These are both directories in which we find several files. The conf.d directory has files that:
- contacts_nagios2.cfg: defines a few contacts
- extinfo_nagios2.cfg: defines host and service information
- generic-host_nagios2.cfg: defines a template for a host
- generic-service_nagios2.cfg: defines a template for a service
- hostgroups_nagios2.cfg: defines generic hostgroups
- localhost_nagios2.cfg: defines an actual host, localhost
- services_nagios2.cfg: defines web service and ssh service
- timeperiods_nagios2.cfg: defines the timings for monitoring
The nagios-plugins/config directory has files that:
- apt.cfg: check apt
- breeze.cfg: wireless?
- dhcp.cfg: check dhcp server
- disk.cfg: check diskspace
- disk-smb.cfg: check SMB
- dns.cfg: check DNS
- flexlm.cfg: check flexlm
- fping.cfg: check fping
- ftp.cfg: check ftp
- games.cfg: check games
- hppjd.cfg: HP printer?
- http.cfg: check webserver
- ifstatus.cfg: check network interfaces
- ldap.cfg: check ldap server
- load.cfg: check system load
- mail.cfg: check mailserver
- mailq.cfg: check mailserver
- mrtg.cfg: Check mrtg
- mysql.cfg: check MySQL database server
- netware.cfg:
- news.cfg:
- nt.cfg:
- ntp.cfg:
- pgsql.cfg:
- ping.cfg:
- procs.cfg:
- radius.cfg:
- real.cfg:
- rpc-nfs.cfg:
- snmp.cfg:
- ssh.cfg:
- tcp_udp.cfg:
- telnet.cfg:
- users.cfg:
