organzing for portfolio
This commit is contained in:
33
NetworkManagement/librenmsPollScripts/discoveryWrap.sh
Normal file
33
NetworkManagement/librenmsPollScripts/discoveryWrap.sh
Normal file
@ -0,0 +1,33 @@
|
||||
#!/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
|
Reference in New Issue
Block a user