Nagios Hosts configuration

From Bashlinux
Revision as of 21:47, 8 June 2015 by Manpaz (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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