Hello,
I am using Nagios XI and I am monitoring a Windows Host with NCPA client.
I have developed a python script which give me if a licence of one of the software installed on this windows machine is up to date or not.
My script is named "check_opc.py" and it takes 3 arguments -s $ARG1$ -n $ARG2$ and -v $ARG3$
On my windows machine, using PowerShell when I execute this plugin like that :
C:\Program Files\Nagios\NCPA\plugins> python .\check_opc.py -s opc.tcp://127.0.0.1:49320 -n "ns=2;s=_System._LicensedFeatures" -v "['Allen-Bradley ControlLogix Ethernet']"
This is the output that I get (it is correct)
Unable to read ['Allen-Bradley ControlLogix Ethernet'] in node ns=2;s=_System._LicensedFeatures from opc.tcp://127.0.0.1:49320
I want to see this output on my Nagios Server GUI
I Have my custom plugin in the NCPA plugins directory of the client(windows). However, I can't run the pluging remotely from Nagios. Here is the command that I am using
root@ubuntu:/usr/local/nagios/libexec# ./check_ncpa.py -H ServerAddressNCPA -t mytoken -P 5693 -M 'plugins/check_opc.py' -a '-s opc.tcp://127.0.0.1:49320 -n "ns=2;s=_System._LicensedFeatures" -v "['Allen-Bradley ControlLogix Ethernet']"'
but I got this error:
UNKNOWN: Error occurred while running the plugin. Use the verbose flag for more details.
I have tried so many ways to write the command in different ways, but nothing seems to be resolving the problem. ANY HELP !!!!!!!!!
Thank you
CUSTOM_PLUGIN
-
benjaminsmith
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: CUSTOM_PLUGIN
Hi,
I would check the NCPA log on the Windows host for more information. If there are any errors, please post them to the thread for us to review.
See: https://www.nagios.org/ncpa/help/2.0/configuration.html
Also, try to change the plugin path in the ncpa.cfg as maybe it's not executing correctly. Remember to restart the NCPA service after making any changes.
https://github.com/NagiosEnterprises/ncpa/issues/478
I would check the NCPA log on the Windows host for more information. If there are any errors, please post them to the thread for us to review.
See: https://www.nagios.org/ncpa/help/2.0/configuration.html
Also, try to change the plugin path in the ncpa.cfg as maybe it's not executing correctly. Remember to restart the NCPA service after making any changes.
Code: Select all
.py = C:\Python27\python.exe $plugin_name $plugin_argsAs of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: CUSTOM_PLUGIN
Hi,
I have successed to execute my pluging locally from the NCPA Client API as you can see
But when I try to execute it from Nagios to check the result, I proceed as follow:
An this is the error I receive, It is an error in the execution of the script:
How it can be possible for the script to be executed from the client and not from the Nagios Server, I think that it's just like he is not detecting my first argument. ANY IDEAS for this problem ?
Thanks,
I have successed to execute my pluging locally from the NCPA Client API as you can see
But when I try to execute it from Nagios to check the result, I proceed as follow:
An this is the error I receive, It is an error in the execution of the script:
How it can be possible for the script to be executed from the client and not from the Nagios Server, I think that it's just like he is not detecting my first argument. ANY IDEAS for this problem ?
Thanks,
You do not have the required permissions to view the files attached to this post.
-
benjaminsmith
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: CUSTOM_PLUGIN
Hi,
It's calling the plugin so that's good, but it's not able to read the arguments. Try wrapping arguments 2-4 in single quotes, and let me know if that resolves the issue. For example:
It's calling the plugin so that's good, but it's not able to read the arguments. Try wrapping arguments 2-4 in single quotes, and let me know if that resolves the issue. For example:
Code: Select all
-s 'opc.tcp://127.0.0.1:49320'
-n 'ns=2;s=_System._LicensedFeatures'
-v '["Allen-Bradley ControlLogix Ethernet"]'
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: CUSTOM_PLUGIN
Hi,
I resolved the issue. Thank you so much for your help.
The issue was resolved as follow, I stoped trying to run the command from the Nagios Server CLI. Instead i tried to delete my host completly from my Nagios, and try to add it again. But this is what I have done in the configuration Wizzard
As you can see in the argument textfield this is what I did. I have deleted all the quotes :
-s opc.tcp://127.0.0.1:49320 -n ns=2;s=_System._LicensedFeatures -v [Allen-Bradley ControlLogix Ethernet]
And finally the plugin seems to be working very well:
Thank you !
I resolved the issue. Thank you so much for your help.
The issue was resolved as follow, I stoped trying to run the command from the Nagios Server CLI. Instead i tried to delete my host completly from my Nagios, and try to add it again. But this is what I have done in the configuration Wizzard
As you can see in the argument textfield this is what I did. I have deleted all the quotes :
-s opc.tcp://127.0.0.1:49320 -n ns=2;s=_System._LicensedFeatures -v [Allen-Bradley ControlLogix Ethernet]
And finally the plugin seems to be working very well:
Thank you !
You do not have the required permissions to view the files attached to this post.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: CUSTOM_PLUGIN
Glad you were able to resolve the issue and thanks for sharing your results!yybadrou wrote:Hi,
I resolved the issue. Thank you so much for your help.
The issue was resolved as follow, I stoped trying to run the command from the Nagios Server CLI. Instead i tried to delete my host completly from my Nagios, and try to add it again. But this is what I have done in the configuration Wizzard
As you can see in the argument textfield this is what I did. I have deleted all the quotes :
-s opc.tcp://127.0.0.1:49320 -n ns=2;s=_System._LicensedFeatures -v [Allen-Bradley ControlLogix Ethernet]
And finally the plugin seems to be working very well:
Thank you !
Locking thread