Custom configuration for the remote linux server

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
informatica
Posts: 99
Joined: Thu Jan 28, 2021 9:55 pm

Custom configuration for the remote linux server

Post by informatica »

Hi Team,

Do we have option from nagiosxi that can we bring the data for custom configuration which are done in client side??
check_custom is defined in client side, we need for which server custom commands are defined.
All the custom configuration which are done in client we need full the details from nagios server.

For Ex:command[check_custom]=/usr/local/nagios/libexec/check_custom.sh
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Custom configuration for the remote linux server

Post by ssax »

That functionality doesn't exist.

You could setup another service and write a plugin that would grep/output them, you can use this for example (feel free to modify it as needed):

Code: Select all

#!/bin/bash
DEFINEDCOMMANDS=$(grep '^command\[' /usr/local/nagios/etc/nrpe.cfg /usr/local/nagios/etc/nrpe/*.cfg)
COMMANDCOUNT=$(echo "$DEFINEDCOMMANDS" | wc -l)
echo "OK - Total commands ($COMMANDCOUNT) | total_commands=$COMMANDCOUNT"
echo "$DEFINEDCOMMANDS"
exit 0
informatica
Posts: 99
Joined: Thu Jan 28, 2021 9:55 pm

Re: Custom configuration for the remote linux server

Post by informatica »

thanks for that,
we need only commands which are defined in nrpe.cfg.
also couple of commands might be commented, we should exclude commented one and
we should exclude default commands which are in nrpe.cfg. Could you please help with this?
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Custom configuration for the remote linux server

Post by ssax »

It already excludes commented ones.

Since there are no default ones in the nrpe.cfg you can just use this:

Code: Select all

#!/bin/bash
DEFINEDCOMMANDS=$(grep '^command\[' /usr/local/nagios/etc/nrpe.cfg)
COMMANDCOUNT=$(echo "$DEFINEDCOMMANDS" | wc -l)
echo "OK - Total commands ($COMMANDCOUNT) | total_commands=$COMMANDCOUNT"
echo "$DEFINEDCOMMANDS"
exit 0
If you would like additional functionality you will need to make the changes as we do not have the time to do it in support. I just whipped up that script to help you get started as an example.
Locked