Send dynamic parameter to NRPE command

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
codrinh
Posts: 2
Joined: Tue Oct 20, 2020 5:27 am

Send dynamic parameter to NRPE command

Post by codrinh »

Hello all,

Please advise if the below scenario is possible, currently I'm looking at the documentation and I could not find an example for this.


Nagios server is sending a 'dynamic value' in the pipe to the nrpe agent, but the value is not hard-coded in the .cfg files (checks type - active, every minute)

service.cfg

Code: Select all

check_command           check_nrpe!custom_check!!!!!!!
nrpe receives (e.g:) :

Code: Select all

custom_check(String dynamic_value)
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Send dynamic parameter to NRPE command

Post by mcapra »

What is the source of truth for the dynamic value?

Nagios Core offers some "standard" and "custom" macros you can use in your object definitions, but they may not be a good fit for your use case:
https://assets.nagios.com/downloads/nag ... olist.html
https://assets.nagios.com/downloads/nag ... acros.html
Former Nagios employee
https://www.mcapra.com/
codrinh
Posts: 2
Joined: Tue Oct 20, 2020 5:27 am

Re: Send dynamic parameter to NRPE command

Post by codrinh »

Thank you for the reply Matt.
I was looking into the macros and this is the approach that we will have to use.

I have another question regarding the Nagios plugins

From the Nagios Core Plugin API
Plugins may also return optional performance data that can be processed by external applications.

I would like to perform the following flow:
  • deploy the NRPE agent
    add custom script & custom command in NRPE
    Nagios server will trigger the check_nrpe!custom_command
    custom_command returns `exit_code|exit_message|performance_data`
    capture the `performance_data` at server side ( no mater of the status code )
Is this doable with event handlers ? If not, is there a way to achieve this ?

Regards.
Locked