Nagios – Server Monitoring Scheme

Nagios is an open source computer system monitoring, network monitoring and infrastructure monitoring software application. Nagios offers monitoring and alerting services for servers, switches, applications, and services. It alerts the users when things go wrong and alerts them a second time when the problem has been resolved.

Nagios Official Website www.nagios.org

Install Nagios

$ sudo apt-get install apache2
$ sudo apt-get install nagios3 nagios-plugins nagios-images

The configuration file is in /etc/nagios3/ directory.

Configuration Nagios

Permission settings

By default, user nagiosadmin has all permissions, you need to do is set a password for the user. For safety, we replace the user name ngadmin and set password.

$ sed 's/nagiosadmin/ngadmin/g' /etc/nagios3/cgi.cfg > /tmp/cgi.cfg
$ sudo mv /tmp/cgi.cfg /etc/nagios3/cgi.cfg
$ sudo htpasswd -c /etc/nagios3/htpasswd.users ngadmin

In the browser to http://yourdomain/nagios3/ view Nagios monitoring interface.

Enable external command

By default, Nagios disabled the external command.

Modify nagios.cfg file by sudo vim /etc/nagios3/nagios.cfg:

set check_external_commands=1
$ sudo /etc/init.d/nagios3 stop
$ sudo dpkg-statoverride --update --add nagios www-data 2710 /var/lib/nagios3/rw
$ sudo dpkg-statoverride --update --add nagios nagios 751 /var/lib/nagios3
$ sudo /etc/init.d/nagios3 start

Note: If not used dpkg-statoverride, only use chown/chmod to modify permissions, when the package upgraded( apt-get upgrade), the privilege will be overwritten.

If Nagios: It appears as though you do not have permission to view information for any of the hosts you requested…

Nagios – Server Monitoring Scheme

You have to do configuration in cgi.cfg, by default cgi.cfg is located in /etc/nagios3/cgi.cfg

The default user with permission to access is nagiosadmin, modify username as your set. Change all the parameters to the user you set to permit viewing. You can alternatively add user for authorization by using a comma after nagiosadmin.

Restart the nagios service after the cgi.cfg has been modified.

$ sudo service nagios restart

Nagios – Server Monitoring Scheme

5.00 avg. rating (98% score) - 1 vote