Difference between revisions of "Nagios"

From Wasya Wiki
Jump to: navigation, search
(Nagios Config)
(Nagios Config)
Line 10: Line 10:
 
* make sure IPs are allowed for communicatin
 
* make sure IPs are allowed for communicatin
 
* make sure ports are allowed for communication
 
* make sure ports are allowed for communication
* client: put the custom plugin in /usr/lib/nagios/plugins/echo_ok3
+
* # client: put the custom plugin in /usr/lib/nagios/plugins/echo_ok3 ## optional, trash
 
* client: in /etc/nagios/nrpe.cfg:
 
* client: in /etc/nagios/nrpe.cfg:
  allowed_hosts <should include the server ip>
+
** allowed_hosts <should include the server ip>
  command[echo_ok3]=/usr/lib/nagios/plugins/echo_ok3
+
**  command[echo_ok3]=/usr/lib/nagios/plugins/echo_ok3
 
* client: restart service
 
* client: restart service
  # /usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -d ## use next oneliner
+
**  # /usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -d ## use next oneliner
  sudo kill -9 `ps aux | grep nr | grep -v color | awk '{print $2}'` ; /usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -d  
+
**  sudo kill -9 `ps aux | grep nr | grep -v color | awk '{print $2}'` ; /usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -d  
 
* server:  
 
* server:  
 
  define command {
 
  define command {

Revision as of 16:45, 22 May 2017

Client Important Files

/etc/nagios/nrpe.cfg           <- allowed_hosts of server goes here
/usr/lib/nagios/plugins 	<- specific checks go here

Server Important Files

/usr/lib/nagios/plugins		<- nothing important here, actually
/etc/nagios3/config.d                  <- everything goes here

Nagios Config

  • make sure IPs are allowed for communicatin
  • make sure ports are allowed for communication
  • # client: put the custom plugin in /usr/lib/nagios/plugins/echo_ok3 ## optional, trash
  • client: in /etc/nagios/nrpe.cfg:
    • allowed_hosts <should include the server ip>
    • command[echo_ok3]=/usr/lib/nagios/plugins/echo_ok3
  • client: restart service
    • # /usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -d ## use next oneliner
    • sudo kill -9 `ps aux | grep nr | grep -v color | awk '{print $2}'` ; /usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -d
  • server:
define command {
  command_name echo-ok3
  command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c echo_ok3
}
define service {
  service_description echo-ok3
  hostgroup_name microsites3_api
  check_command echo-ok3
  use default-service
}

Nagios Utils

Setup Client

apt-get install -y nagios-plugins nagios-nrpe-server

Change password

htpasswd -c -b  /etc/nagios/htpasswd.users nagiosadmin admin

Nagios Custom Plugin

CHECK_NRPE: Error – Could not complete SSL handshake

From: https://geekpeek.net/could-not-complete-ssl-handshake/