Perl script integrating to NSclient++

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Perl script integrating to NSclient++

Postby bosco » Fri Apr 21, 2017 4:00 am

Perl script integrating to NSclient++

Hi i have a Perl script for checking the date in a .ini file and service status and if not running will throw critical alert. i would like to know how to integrate that script in nsclient++.cfg file as i am first time using perl script and i know its similar to the pwershell integration,can you share from below which is the right method for intgrating this in nsclient++.cfg file

[/settings/external scripts/wrappings]
; Perl scripts
pl = "C:\\\\strawberry\\\\perl\\\\bin\\\\perl.exe" scripts\\\\%SCRIPT% %ARGS%


[External Scripts]
[...]
check_oracle_cman=perl scripts\check_oracle_cman.pl --mode="$ARG1$" --environment="C:\oracle\client11g"
bosco
 
Posts: 14
Joined: Thu Nov 24, 2016 5:34 am

Re: Perl script integrating to NSclient++

Postby mcapra » Fri Apr 21, 2017 1:10 pm

The biggest obstacle is getting Perl to run correctly in the Windows environment. Does perl resolve correctly? What's the output from command prompt when you type:
Code: Select all
perl -v


It seems like you have set up a wrapper for .pl files:
Code: Select all
[/settings/external scripts/wrappings]
; Perl scripts
pl = "C:\\\\strawberry\\\\perl\\\\bin\\\\perl.exe" scripts\\\\%SCRIPT% %ARGS%


But aren't defining your perl script as a "wrapped script". In order for the wrapping to apply, you will need to define your external script under the "wrapped scripts" section like so:

Code: Select all
# A list of wrapped scripts (ie. script using a template mechanism).
[/settings/external scripts/wrapped scripts]


Refer to this section of the NSClient++ documentation to get your wrapping to apply to your .pl script:
https://docs.nsclient.org/reference/che ... ed-scripts
Be sure to check out our Knowledgebase for helpful articles and solutions!

https://github.com/mcapra/
User avatar
mcapra
Support Tech
 
Posts: 2279
Joined: Thu May 05, 2016 3:54 pm
Location: Nagios Enterprises


Return to Nagios Core

Who is online

Users browsing this forum: dsnagi and 22 guests