Difference between revisions of "Nagios Hosts configuration"

From Bashlinux
Jump to: navigation, search
 
Line 9: Line 9:
 
The groups that are not used must be commented out.
 
The groups that are not used must be commented out.
   
== Hosts definitions ==
+
== Host definitions ==
 
A host definition could be a terminal, printer, router, ups, etc. Any individual unit.
 
A host definition could be a terminal, printer, router, ups, etc. Any individual unit.
 
=== How to add a network switch ===
 
=== How to add a network switch ===
Line 22: Line 22:
 
To add the host with the host name <tt>blnx-cl01</tt> and the ip address <tt>10.0.0.168</tt>:
 
To add the host with the host name <tt>blnx-cl01</tt> and the ip address <tt>10.0.0.168</tt>:
 
define host{
 
define host{
use bashlinux-template
+
use bashlinux-template
host_name blnx-cl01
+
host_name blnx-cl01
parents netopia
+
parents netopia
address 10.0.0.168
+
address 10.0.0.168
 
}
 
}
   
=== How to add adding a printer ===
+
=== How to add a printer ===
 
To add a printer with the host name <tt>hp5000</tt> and the ip address <tt>10.0.0.250</tt> attached to the terminal <tt>blnx-cl01</tt>:
 
To add a printer with the host name <tt>hp5000</tt> and the ip address <tt>10.0.0.250</tt> attached to the terminal <tt>blnx-cl01</tt>:
 
define host{
 
define host{
host_name hp5000
+
host_name hp5000
alias HP 5000
+
alias HP 5000
parents blnx-cl01
+
parents blnx-cl01
address 10.0.0.250
+
address 10.0.0.250
 
}
 
}
   
  +
== Hostgroup definitions ==
=== 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.
 
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 *
+
=== How to add a Linux terminal group ===
To add the host <tt>blnx-cl01</tt> to the host group <tt>blnx-linux<tt>:
+
To add the host <tt>blnx-cl01</tt> to the host group <tt>blnx-linux</tt>:
 
define hostgroup{
 
define hostgroup{
hostgroup_name blnx-linux
+
hostgroup_name blnx-linux
alias Linux
+
alias Linux
members volante-cl00, volante-cl01
+
members blnx-cl00, blnx-cl01
 
}
 
}
   
Line 50: Line 50:
   
 
==== Service groups ====
 
==== Service groups ====
*Api*
+
'''Api'''<br>
 
* Apache
 
* Apache
 
** status
 
** status
Line 57: Line 57:
 
** Status
 
** Status
   
*Messaging*
+
'''Messaging'''<br>
 
* Java
 
* Java
 
** Procs
 
** Procs
Line 68: Line 68:
 
** Topics
 
** Topics
   
*Net*
+
'''Net'''<br>
 
* Cisco
 
* Cisco
 
** Uptime
 
** Uptime
Line 84: Line 84:
 
** Uptime
 
** Uptime
   
*Server*
+
'''Server'''<br>
 
* Windows on DELL
 
* Windows on DELL
 
** Bandwidth
 
** Bandwidth
Line 93: Line 93:
 
** Uptime
 
** Uptime
   
*Terminal*
+
'''Terminal'''<br>
 
* Mac hosts
 
* Mac hosts
 
** Memory
 
** Memory
Line 103: Line 103:
   
 
== Configuration files ==
 
== Configuration files ==
==== /etc/nagios ====
+
'''/etc/nagios'''<br>
 
Main configuration folder
 
