nrpeicinga2

Can someone please tell me how to define a check_disk service with check_nrpe in icinga 2?


I'm trying to check disk status of client ubuntu 16.04 instance using icinga2 master server. In here I tried to use nrpe plugin for check disk status. I faced trouble When I'm going to define service in service.conf file. Please, can someone tell me what the correct files that should be changed when using nrpe are. Because I'm new to Icinga and nrpe.


Solution

  • I was able to find the solution to my problem. I hope to put it here because It may help someone's need. Here I carried check_load example to the explain. First of all, you need to create .conf file (name: 192.168.30.40-host.conf)regarding the client-server that you are going to monitor using icinga2. It should be placed on /etc/icinga2/conf.d/ folder

    /etc/icinga2/conf.d/192.168.30.40-host.conf

    object Host "host1" {
    import "generic-host"
    display_name    =  "host1"
    address  =  "192.168.30.40"
    }
    
    1. you should create a service file for your client.

    /etc/icinga2/conf.d/192.168.30.40-service.conf

    object Service "LOAD AVERAGE" {
    import "generic-service"
    host_name = "host1"
    check_command = "nrpe"
    vars.nrpe_command = "check_load"
    }
    
    1. This is an important part of the problem. You should add this line to your nrpe.cfg file in Nagios server. /etc/nagios/nrpe.cfg file

      command[check_load]=/usr/lib64/nagios/plugins/check_load -w 15,10,5 -c 20,15,10

    4.make sure to restart icinga2 and Nagios servers after making any change.