I have an already set-up Nagios Core that uses this script in order to monitor some Hyper-v Cluster shared volumes
https://exchange.nagios.org/directory/P ... 1442825460
I noticed though that the code is a little bit changed and the warning and critical values are static inside the code and not passing through as an argument:
Code: Select all
Param(
[parameter(Mandatory=$true)]
[alias("n")]
$csvname)
#[parameter(Mandatory=$true)]
#[alias("w")]
#$warnlevel,
#[parameter(Mandatory=$true)]
#[alias("c")]
#$critlevel)
#$csvname="Cluster Storage 4"
$warnlevel=80
$critlevel=90
Here is my service definition:
Code: Select all
define service
{use generic-service,graphed-service
service_description Cluster: Volume 3 free disk space
check_command check_hyperv_csv_freespaceTest!Cluster Storage 4!90!95}
Code: Select all
define command {
command_name check_hyperv_csv_freespaceTest
command_line /usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -c check_hyperv_csv_freespace -a "$ARG1$" "$ARG2$" "$ARG3$"
}
Code: Select all
check_hyperv_csv_freespace=cmd /c echo scripts\mine.ps1 -n "$ARG1$" -w "$ARG2$" -c "$ARG3$"; exit($lastexitcode) | powershell.exe -command -
Code: Select all
Status Information: scriptsmine.ps1 -n ARG1$ -w "90 -c "95": exit($lastexitcode)
Performance Data: 'powershell.exe'=0 '-command'=0 '-'=0
Any help would be greatly apreciated.
Thanks
Anna