Pegasi Wiki

This wiki acts as a memo for our own work so why not share them? Feel free to browse and use out notes and leave a note while at it.

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

nagios_on_centos [2012/04/11 18:24]
Pekka Kuronen
nagios_on_centos [2017/11/06 10:11]
Line 1: Line 1:
-== Nagios installation on CentOS 6.2 == 
  
-==== Nagios server ==== 
- 
-  * disable selinux 
-  * install packages and enable users 
-<​code>​ 
-rpm -Uvh http://​packages.sw.be/​rpmforge-release/​rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm 
-yum -y install httpd php gd mod_ssl nagios* 
-htpasswd -c /​etc/​nagios/​htpasswd.users nagiosadmin 
-</​code>​ 
-  * check that you have nagiosadmin user in /​etc/​nagios/​cgi.cfg 
-  * edit /​etc/​nagios/​objects/​contacts.cfg to include your data, at least your email 
-<​code>​ 
-service nagios restart 
-service httpd restart 
-</​code>​ 
-  * test /nagios URL in your server 
- 
- 
-==== Nagiosgraph ==== 
- 
-  * fetch nagiosgraph rpm from http://​sourceforge.net/​projects/​nagiosgraph/​files/​nagiosgraph/​ 
-  * in shell 
-<​code>​ 
-service nagios start 
-service httpd start 
-</​code>​ 
-  * test with your browser addresses 
-<​code>​ 
-https://​server/​nagiosgraph/​cgi-bin/​showconfig.cgi 
-https://​server/​nagiosgraph/​cgi-bin/​show.cgi 
-</​code>​ 
-  * edit file /​etc/​nagios/​objects/​templates.cfg and add to the end of file 
-<​code>​ 
-define service { 
-       name graphed-service 
-       ​action_url /​nagiosgraph/​cgi-bin/​show.cgi?​host=$HOSTNAME$&​service=$SERVICEDESC$'​ onMouseOver='​showGraphPopup(this)'​ onMouseOut= 
-'​hideGraphPopup()'​ rel='/​nagiosgraph/​cgi-bin/​showgraph.cgi?​host=$HOSTNAME$&​service=$SERVICEDESC$&​period=week&​rrdopts=-w+450+-j 
-       ​register 0 
-       } 
-</​code>​ 
-  * Add graphed functionality to your server object definition file /​etc/​nagios/​objects/​host.cfg 
-<​code>​ 
-define service{ 
-        use                             ​local-service,​graphed-service 
-        host_name ​                      ​localhost 
-        service_description ​            PING 
-        check_command ​                  ​check_ping!100.0,​20%!500.0,​60% 
-        } 
-</​code>​ 
-  * restart nagios and wait a few minutes 
- 
- 
-==== Nagios NRPE client installation ==== 
- 
-NRPE client enables Nagios to query and use plugins remotely from Linux and Windows servers. This one is about Linux client. 
- 
-  * install software with yum 
-<​code>​ 
-yum install nagios-nrpe nagios-plugins nagios-plugins-nrpe 
-</​code>​ 
-  * use nrpe daemon or xinetd, this one uses daemonized nrpe 
-<​code>​ 
-vi /​etc/​nagios/​nrpe.cfg 
-</​code>​ 
-  * fix allowed_hosts according to your environment 
-  * fix the check commands according to your environment (w = warning, c = critical limit) 
-<​code>​ 
-command[check_users]=/​usr/​lib64/​nagios/​plugins/​check_users -w 5 -c 10 
-command[check_load]=/​usr/​lib64/​nagios/​plugins/​check_load -w 10,7,4 -c 20,15,10 
-#​command[check_load]=/​usr/​lib64/​nagios/​plugins/​check_load -w 15,10,5 -c 30,25,20 
-command[check_rootv]=/​usr/​lib64/​nagios/​plugins/​check_disk -w 10% -c 5% -p /​dev/​mapper/​vg_myserver-rootv 
-command[check_zombie_procs]=/​usr/​lib64/​nagios/​plugins/​check_procs -w 5 -c 10 -s Z 
-command[check_total_procs]=/​usr/​lib64/​nagios/​plugins/​check_procs -w 350 -c 400 
-</​code>​ 
-  * if you wish you can describe the service to /​etc/​services,​ needed if xinetd is used 
-<​code>​nrpe ​           5666/​tcp ​                       # Nagios NRPE</​code>​ 
-  * make iptables allow rules if necessary 
-<​code>​ 
-iptables -I INPUT -p TCP --dport 5666 -s nagios-server-ip 
-service iptables save 
-</​code>​ 
-  * start nrpe daemon 
-<​code>​service nrpe start</​code>​ 
-  * do testing in client 
-<​code>/​usr/​lib64/​nagios/​plugins/​check_nrpe -H localhost</​code>​ 
-<​code>/​usr/​lib64/​nagios/​plugins/​check_nrpe -H localhost -c check_users</​code>​ 
-  * do testing in nagios server 
-/​usr/​lib64/​nagios/​plugins/​check_nrpe -H client-ip 
-  * edit file /​etc/​nagios/​objects/​commands.cfg 
-<​code>​ 
-define command{ 
-        command_name check_nrpe 
-        command_line $USER1$/​check_nrpe -H $HOSTADDRESS$ -c $ARG1$ 
-} 
-</​code>​ 
-  * add the host to nagios server 
-<​code>​vi /​etc/​nagios/​objects/​host.cfg</​code>​ 
-  * example data for /​etc/​nagios/​objects/​host.cfg 
-<​code>​ 
-define host{ 
-        use                     ​linux-server 
-        host_name ​              ​myhost 
-        alias                   My Virtual server 
-        address ​                ​192.168.1.2 
-        } 
-define service{ 
-        use                             ​local-service,​graphed-service 
-        host_name ​                      ​myhost 
-        service_description ​            PING 
-        check_command ​                  ​check_ping!100.0,​20%!500.0,​60% 
-        } 
- 
-define service{ 
-        use                             ​local-service,​graphed-service 
-        host_name ​                      ​myhost 
-        service_description ​            Root Partition 
-        check_command ​                  ​check_nrpe!check_rootv 
-        } 
-</​code>​ 

  //check if we are running within the DokuWiki environment if (!defined("DOKU_INC")){ die(); } //place the needed HTML source codes BELOW this line