WillemDH wrote:In my experience, monitoring remote shares can only be done properly by using a Windows gateway where NSClient runs as a user with permissions on the share. Configure the nscp service to run with this user and create the command which monitors the size.
This wil also only work with very recent NSClient versions, as in very early version, it was not possible to monitor remote shares, and a bit later, there was a bug. If it doesn't work with the version you are running now, try https://github.com/mickem/nscp/releases/tag/0.5.0.43
Thanks for the addition Willem! I realized that in my test as well -
check_map_drive? Where did you get that command / script from? Did you define it in your nsclient.ini? Can you post the external script directive from your nsclient here?
objShell.PopUp "Drive " & strDriveLetter & _
" is not connected."
It looks like your plugin indeed works. I haven't done much VBS scripting, but testing your vbs, I believe the issue is that it isn't outputting to Nagios properly. Here's how another plugin exits -
' Set the msg output to be used (OK/WARNING/CRITICAL/UNKNOWN will be applied automaticly)
return_code = np.check_threshold(Args("arg"))
msg = "Testing " & Args.Item("host") & " " & np.get_threshold("warning") & " " & np.get_threshold("critical")
' Nice Exit with msg and exitcode
np.nagios_exit msg, return_code
Even with the changes @rkennedy proposed, I don't think this script will work when NSClient++ uses it.
This is because NSClient++ is executing as the SYSTEM user account, not the user who is logged into the system. The SYSTEM account won't have the mapped drives that the user you are logged in and testing it as will.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.