Plugin check not working

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Plugin check not working

Post by npolovenko »

@kwhogster, Please try with the following definitions:

Code: Select all

check_iis_conn = cmd /c echo scripts\\powershell\\check_iis_connections.ps1  $ARG1$ $ARG2$ $ARG3$ $ARG4$;

Code: Select all

check_command check_nrpe!check_iis_conn!-a 'TGCS014-N1' 'Default Web Site' '5' '9'
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: Plugin check not working

Post by kwhogster »

Code: Select all

check_iis_conn = cmd /c echo scripts\\powershell\\check_iis_connections.ps1 "$ARG1$" "$ARG2$" "$ARG3$" "$ARG4$";

Code: Select all

 check_command           check_nrpe!check_iis_conn!-a 'TGCS014-N1' 'Default Web Site' '5' '9'
same results

Current Status:
OK
(for 1d 5h 46m 39s)
Status Information: C:Program FilesNSClient++scriptspowershellcheck_iis_connections.ps1 :
Cannot process argument transformation on parameter 'warning_value'. Cannot
convert value "$" to type "System.Int32". Error: "Input string was not in a
correct format."
At line:1 char:66
+ ... ershell\\check_iis_connections.ps1 "$ARG1$" "$ARG2$" "$ARG3$" "$ARG4$ ...
+ ~~~~~~~~
+ CategoryInfo : InvalidData: (:) [check_iis_connections.ps1], Pa
rameterBindingArgumentTransformationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,check_iis_c
onnections.ps1
Performance Data:
Current Attempt: 1/10 (HARD state)
Last Check Time: 06-08-2018 21:52:10
Check Type: ACTIVE
Check Latency / Duration: 0.000 / 0.801 seconds
Next Scheduled Check: 06-08-2018 22:52:10
Last State Change: 06-07-2018 16:52:10
Last Notification: N/A (notification 0)
Is This Service Flapping?
NO
(0.00% state change)
In Scheduled Downtime?
NO

Last Update: 06-08-2018 22:38:46 ( 0d 0h 0m 3s ago)


This is so strange this same check work on several other servers just not this one even NODE2 in the cluster the same check works

Thanks for trying willing to try anything here.



OOOPS

Update

Now it went to Unknown

Current Status:
UNKNOWN
(for 0d 0h 12m 57s)
Status Information: Get-Counter : Unable to access the desired computer or service. Check the
permissions and authentication of the log service or the interactive user
session against those on the computer or service being monitored.
At C:\Program Files\NSClient++\scripts\powershell\check_iis_connections.ps1:40
char:12
+ $counter = Get-Counter "\\$server\Web Service($website)\Current Conne ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidResult: (:) [Get-Counter], Exception
+ FullyQualifiedErrorId : CounterApiError,Microsoft.PowerShell.Commands.Ge
tCounterCommand

CONNECTIONS UNKNOWN Default Web Site not found
Performance Data:
Current Attempt: 10/10 (HARD state)
Last Check Time: 06-08-2018 23:00:56
Check Type: ACTIVE
Check Latency / Duration: 0.000 / 1.995 seconds
Next Scheduled Check: 06-09-2018 00:00:56
Last State Change: 06-08-2018 22:52:10
Last Notification: N/A (notification 0)
Is This Service Flapping?
NO
(6.25% state change)
In Scheduled Downtime?
NO

Last Update: 06-08-2018 23:05:06 ( 0d 0h 0m 1s ago)
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Plugin check not working

Post by tgriep »

Try this. In the nsclient.ini file, define the command like this.

Code: Select all

check_iis_conn = cmd /c echo scripts\\powershell\\check_iis_connections.ps1 $ARG1$ ; exit($lastexitcode) | powershell.exe -command -
Save the file and restart nsclient++.
This will setup the command to accept all of the arguments from the check_nrpe command as one argument.

Then define the check like this on the Nagios server.

Code: Select all

