I have a conditionnal rule in Icinga to execute a script for checking cas authentification. The script use an URL and grep a string in the page returned. URL and string are given attributes to the script.
Here's the defintion of a host :
object Host "m" {
address = "1xx.xx7.25"
import "linux-server"
display_name = "m"
vars.curl_casURL = "http://xxx.html"
vars.curl_casGREP = "Returned String"
}
Here's the code for the Service, it's only executed when the 2 variables curl_casURL and curl_casGREP are defined in the host :
apply Service "cas" {
import "generic-service"
check_command = "cas"
assign where (host.vars.curl_casURL && host.vars.curl_casGREP)
}
In the web Interface, it's OK, I saw that the script is executed for the server "m".
Here's the command :
object CheckCommand "cas" {
import "plugin-check-command"
command = [ PluginDir + "/icinga-curl_cas.sh" ]
command +=[ vars.curl_casURL + vars.curl_casGREP ]
}
But the script never receives the arguments and echoes a critical state because of the first line of the script :
if [ ! $1 ]
then
echo "GIVE ME AN URL, PLEASE!"
exit $STATE_CRITICAL
fi
I didn't find in the documentation the answer. Could anyone help me? Thanks!!