Nagios: Difference between revisions

From Network Security Wiki
Content added Content deleted
No edit summary
Line 21: Line 21:
use generic-host ; Inherit default values from a template
use generic-host ; Inherit default values from a template
host_name PROD_aman-client1 ; The name we're giving to this host
host_name PROD_aman-client1 ; The name we're giving to this host
alias PROD_DO_NOT_TOUCH_aman-client1 ; A longer name associated with the host
alias XYZ_aman-client1 ; A longer name associated with the host
address 10.10.30.81 ; IP address of the host
address 10.10.30.81 ; IP address of the host
#hostgroups allhosts ; Host groups this host is associated with
#hostgroups allhosts ; Host groups this host is associated with
}
}
</pre>
</pre>

Revision as of 19:22, 16 October 2018

Installation

Update System:

sudo apt update -y
sudo apt upgrade -y

Install Dependencies:

sudo apt install php php-cgi libapache2-mod-php php-common php-pear php-mbstring apache2

Install Nagios3:

sudo apt install nagios3 nagios-plugins-basic

Edit Config:

sudo nano /etc/nagios3/nagios.cfg
check_external_commands=1

Adding a Host

sudo nano aman-client1.cfg
define host {
    use         generic-host        ; Inherit default values from a template
    host_name   PROD_aman-client1   ; The name we're giving to this host
    alias       XYZ_aman-client1    ; A longer name associated with the host
    address     10.10.30.81         ; IP address of the host
    #hostgroups  allhosts           ; Host groups this host is associated with
}
sudo service nagios3 restart

Monitoring python process

sudo nano /etc/nagios3/commands.cfg
#################
# Check_Python
#################

define command{
    command_name check_python
    command_line /usr/lib/nagios/plugins/check_procs -c 1: -C '$ARG1$' -a '$ARG2$'
}


sudo nano /etc/nagios3/conf.d/aman-client1.cfg
## Check Watchdog Script

define service {
    use                 generic-service     ; Inherit default values from a template
    host_name           localhost
    service_description Watchdog Script
    check_command       check_python!python3!watchdog.py
}

Monitor HTTP Site

sudo nano /etc/nagios3/conf.d/aman-client1.cfg
## Check Mediawiki Site

define service {
    use                 generic-service     ; Inherit default values from a template
    host_name           localhost
    service_description MediaWiki Server
    check_command       check_http!-H localhost!-u /aviwiki/index.php/Main_Page
}