#!/bin/bash
usage="usage: test_soap a|r [host] [alarm-params]"
if [ $# -eq 0 ]
then
echo $usage
exit 1
fi
if [ $# -eq 1 ]
then
echo No host given. Using localhost
host=localhost
else
host=$2
fi
unixtime=$(date +%s)
sourcehost=$(hostname)
if [ $1 = "a" ]
then
# alarm handling
curl "http://$host/sysal/soap/service.php?class=SoapAlarming" -X POST -d 'IPv4/11.3.3.4'$unixtime'free_form/Hilfeeeserv_indep'$sourcehost'host_name/'$sourcehost'' >result.xml
elif [ $1 = "r" ]
then
# alarm reset
curl "http://$host/sysal/soap/service.php?class=SoapAlarming" -X POST -d 'IPv4/11.3.3.4'$unixtime'free_form/Hilfeeecleared'$sourcehost'host_name/'$sourcehost'' >result.xml
else
echo $usage
exit 1
fi
if ! grep ">0/dev/null
then
cat result.xml
exit 1
fi