check_command           check_nrpe!check_iis_conn!-a 'TGCS014-N1 "Default Web Site" 5 9'
This will send over all of the separate arguments as one argument.

Restart nagios and test the command.
If you get an error, post the nsclient.ini file and the nsclient.log file from the Windows system as well as the command definition from the Nagios server.
Be sure to check out our Knowledgebase for helpful articles and solutions!
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: Plugin check not working

Post by kwhogster »

nsclient.ini
nsclient
(23.51 KiB) Downloaded 284 times
nsclient.ini
nsclient
(23.51 KiB) Downloaded 284 times

Code: Select all

define service{
        use                     generic-service
        host_name               TGCS014-N1
        service_description     Default Web Site Connections
        check_interval          60
        notification_interval   60
        check_command           check_nrpe!check_iis_conn!-a 'TGCS014-N1 "Default Web Site" 5 9'
        servicegroups           WEBServices
        }

from the Nagios page


Default Web Site Connections



OK 06-11-2018 19:59:23 0d 0h 34m 50s 1/10 C:Program FilesNSClient++scriptspowershellcheck_iis_connections.ps1


HTH

Thanks Tom
Attachments
nsclient.log
nsclient log
(7.6 KiB) Downloaded 266 times
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Plugin check not working

Post by tgriep »

There are a lot of errors in the nagios.log file so lets clean up the nsclient.ini file.
Edit the file and remove the following lines

Code: Select all

LUAScript.dll = enabled
NSCAClient = 1
You should also change the path to the script wrapper for the powershell scripts.
Change the following from

Code: Select all

ps1 = cmd /c echo scripts\\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -
to

Code: Select all

ps1 = cmd /c echo scripts\\powershell\\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -
Save the nsclient.ini file and restart the NSClient++ service.
Check the log file for the unknown command errors and if they are not found, test it and post any errors here.
Be sure to check out our Knowledgebase for helpful articles and solutions!
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: Plugin check not working

Post by kwhogster »

Made the changes and the same results does not report back correct information

the logfile was small here it is

2018-05-30 18:26:00: error:c:\source\nscp\modules\NRPEServer\NRPEServer.cpp:132: CA not found: C:\Program Files\NSClient++/security/ca.pem (generating a default CA)
2018-05-30 18:26:00: error:c:\source\nscp\modules\WEBServer\WEBServer.cpp:642: Certificate not found: C:\Program Files\NSClient++/security/certificate.pem (generating a default certificate)
2018-05-30 18:31:00: error:c:\source\nscp\service\NSClient++.cpp:216: Failed to register plugin LUAScript: Could not load library: 126: The specified module could not be found.

: LUAScript.dll
2018-05-30 19:28:55: error:c:\source\nscp\service\NSClient++.cpp:216: Failed to register plugin LUAScript: Could not load library: 126: The specified module could not be found.

: LUAScript.dll
2018-05-30 19:31:19: error:c:\source\nscp\service\NSClient++.cpp:216: Failed to register plugin LUAScript: Could not load library: 126: The specified module could not be found.

: LUAScript.dll
2018-05-30 21:30:27: error:c:\source\nscp\service\NSClient++.cpp:484: Module (LUAScript.dll) was not found: Could not load library: 126: The specified module could not be found.

: LUAScript.dll
2018-05-30 21:31:40: error:c:\source\nscp\service\NSClient++.cpp:427: Failed to load C:\Program Files\NSClient++/modules\LUAScript.dll: Could not load library: 126: The specified module could not be found.

: LUAScript.dll
2018-05-30 21:31:40: error:c:\source\nscp\service\NSClient++.cpp:484: Module (LUAScript.dll) was not found: Could not load library: 126: The specified module could not be found.

: LUAScript.dll
2018-05-31 20:52:10: error:c:\source\nscp\service\NSClient++.cpp:894: Unknown command(s): check_host_cluster available commands: commands {, alias_cpu, alias_cpu_ex, alias_disk, alias_disk_loose, alias_event_log, alias_file_age, alias_file_size, alias_mem, alias_process, alias_process_count, alias_process_hung, alias_process_stopped, alias_sched_all, alias_sched_long, alias_sched_task, alias_service, alias_service_ex, alias_up, alias_volumes, alias_volumes_loose, check_always_critical, check_always_ok, check_always_warning, check_counter, check_cpu, check_critical, check_drivesize, check_eventlog, check_explorer, check_files, check_iis_apppool, check_iis_conn, check_iis_sites, check_memory, check_multi, check_negate, check_nscp, check_ok, check_os_version, check_pagefile, check_pdh, check_process, check_service, check_tasksched, check_timeout, check_updates, check_uptime, check_users, check_version, check_warning, check_winfile, check_winservice, checkalwayscritical, checkalwaysok, checkalwayswarning, checkcounter, checkcpu, checkcritical, checkdrivesize, checkeventlog, checkfiles, checkmem, checkmultiple, checkok, checkprocstate, checkservicestate, checktasksched, checkuptime, checkversion, checkwarning, filter_perf, negate, nsca_submit, pscheckapplicationeventlog, pschecksystemeventlog, render_perf, timeout, xform_perf}, plugins {, 0, 1, 2, 3, 4, 5, 6, 8}
2018-05-31 20:52:10: error:c:\source\nscp\include\nscapi\nscapi_core_wrapper.cpp:159: Failed to execute command
2018-05-31 20:52:10: error:c:\source\nscp\include\nscapi\nscapi_core_helper.cpp:95: Failed to execute command: check_host_cluster
2018-06-01 21:22:21: error:c:\source\nscp\service\NSClient++.cpp:427: Failed to load C:\Program Files\NSClient++/modules\LUAScript.dll: Could not load library: 126: The specified module could not be found.

: LUAScript.dll
2018-06-02 12:32:47: error:c:\source\nscp\service\NSClient++.cpp:427: Failed to load C:\Program Files\NSClient++/modules\LUAScript.dll: Could not load library: 126: The specified module could not be found.

: LUAScript.dll
2018-06-05 20:02:32: error:c:\source\nscp\service\NSClient++.cpp:427: Failed to load C:\Program Files\NSClient++/modules\LUAScript.dll: Could not load library: 126: The specified module could not be found.

: LUAScript.dll
2018-06-06 16:45:17: error:c:\source\nscp\service\NSClient++.cpp:427: Failed to load C:\Program Files\NSClient++/modules\LUAScript.dll: Could not load library: 126: The specified module could not be found.

: LUAScript.dll
2018-06-07 17:15:54: error:c:\source\nscp\service\NSClient++.cpp:427: Failed to load C:\Program Files\NSClient++/modules\LUAScript.dll: Could not load library: 126: The specified module could not be found.

: LUAScript.dll
2018-06-07 23:39:44: error:c:\source\nscp\service\NSClient++.cpp:894: Unknown command(s): check_cluster available commands: commands {, alias_cpu, alias_cpu_ex, alias_disk, alias_disk_loose, alias_event_log, alias_file_age, alias_file_size, alias_mem, alias_process, alias_process_count, alias_process_hung, alias_process_stopped, alias_sched_all, alias_sched_long, alias_sched_task, alias_service, alias_service_ex, alias_up, alias_volumes, alias_volumes_loose, check_always_critical, check_always_ok, check_always_warning, check_counter, check_cpu, check_critical, check_drivesize, check_eventlog, check_explorer, check_files, check_iis_apppool, check_iis_conn, check_iis_sites, check_memory, check_multi, check_negate, check_nscp, check_ok, check_os_version, check_pagefile, check_pdh, check_process, check_service, check_tasksched, check_timeout, check_updates, check_uptime, check_users, check_version, check_warning, check_winfile, check_winservice, checkalwayscritical, checkalwaysok, checkalwayswarning, checkcounter, checkcpu, checkcritical, checkdrivesize, checkeventlog, checkfiles, checkmem, checkmultiple, checkok, checkprocstate, checkservicestate, checktasksched, checkuptime, checkversion, checkwarning, filter_perf, negate, nsca_submit, pscheckapplicationeventlog, pschecksystemeventlog, render_perf, timeout, xform_perf}, plugins {, 0, 1, 2, 3, 4, 5, 6, 9}
2018-06-07 23:39:44: error:c:\source\nscp\include\nscapi\nscapi_core_wrapper.cpp:159: Failed to execute command
2018-06-07 23:39:44: error:c:\source\nscp\include\nscapi\nscapi_core_helper.cpp:95: Failed to execute command: check_cluster
2018-06-07 23:44:29: error:c:\source\nscp\service\NSClient++.cpp:894: Unknown command(s): check_host_cluster available commands: commands {, alias_cpu, alias_cpu_ex, alias_disk, alias_disk_loose, alias_event_log, alias_file_age, alias_file_size, alias_mem, alias_process, alias_process_count, alias_process_hung, alias_process_stopped, alias_sched_all, alias_sched_long, alias_sched_task, alias_service, alias_service_ex, alias_up, alias_volumes, alias_volumes_loose, check_always_critical, check_always_ok, check_always_warning, check_counter, check_cpu, check_critical, check_drivesize, check_eventlog, check_explorer, check_files, check_iis_apppool, check_iis_conn, check_iis_sites, check_memory, check_multi, check_negate, check_nscp, check_ok, check_os_version, check_pagefile, check_pdh, check_process, check_service, check_tasksched, check_timeout, check_updates, check_uptime, check_users, check_version, check_warning, check_winfile, check_winservice, checkalwayscritical, checkalwaysok, checkalwayswarning, checkcounter, checkcpu, checkcritical, checkdrivesize, checkeventlog, checkfiles, checkmem, checkmultiple, checkok, checkprocstate, checkservicestate, checktasksched, checkuptime, checkversion, checkwarning, filter_perf, negate, nsca_submit, pscheckapplicationeventlog, pschecksystemeventlog, render_perf, timeout, xform_perf}, plugins {, 0, 1, 2, 3, 4, 5, 6, 9}
2018-06-07 23:44:29: error:c:\source\nscp\include\nscapi\nscapi_core_wrapper.cpp:159: Failed to execute command
2018-06-07 23:44:29: error:c:\source\nscp\include\nscapi\nscapi_core_helper.cpp:95: Failed to execute command: check_host_cluster
2018-06-11 19:54:11: error:c:\source\nscp\service\NSClient++.cpp:427: Failed to load C:\Program Files\NSClient++/modules\LUAScript.dll: Could not load library: 126: The specified module could not be found.

: LUAScript.dll

Why is that DLL not loading " Failed to register plugin LUAScript"
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Plugin check not working

Post by tgriep »

You would have to ask the author of the NSClient++ agent on why it is not loading.
On my Windows system, I do not load that DLL and the external and alias commands load and run.
It almost looks like that entry did not get removed or that the agent did not get restarted.
Be sure to check out our Knowledgebase for helpful articles and solutions!
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: Plugin check not working

Post by kwhogster »

I posted this on the nsclinet site and no one responds

This is crazy the same check run on other server no problems
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Plugin check not working

Post by tgriep »

What versions of NSCLient++ are installed on a working server vs the non working one?
If the versions are close, copy the nsclient.ini file from the working one to the non working one and restart the NSClient++ agent.
Be sure to check out our Knowledgebase for helpful articles and solutions!
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: Plugin check not working

Post by kwhogster »

Update

I believe the problem is the fact that I first had Nsclient 5.144 installed had removed that and reverted back to 4.3

I have to rebuild this server for other reasons.

I will hopefully have results within the next few days.

Thank you.
Locked