34 lines
709 B
Bash

#!/bin/bash
#wrapper script called from cron for observium polling. A lightweight wrapper around poller.php
#Source common functions/variables
source /var/observium/CMDB/pollScripts/pollerWrapControl
source /var/observium/CMDB/pollScripts/pollerWrapCommon.sh
function poller()
#Perform scan
{
logger "Performing polling of node type: $1"
/var/observium/observium/poller.php -h *$1*
if [ $? -ne 0 ]; then
error_out fatal "poller.php run for $1 failed"
fi
}
function main()
#Main execution body
{
for arg in "${commandline_args[@]}"; do
preflight "$arg"
touch /tmp/poll-$arg.lock
poller "$arg"
rm -f /tmp/poll-$arg.lock
logger "Completed polling."
done
}
#Kick it all off
commandline_args=("$@")
main