Nagios Getting Started Step-By-Step?
Posted: Thu Jun 23, 2016 8:11 am
Hello...
Trying to get a handle on Nagios for the first time, using the Open Source Core, not XI.
I've found the documentation on the Nagios site very useful and successfully completed an initial install (4.1.1) on a Fedora test box.
Now that the basic system is up and running, I'm struggling to find a basic tutorial / guide which explains how to configure additional hosts etc. and how the various addons/checks are used. In particular how the various config files come together to make things work. If there is a summary document / link for this, please send me a link and ignore the rest of this post.
Using check_ncpa as an example and based on the 'check_ncpa.py' topic I found here: https://support.nagios.com/forum/viewtopic.php?f=7&t=34572, I think I have sussed out the explanation below - Please let me know if I have understood things correctly so far, or if I am getting mixed up...
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
$Nagios_DIR/etc/nagios.cfg --> Main configuration file. Controls overall environment and settings. Decide here which .cfg files to enable.
$Nagios_DIR/etc/commands.cfg --> Command definitions for all the checks run.
$Nagios_DIR/objects/*.cfg --> Config files grouped by similar services / devices. This is where the main host/device checks are defined (individual Hosts and their corresponding Services to check)
$Nagios_DIR/libexec/ --> These are the binaries/scripts for the checks to be run. External addons downloaded to be placed here.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
Steps to follow to add host to server using check_ncpa.py:
1. Install ncpa OS executable on remote machine.
I'm not sure yet of the difference between 'passive' and 'active' check, but I chose Active as is seemed the easiest and only added a token during the install.
There is mention of nrds / nrdp, but I am not sure what these are and if they are needed.
2. Copy check_ncpa.py script under '$Nagios_DIR/libexec/'. Make executable and owned user:group nagios.
3. Add command definition for 'check_ncpa.py' to '$Nagios_DIR/etc/commands.cfg'. Not strictly necessary in this file, but keeps things 'clean' across the system.
define command{
command_name check_ncpa
command_line /usr/local/nagios/libexec/check_ncpa.py -H $HOSTADDRESS$ $ARG1$
}
4. Add host(s) to check and service definitions to '$Nagios_DIR/objects/*.cfg'.
I can create a new file here (adding this file to nagios.cfg, or use one of the existing templates and allow the template from nagios.cfg).
Similar checks will be run on multiple hosts so add hostgroup definition:
define hostgroup{
hostgroup_name windows-servers
}
Add Host to be checked:
define host{
use windows-server
hostname test_host
hostgroups windows_servers
address x.x.x.x
}
Add services to be checked -- Command here will vary, depending on the addon/check??
define service{
use generic-service
host_name test_host
service_description NCPA CPU Percent
check_command check_ncpa!-t 'xyz' -P 5693 -M cpu/percent -w 40 -c 80
}
define service{
use generic-service
host_name test_host
service_description NCPA DISK free
check_command check_ncpa!-t 'xyz' -P 5693 -M 'disk/logical/C:|/free' -w 80 -c 90
}
define service{
use generic-service
host_name test_host
service_description NCPA ETH0 recevied
check_command check_ncpa!-t 'xyz' -P 5693 -M windowscounters/interface/Ethernet0/bytes_recv'
}
And this is repeated for each host, or at least a new host using the same hostgroup would simply need a new host definition added.
Any advice/comments welcome.
Thanks,
Manny
Trying to get a handle on Nagios for the first time, using the Open Source Core, not XI.
I've found the documentation on the Nagios site very useful and successfully completed an initial install (4.1.1) on a Fedora test box.
Now that the basic system is up and running, I'm struggling to find a basic tutorial / guide which explains how to configure additional hosts etc. and how the various addons/checks are used. In particular how the various config files come together to make things work. If there is a summary document / link for this, please send me a link and ignore the rest of this post.
Using check_ncpa as an example and based on the 'check_ncpa.py' topic I found here: https://support.nagios.com/forum/viewtopic.php?f=7&t=34572, I think I have sussed out the explanation below - Please let me know if I have understood things correctly so far, or if I am getting mixed up...
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
$Nagios_DIR/etc/nagios.cfg --> Main configuration file. Controls overall environment and settings. Decide here which .cfg files to enable.
$Nagios_DIR/etc/commands.cfg --> Command definitions for all the checks run.
$Nagios_DIR/objects/*.cfg --> Config files grouped by similar services / devices. This is where the main host/device checks are defined (individual Hosts and their corresponding Services to check)
$Nagios_DIR/libexec/ --> These are the binaries/scripts for the checks to be run. External addons downloaded to be placed here.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
Steps to follow to add host to server using check_ncpa.py:
1. Install ncpa OS executable on remote machine.
I'm not sure yet of the difference between 'passive' and 'active' check, but I chose Active as is seemed the easiest and only added a token during the install.
There is mention of nrds / nrdp, but I am not sure what these are and if they are needed.
2. Copy check_ncpa.py script under '$Nagios_DIR/libexec/'. Make executable and owned user:group nagios.
3. Add command definition for 'check_ncpa.py' to '$Nagios_DIR/etc/commands.cfg'. Not strictly necessary in this file, but keeps things 'clean' across the system.
define command{
command_name check_ncpa
command_line /usr/local/nagios/libexec/check_ncpa.py -H $HOSTADDRESS$ $ARG1$
}
4. Add host(s) to check and service definitions to '$Nagios_DIR/objects/*.cfg'.
I can create a new file here (adding this file to nagios.cfg, or use one of the existing templates and allow the template from nagios.cfg).
Similar checks will be run on multiple hosts so add hostgroup definition:
define hostgroup{
hostgroup_name windows-servers
}
Add Host to be checked:
define host{
use windows-server
hostname test_host
hostgroups windows_servers
address x.x.x.x
}
Add services to be checked -- Command here will vary, depending on the addon/check??
define service{
use generic-service
host_name test_host
service_description NCPA CPU Percent
check_command check_ncpa!-t 'xyz' -P 5693 -M cpu/percent -w 40 -c 80
}
define service{
use generic-service
host_name test_host
service_description NCPA DISK free
check_command check_ncpa!-t 'xyz' -P 5693 -M 'disk/logical/C:|/free' -w 80 -c 90
}
define service{
use generic-service
host_name test_host
service_description NCPA ETH0 recevied
check_command check_ncpa!-t 'xyz' -P 5693 -M windowscounters/interface/Ethernet0/bytes_recv'
}
And this is repeated for each host, or at least a new host using the same hostgroup would simply need a new host definition added.
Any advice/comments welcome.
Thanks,
Manny