NRPE SSL error: unrecognised option '$'

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
DennisLans
Posts: 3
Joined: Thu Apr 12, 2018 8:14 am

NRPE SSL error: unrecognised option '$'

Post by DennisLans »

Hello!

NRPE version: 3.2.1
NSClient++ version: 0.5.2035

I've implemented SSL with NRPE for secure communications between the Nagios server and the monitored clients. The certificates have been placed on the target host and the nsclient.ini has been altered to allow for SSL communcation. In the logging from Centos I can see the following warning whenever a check is ran (note that without variables the check runs fine, even with the below warning. Perhaps SSL is not yet properly configured, but that might not even be related to the question below):

Code: Select all

Apr 12 15:20:49 <<server>> check_nrpe: Remote <<ip address> does not support Version 3 Packets
The code below successfully returns the current CPU values as expected:

Code: Select all

./check_nrpe -H <<ip address>> -f /usr/local/nagios/etc/ssl/ssl_option.conf -c check_cpu -a "warn=load gt 85" "crit=load gt 95"
But when I start working with variables I start to run into errors:

Code: Select all

./check_nrpe -H <<ip address>> -f /usr/local/nagios/etc/ssl/ssl_option.conf -c check_cpu -a $_HOST_CPU_THRESHOLDS$

Restuls in: Invalid command line: unrecognised option '$HOST_CPU_THRESHOLDS$'
I've added the variables in a host template which is is attached to a host group. The servers I want to monitor are a member of the hostgroup and should receive the inherrited variables. Nagios Netherlands has sent over a consultant to my previous employer and explained that this was the way to go with default "group" checks.

This is the variable added to the template

Code: Select all

__cpu_thresholds	"warn=load gt 80" "crit=load gt 90"

The problem is that I do not have all the documentation from my old employer nor do I have access to the system to peak. I'm doing it all from memory. Does anyone have any idea where I should begin to look?

Kind regards,
Dennis Lans
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NRPE SSL error: unrecognised option '$'

Post by scottwilkerson »

This actually all looks ok, but using these types of MACROS are not going to be available from the command line, and only work when the command is actually built and executed through Nagios.

So to test it you would need to do the substitution your self and run

Code: Select all

./check_nrpe -H <<ip address>> -f /usr/local/nagios/etc/ssl/ssl_option.conf -c check_cpu -a "warn=load gt 80" "crit=load gt 90"
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
DennisLans
Posts: 3
Joined: Thu Apr 12, 2018 8:14 am

Re: NRPE SSL error: unrecognised option '$'

Post by DennisLans »

Hi Scott,

How can I build this command into Nagios?

The reason why I wish to use these macros is to allow for easy and quick deployments. I have all the base values for our monitoring linked to the template (which is linked to our host group). We have a single service check linked to the host group, so all (Windows) based machines automatically get the correct checks. The best thing about this is that I don't have to manually check each server for their respective disks, as they are added automatically or ignored if not present. This way we also have a very clean and small list of service checks.

Kind regards,
Dennis Lans
DennisLans
Posts: 3
Joined: Thu Apr 12, 2018 8:14 am

Re: NRPE SSL error: unrecognised option '$'

Post by DennisLans »

Here is a screenshot of how it is configured at the place where I used to work:

Image

We managed to use the macro successfully.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NRPE SSL error: unrecognised option '$'

Post by scottwilkerson »

you would want to use it just like your image above, or in the command definition, however you will never be able to access $_HOST_CPU_THRESHOLDS$ directly form the command line because it is only a variable IN Nagios, and not available in the shell....

Before Nagios executes a command it looks up what the value of $_HOST_CPU_THRESHOLDS$ is and replaces it and would actually execute

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H <<ip address>> -f /usr/local/nagios/etc/ssl/ssl_option.conf -c check_cpu -a "warn=load gt 80" "crit=load gt 90"
This is the same as it looking up the value if $ARG1$ and replacing it with check_cpu
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked