On Fri, Aug 10, 2012 at 2:47 AM, Henrik Størner <henrik at hswn.dk> wrote:
On 10-08-2012 03:55, Jeremy Laidman wrote:
#!/bin/bash exec 3<>/dev/tcp/$1/1984 || exit 1 echo "status
uname -n.testing greendate$2" >&3Well, whaddayano - one learns something new every day!
This was too good to just leave in the mailinglist archive, so I collected the Perl, Bash- and Korn-shell suggestions into the Xymon "Tips & Tricks" document. See http://www.xymon.com/xymon/**help/xymon-tips.html#noinstall<http://www.xymon.com/xymon/help/xymon-tips.html#noinstall>
Another one for the list. This works well enough to be a drop-in replacement for the xymon binary on some AIX systems here. it gets you (optional) encrypted delivery.
#!/bin/sh
# Shell script replacement for the xymon binary
export XYMONURL="https://server.domain.com/xymon-cgi/xymoncgimsg.cgi"
# the curl option "--capath" designates a directory with CA
certificates # to validate secure server connections. If your xymon server doesn't # use https, that line can be removed.
if [ "$2" = "@" ]; then
# read message from stdin
$XYMONHOME/bin/curl -s -S -L -m 30 \
--capath /etc/pki/tls/certs \
-H "Content-Type: application/octet-stream" \
-H "MIME-version: 1.0" \
--data-binary "@-" \
$XYMONURL
else
# arg 2 *is* the message
$XYMONHOME/bin/curl -s -S -L -m 30 \
--capath /etc/pki/tls/certs \
-H "Content-Type: application/octet-stream" \
-H "MIME-version: 1.0" \
--data-binary "$2" \
$XYMONURL
fi
exit 0
Ralph Mitchell