Page 1 of 1

Send dynamic parameter to NRPE command

Posted: Wed Apr 07, 2021 7:18 am
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)

Re: Send dynamic parameter to NRPE command

Posted: Wed Apr 07, 2021 11:44 am
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

Re: Send dynamic parameter to NRPE command

Posted: Fri Apr 09, 2021 2:28 am
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.