Page 1 of 1

Is alerting IF older versions of NCPA detected

Posted: Tue Apr 16, 2019 9:54 am
by Keystone
We are going through the upgrade from 2.1.1 to 2.1.6 on thousands of boxes and I would like a way to alert if by chance a box is missed or if an older version gets installed on a new box.

I see here:
https://www.nagios.org/ncpa/help.php#ap ... parameters
That it states:
You cannot use any special parameters on this module. This module is just for getting system information.
I need to verify that if we want this type of check/alerting if an older NCPA version is detected, we would be REQUIRED to create a custom script.

Re: Is alerting IF older versions of NCPA detected

Posted: Tue Apr 16, 2019 11:23 am
by lmiltchev
Unfortunately, you are correct. You cannot pass a parameter to check the version number and set an alert. You would have to use a custom script. This is an example of a simple bash script that you could use.

Code: Select all

#!/bin/bash

ncpa_version=`/usr/local/nagios/libexec/check_ncpa.py -H $1 -t $2 -P 5693 -M system/agent_version | cut -d ' ' -f4 | tr -d "'[]'"`
echo $ncpa_version
if [ $ncpa_version != "2.1.6" ]; then
        echo "CRITICAL: NCPA agent was not updated!"
        exit 2
else
        echo "OK: NCPA agen is up to date."
        exit 0
fi
You can run it from the CLI as such:

Code: Select all

./check_ncpa_version.sh <client ip> <token>
It is not "ideal" but it could probably get you started.

Re: Is alerting IF older versions of NCPA detected

Posted: Tue Apr 16, 2019 5:36 pm
by Keystone
Thank you for the fast response.

Re: Is alerting IF older versions of NCPA detected

Posted: Wed Apr 17, 2019 9:13 am
by lmiltchev
You are welcome! I am closing this topic now. If you have any further questions, please start a new thread. Thank you!