Main configuration folder
* {{/etc/nagios/nagios}} Main configuration file for Nagios, setup nagios and paths.
+
* <tt>/etc/nagios/nagios</tt> Main configuration file for Nagios, setup nagios and paths.
* {{/etc/nagios/cgi}} Nagios cgi configuration file, how to run the web service.
+
* <tt>/etc/nagios/cgi</tt> Nagios cgi configuration file, how to run the web service.
* {{/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.
+
* <tt>/etc/nagios/commands</tt> 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.
* {{/etc/nagios/contactgroups}} Groups to be notified for every kind of event.
+
* <tt>/etc/nagios/contactgroups</tt> Groups to be notified for every kind of event.
* {{/etc/nagios/htpasswd.users}} Password file to authenticate Nagios web service. This file is in apache
+
* <tt>/etc/nagios/htpasswd.users</tt> Password file to authenticate Nagios web service. This file is in Apache htpasswd format.
  +
* <tt>/etc/nagios/localhost</tt> All the related to the host running Nagios.
htpasswd format.
 
* {{/etc/nagios/localhost}} All the related to the host running Nagios.
+
* <tt>/etc/nagios/resource</tt> All sensitive date should be stored on this file like user, passwords and paths.
* {{/etc/nagios/resource}} All sensitive date should be stored on this file like user, passwords and paths.
+
* <tt>/etc/nagios/servicegroups</tt> Each group to be monitored should be added to this file
* {{/etc/nagios/servicegroups}} Each group to be monitored should be added to this file
 
 
==== /etc/nagios/hosts ====
 
   
 
'''/etc/nagios/hosts'''<br>
 
All the hosts configurations are done in this folder
 
All the hosts configurations are done in this folder
* {{/etc/nagios/hosts/hostgroups}} Each host grouped by hardware and/or Operating System should belongs
+
* <tt>/etc/nagios/hosts/hostgroups</tt> Each host grouped by hardware and/or Operating System should belongs to one of the hostgroups specified in this file.
 
* <tt>/etc/nagios/hosts/localhost</tt> Localhost
to one of the hostgroups specified in this file.
 
* {{/etc/nagios/hosts/localhost}} Localhost
+
* <tt>/etc/nagios/hosts/linux</tt> Linux hosts
* {{/etc/nagios/hosts/linux}} Linux hosts
+
* <tt>/etc/nagios/hosts/mac</tt> Mac hosts
* {{/etc/nagios/hosts/mac}} Mac hosts
+
* <tt>/etc/nagios/hosts/windows</tt> Windows hosts
* {{/etc/nagios/hosts/windows}} Windows hosts
+
* <tt>/etc/nagios/hosts/printers</tt> Printers
* {{/etc/nagios/hosts/printers}} Printers
+
* <tt>/etc/nagios/hosts/routers</tt> Routers
* {{/etc/nagios/hosts/routers}} Routers
+
* <tt>/etc/nagios/hosts/switches</tt> Switches
* {{/etc/nagios/hosts/switches}} Switches
 
 
==== /etc/nagios/servicegroups ====
 
   
 
'''/etc/nagios/servicegroups'''<br>
 
All the services executions on each hosts are done in this folder
 
All the services executions on each hosts are done in this folder
* {{/etc/nagios/servicegroups/api-apache}} API Apache
+
* <tt>/etc/nagios/servicegroups/api-apache</tt> API Apache
* {{/etc/nagios/servicegroups/api-mysql}} API MySQL
+
* <tt>/etc/nagios/servicegroups/api-mysql</tt> API MySQL
* {{/etc/nagios/servicegroups/messaging-java}} Messaging Java
+
* <tt>/etc/nagios/servicegroups/messaging-java</tt> Messaging Java
* {{/etc/nagios/servicegroups/messaging-xmlblaster}} Messaging xmlBlaster
+
* <tt>/etc/nagios/servicegroups/messaging-xmlblaster</tt> Messaging xmlBlaster
* {{/etc/nagios/servicegroups/network-cisco}} Network Routers - Cisco
+
* <tt>/etc/nagios/servicegroups/network-cisco</tt> Network Routers - Cisco
* {{/etc/nagios/servicegroups/network-netopia}} Network Routers - Netopia
+
* <tt>/etc/nagios/servicegroups/network-netopia</tt> Network Routers - Netopia
* {{/etc/nagios/servicegroups/network-switches}} Network Switches
+
* <tt>/etc/nagios/servicegroups/network-switches</tt> Network Switches
* {{/etc/nagios/servicegroups/network-uptime}} Network Devices Uptime
+
* <tt>/etc/nagios/servicegroups/network-uptime</tt> Network Devices Uptime
* {{/etc/nagios/servicegroups/server}} Linux Servers
+
* <tt>/etc/nagios/servicegroups/server</tt> Linux Servers
* {{/etc/nagios/servicegroups/terminal}} Mac Terminals
+
* <tt>/etc/nagios/servicegroups/terminal</tt> Mac Terminals

Latest revision as of 21:47, 8 June 2015

Host setup

  1. 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
  2. Add the host recently defined to a host group into the hostgroups.cfg file

The groups that are not used must be commented out.

Host 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 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
        }

Hostgroup definitions

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.

How to add a Linux terminal group

To add the host blnx-cl01 to the host group blnx-linux:

define hostgroup{
        hostgroup_name         blnx-linux
        alias                  Linux
        members                blnx-cl00, blnx-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

  • /etc/nagios/nagios Main configuration file for Nagios, setup nagios and paths.
  • /etc/nagios/cgi Nagios cgi configuration file, how to run the web service.
  • /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.
  • /etc/nagios/contactgroups Groups to be notified for every kind of event.
  • /etc/nagios/htpasswd.users Password file to authenticate Nagios web service. This file is in Apache htpasswd format.
  • /etc/nagios/localhost All the related to the host running Nagios.
  • /etc/nagios/resource All sensitive date should be stored on this file like user, passwords and paths.
  • /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

  • /etc/nagios/hosts/hostgroups Each host grouped by hardware and/or Operating System should belongs to one of the hostgroups specified in this file.
  • /etc/nagios/hosts/localhost Localhost
  • /etc/nagios/hosts/linux Linux hosts
  • /etc/nagios/hosts/mac Mac hosts
  • /etc/nagios/hosts/windows Windows hosts
  • /etc/nagios/hosts/printers Printers
  • /etc/nagios/hosts/routers Routers
  • /etc/nagios/hosts/switches Switches

/etc/nagios/servicegroups
All the services executions on each hosts are done in this folder

  • /etc/nagios/servicegroups/api-apache API Apache
  • /etc/nagios/servicegroups/api-mysql API MySQL
  • /etc/nagios/servicegroups/messaging-java Messaging Java
  • /etc/nagios/servicegroups/messaging-xmlblaster Messaging xmlBlaster
  • /etc/nagios/servicegroups/network-cisco Network Routers - Cisco
  • /etc/nagios/servicegroups/network-netopia Network Routers - Netopia
  • /etc/nagios/servicegroups/network-switches Network Switches
  • /etc/nagios/servicegroups/network-uptime Network Devices Uptime
  • /etc/nagios/servicegroups/server Linux Servers
  • /etc/nagios/servicegroups/terminal Mac Terminals