Hi,
I have updated the script with the correct ENV settings but I still appear
to be getting nothing out, I guess this is related to my escaping being
wrong but can anyone please point me in the correct direction.
check host mpo-test with address 1.1.1.1
if failed icmp type echo count 5 with timeout 15 seconds 2 cycles then
exec "/bin/bash -c 'export PAGER_MSG=\"\`echo $MONIT_DESCRIPTION\` \`echo
$MONIT_EVENT\` This is a test\"`;/usr/local/bin/pagerduty_api.pl --service
api_test --event trigger --msg'" else if succeeded then exec "/bin/bash -c
'export PAGER_MSG=\"`echo $MONIT_DESCRIPTION $MONIT_EVENT`\";
/usr/local/bin/pagerduty_api.pl --service api_test --event resolve --msg'"
Thanks
Mark
From: [email protected]
[mailto:[email protected]] On Behalf Of
Martin Pala
Sent: 23 November 2011 17:39
To: This is the general mailing list for monit
Subject: Re: exec script
Hi,
the environment variables exported by monit have the "MONIT_" prefix
($MONIT_DESCRIPTION, $MONIT_EVENT, etc.)
See the list of the environment variables in the monit manual for more
details:
http://www.mmonit.com/monit/documentation/monit.html#environment
Best regards,
Martin
On Nov 23, 2011, at 2:10 PM, Mark Olliver wrote:
Hi,
We have an alert script which sends messages about service states to
pagerduty, for this to work I think I need to set use the exec function on
the monit checks.
I have tried the command line below which works fine when running it in the
CLI however is blank when running it from Monit. Can I please check is the
variable DESCRIPTION and EVENT exported in monit or should I be using
something else?
check host test with address 192.168.1.1
if failed icmp type echo count 5 with timeout 15 seconds 2 cycles then
exec "/bin/bash -c 'export PAGER_MSG=\"`echo $DESCRIPTION
$EVENT\"`;/usr/local/bin/pagerduty_api.pl --service api_test --event trigger
--msg'" else if succeeded then exec "/bin/bash -c 'export PAGER_MSG=\"`echo
$DESCRIPTION $EVENT`\"; /usr/local/bin/pagerduty_api.pl --service api_test
--event resolve --msg'"
Thanks
Mark
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general