Assume you already install Ubuntu 9.04 OS, now we can start install Nagios 3 software:
- Install Nagios version 3
# sudo apt-get install nagios3
- Create the web user password file after finished installation of Nagios 3
# sudo htpasswd -c /etc/nagios3/htpasswd.users nagiosadmin
New password: xxxxxxxx
Re-type new password: xxxxxxxx - Then you should already have a working Nagios!
Open a browser, and go to http://localhost/nagios3/
At the login prompt, login as:
User: nagiosadmin
Password: xxxxxxxx
Note: There was a problem with gvfs, you will see the following error message:Nagios sent error message "DISK CRITIAL - /home/usr/.gvfs is not accessible:Permission denied"
This problem is due to very special permissions set by fuse on the .gvfs directory. The workaround for this problem is here:
>> modify /etc/nagios/conf.d/localhost_nagios2.cfg as follows:define command{
command_name check_all_disks_plus
command_line /usr/lib/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -u GB -A -i .gvfs
}
define service{
use generic-service
host_name localhost
service_description Disk Space
check_command check_all_disks_plus!20%!10%
}
Then run# sudo /etc/init.d/nagios3 restart
- If you would like to add a new host for monitoring, then you should add the configuration file for it.
#cd /etc/nagios3/conf.d
#vi newhosts.cfg
define host{
use generic-host
host_name server1
alias server one at lab
address -------- [server1's IP address here]
} - Let's create a new hostgroup for occasion, and add new hosts to it.
Edit the file hostgroups_nagios2.cfg and add a new group:vi hostgroups_nagios2.cfg
define hostgroup{
hostgroup_name lab-servers
alias Lab Servers
members server1
} - Now let's associate some services to that host
# vi services_nagios2.cfg
- find the section called "check that ping-only hosts are up", and change the line:hostgroup_name ping-servers
tohostgroup_name ping-servers,lab-servers
- Verify that your configuration file is ok:
# nagios3 -v /etc/nagios3/nagios.cfg
... You should get:Total warnings: 0
Total errors: 0
Things look okay - No serious problems are detected during the check. - Reload/Restart Nagios Services
# /etc/init.d/nagios3 restart
- Go to the web intergace (http://localhost/nagios3) and check the host that you just added.
Once the new host can be monitored from above URL, you are ready to add all your Servers/PCs/Routers/Network Equipments that would like to monitor.
NOTE:
- This requires a bit of planning, but you should have all the elements for doing this...
- Think well about the logical structure of the files - it should be possible for you to do without doing too much work!