34 lines
783 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/discoveryWrapControl
source /var/observium/CMDB/pollScripts/discoveryWrapCommon.sh
function discover()
#Perform discovery of hosts with pattern passed in via $1
{
logger "Performing discovery of node type: $1"
/var/observium/observium/discovery.php -h *$1*
if [ $? -ne 0 ]; then
error_out fatal "discovery.php run for $1 failed"
fi
}
function main()
#Main execution body
{
for arg in "${commandline_args[@]}"; do
preflight "$arg"
touch /tmp/discovery-$arg.lock
discover "$arg"
rm -f /tmp/discovery-$arg.lock
logger "Completed discovery."
done
}
#Kick it all off
commandline_args=("$@")
main