Page 1 of 1

NRPE analogue for NCPA

Posted: Mon Aug 02, 2021 10:00 am
by rootintootin
Is there a direct analogue to NRPE's host-defined

Code: Select all

command[COMMAND_NAME]=
setup in NCPA?

I'm really digging NCPA so far, especially for managing my Windows systems, but something that was really handy in NRPE is defining a somewhat generic service then modifying what specific command that service definition used on the actual NRPE client. So I have NRPE configs based on host-OS that get deployed but never really have to touch my Nagios definitions.

NRPE Example:
Monitoring updates on hosts. Using the same "check_updates" command via NRPE executes a different script depending on RedHat-based vs Debian-based. This is despite the fact that Nagios thinks it's the exact same service/command being executed.

Code: Select all

define service {

    use                     delay-notification-service
    hostgroup_name          linux-servers
    service_description     Updates Available on Server
    check_command           check_nrpe_updates
    servicegroups           Updates

}

define command {

    command_name    check_nrpe_updates
    command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c "check_updates"

}
NCPA example:
I'm currently only using NCPA on my windows servers in my environment. For Windows below is an example of what specifically triggered this concern. Essentially NCPA registers the network metric as two different Ethernet devices (Ethernet vs Ethernet0) depending on virtualized Windows vs bare-metal Windows. This is one small example and I circumvented it by using the same service definition with two different versions (Ethernet and Ethernet0) but excluded from the machines that aren't relevant.

Code: Select all

# TODO: How can we define what interface to check depending on the NCPA host checked?
#   Win10 hosts may use Ethernet or Wireless, Windows Server uses Ethernet0
#   Need something more like NRPE's command definitions file for NCPA
define service {

    use                     ncpa-service
    service_description     Network Bandwidth Usage -- Ethernet
    host_name               !metecs-saveeam, !metecs-wkstn19
    check_command           check_ncpa!-t 'geBpBH2txclJKk8MFTer' -P 5693 --delta -M 'interface/Ethernet0'

}

define service {

    use                     ncpa-service
    service_description     Network Bandwidth Usage -- Ethernet
    host_name               metecs-saveeam, metecs-wkstn19, !metecs-ad1, !metecs-ad2, !metecs-qb2, !metecs-veeam
    check_command           check_ncpa!-t 'geBpBH2txclJKk8MFTer' -P 5693 --delta -M 'interface/Ethernet'

}

Re: NRPE analogue for NCPA

Posted: Mon Aug 02, 2021 11:07 am
by mcapra
Generally speaking, the plugins endpoint is your answer to the question of "how do I run custom scripts/commands with NCPA":
https://www.nagios.org/ncpa/help.php#ap ... es-plugins