Nagios Hosts configuration
Contents
Host setup
- Add the host definition into the proper file into the /etc/nagios/hosts folder, the files are named based on group name:
- linux.cfg
- printers.cfg
- routers.cfg
- Add the host recently defined to a host group into the hostgroups.cfg file
The groups that are not used must be commented out.
Hosts definitions
A host definition could be a terminal, printer, router, ups, etc. Any individual unit.
How to add a network switch
To add a network switch with the host name netopia and the ip address 11.22.33.44:
define host{ host_name netopia alias Netopia address 11.22.33.44 }
How to add a Linux terminal
To add the host with the host name blnx-cl01 and the ip address 10.0.0.168:
define host{ use bashlinux-template host_name blnx-cl01 parents netopia address 10.0.0.168 }
How to add adding a printer
To add a printer with the host name hp5000 and the ip address 10.0.0.250 attached to the terminal blnx-cl01:
define host{ host_name hp5000 alias HP 5000 parents blnx-cl01 address 10.0.0.250 }
How to create Host groups
Once each unit are defined, they must be added one host existent group, or if there is no group that make sense for the kind of unit then the group could be created. Note that cannot be created a group without members.
- Adding Linux terminal group *
To add the host blnx-cl01 to the host group blnx-linux<tt>:
define hostgroup{ hostgroup_name blnx-linux alias Linux members volante-cl00, volante-cl01 }
The members is a comma-separated list. The same structure apply for all other groups.
Service groups
- Api*
- Apache
- status
- MySQL
- Process
- Status
- Messaging*
- Java
- Procs
- Threads
- Classes
- xmlBlaster
- Clients
- Memory
- Subscriptions
- Topics
- Net*
- Cisco
- Uptime
- Bandwidth
- Environment
- FastEthernet0
- Memory
- VLan
- Netopia
- Uptime
- Bandwidth
- NICs status
- Switch
- NICs status
- Uptime
- Server*
- Windows on DELL
- Bandwidth
- Memory
- Ping
- Services
- Storage
- Uptime
- Terminal*
- Mac hosts
- Memory
- NIC
- Ping
- Storage
- Swap
- Uptime
Configuration files
/etc/nagios
Main configuration folder
- Template:/etc/nagios/nagios Main configuration file for Nagios, setup nagios and paths.
- Template:/etc/nagios/cgi Nagios cgi configuration file, how to run the web service.
- Template:/etc/nagios/commands Nagios commands and plugins, commands to be executed on remote hosts and command alias, alias is the name that Nagios will use to call it.
- Template:/etc/nagios/contactgroups Groups to be notified for every kind of event.
- Template:/etc/nagios/htpasswd.users Password file to authenticate Nagios web service. This file is in apache
htpasswd format.
- Template:/etc/nagios/localhost All the related to the host running Nagios.
- Template:/etc/nagios/resource All sensitive date should be stored on this file like user, passwords and paths.
- Template:/etc/nagios/servicegroups Each group to be monitored should be added to this file
/etc/nagios/hosts
All the hosts configurations are done in this folder
- Template:/etc/nagios/hosts/hostgroups Each host grouped by hardware and/or Operating System should belongs
to one of the hostgroups specified in this file.
- Template:/etc/nagios/hosts/localhost Localhost
- Template:/etc/nagios/hosts/linux Linux hosts
- Template:/etc/nagios/hosts/mac Mac hosts
- Template:/etc/nagios/hosts/windows Windows hosts
- Template:/etc/nagios/hosts/printers Printers
- Template:/etc/nagios/hosts/routers Routers
- Template:/etc/nagios/hosts/switches Switches
/etc/nagios/servicegroups
All the services executions on each hosts are done in this folder
- Template:/etc/nagios/servicegroups/api-apache API Apache
- Template:/etc/nagios/servicegroups/api-mysql API MySQL
- Template:/etc/nagios/servicegroups/messaging-java Messaging Java
- Template:/etc/nagios/servicegroups/messaging-xmlblaster Messaging xmlBlaster
- Template:/etc/nagios/servicegroups/network-cisco Network Routers - Cisco
- Template:/etc/nagios/servicegroups/network-netopia Network Routers - Netopia
- Template:/etc/nagios/servicegroups/network-switches Network Switches
- Template:/etc/nagios/servicegroups/network-uptime Network Devices Uptime
- Template:/etc/nagios/servicegroups/server Linux Servers
- Template:/etc/nagios/servicegroups/terminal Mac Terminals