Passing parameter containing / to NCPA plugin
Posted: Wed Mar 20, 2019 11:18 am
I have upgraded some of my NCPA agents to 2.1.6 from 1.8.1 and there is a difference in how parameters are passed to plugins when parameters contain '/.'. Please see below:
1.8.1:
[c601018@vhlgnngxi001 ~]$ /usr/local/nagios/libexec/check_ncpa.py -H sclpnekbb001.tvlport.net -t wspwebfarm -M agent/plugin/check_status_cassandra.sh -a "/apps02/tpworkdir/status.log Cassandra_Cluster_Status"
OK: RTDP Cassandra_Cluster_Status is Up
2.1.6:
[c601018@vhlgnngxi001 ~]$ /usr/local/nagios/libexec/check_ncpa.py -H sclppekbb003.tvlport.net -t wspwebfarm -M api/plugins/check_status_cassandra.sh -a "/apps02/tpworkdir/status.log Cassandra_Cluster_Status" WARNING: RTDP apps02 not found
To fix it I had to put the argument containing / in single quotes:
[c601018@vhlgnngxi001 ~]$ /usr/local/nagios/libexec/check_ncpa.py -H sclppekbb003.tvlport.net -t wspwebfarm -M api/plugins/check_status_cassandra.sh -a "'/apps02/tpworkdir/status.log' Cassandra_Cluster_Status"
OK: RTDP Cassandra_Cluster_Status is Up
Unfortunately, I cannot make this change beforehand to my service checks because after putting single quotes around arguments in 1.8.1 does not work:
[c601018@vhlgnngxi001 ~]$ /usr/local/nagios/libexec/check_ncpa.py -H sclpnekbb001.tvlport.net -t wspwebfarm -M agent/plugin/check_status_cassandra.sh -a "'/apps02/tpworkdir/status.log' Cassandra_Cluster_Status"
WARNING: RTDP '/apps02/tpworkdir/status.log' not found
So I have to make the change right after I upgrade the agent. Given the number of agents that are being upgraded at the same time (hundreds) it is a very time consuming task to update service checks as well at the time the change is scheduled.
1.8.1:
[c601018@vhlgnngxi001 ~]$ /usr/local/nagios/libexec/check_ncpa.py -H sclpnekbb001.tvlport.net -t wspwebfarm -M agent/plugin/check_status_cassandra.sh -a "/apps02/tpworkdir/status.log Cassandra_Cluster_Status"
OK: RTDP Cassandra_Cluster_Status is Up
2.1.6:
[c601018@vhlgnngxi001 ~]$ /usr/local/nagios/libexec/check_ncpa.py -H sclppekbb003.tvlport.net -t wspwebfarm -M api/plugins/check_status_cassandra.sh -a "/apps02/tpworkdir/status.log Cassandra_Cluster_Status" WARNING: RTDP apps02 not found
To fix it I had to put the argument containing / in single quotes:
[c601018@vhlgnngxi001 ~]$ /usr/local/nagios/libexec/check_ncpa.py -H sclppekbb003.tvlport.net -t wspwebfarm -M api/plugins/check_status_cassandra.sh -a "'/apps02/tpworkdir/status.log' Cassandra_Cluster_Status"
OK: RTDP Cassandra_Cluster_Status is Up
Unfortunately, I cannot make this change beforehand to my service checks because after putting single quotes around arguments in 1.8.1 does not work:
[c601018@vhlgnngxi001 ~]$ /usr/local/nagios/libexec/check_ncpa.py -H sclpnekbb001.tvlport.net -t wspwebfarm -M agent/plugin/check_status_cassandra.sh -a "'/apps02/tpworkdir/status.log' Cassandra_Cluster_Status"
WARNING: RTDP '/apps02/tpworkdir/status.log' not found
So I have to make the change right after I upgrade the agent. Given the number of agents that are being upgraded at the same time (hundreds) it is a very time consuming task to update service checks as well at the time the change is scheduled.