I used to have this format for passing parameters to my NCPA plugins that worked fine: -a '<arg1> <arg2>'. This worked fine in 1.8.1.
With ncpa 2.1.6 it does not work.
-bash-4.1$ /usr/local/nagios/libexec/check_ncpa.py -H shlgnwsad011.tvlport.net -t wspwebfarm -M api/plugins/check_File_Recent.sh -a'/tmp/test 5'
find: missing argument to `-mmin'
Ok. File was not recently created
If I rework the way i pass the arguments then it works fine.
-bash-4.1$ /usr/local/nagios/libexec/check_ncpa.py -H shlgnwsad011.tvlport.net -t wspwebfarm -M api/plugins/check_File_Recent.sh -q 'args="/tmp/test",args=5'
Ok. File was not recently created
-bash-4.1$
I don't think this was documented.
Passing parameters to NCPA plugin in 2.1.6
Re: Passing parameters to NCPA plugin in 2.1.6
I can circumvent the problem by adding double quotes around the argument that specifies the path. Looks like treatment of the forward slashes changed in 2.1.6
-
npolovenko
- Support Tech
- Posts: 3457
- Joined: Mon May 15, 2017 5:00 pm
Re: Passing parameters to NCPA plugin in 2.1.6
Hello, @corkyman. Both options seem to be working for me. Can you upload your plugin so I can test it out in the lab?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Passing parameters to NCPA plugin in 2.1.6
It seems that the problem occurs for arguments containing file paths. Have you tried that? I'll upload the plugin.
Re: Passing parameters to NCPA plugin in 2.1.6
check_File_Recent.sh
---------------------------------
#!/bin/bash
# Tests file age to check if it was recently updated
# Input args:
# file_path - file name including the path
# age - file age in minutes to check against
# Output:
# Ctritical alert if file is younger than <age> minutes
file_path=$1
age=$2
if test `find "$1" -mmin -$2`
then
retCode=1
echo "Warning. File was recently created"
else
retCode=0
echo "Ok. File was not recently created"
fi
exit $retCode
---------------------------------
#!/bin/bash
# Tests file age to check if it was recently updated
# Input args:
# file_path - file name including the path
# age - file age in minutes to check against
# Output:
# Ctritical alert if file is younger than <age> minutes
file_path=$1
age=$2
if test `find "$1" -mmin -$2`
then
retCode=1
echo "Warning. File was recently created"
else
retCode=0
echo "Ok. File was not recently created"
fi
exit $retCode
Re: Passing parameters to NCPA plugin in 2.1.6
plugin is uploaded as an attachment
You do not have the required permissions to view the files attached to this post.
-
npolovenko
- Support Tech
- Posts: 3457
- Joined: Mon May 15, 2017 5:00 pm
Re: Passing parameters to NCPA plugin in 2.1.6
@corkyman, I see. Seems like the NCPA does expect arguments in a format you specified.
I will submit an internal request to update syntax in our documentation.
You do not have the required permissions to view the files attached to this post.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.