[op5-users] re Merlin not importing all data from objects.conf
Michael Hobbs
mike at mikehobbs.co.uk
Mon Aug 10 16:56:58 CEST 2009
Hi all
Been beating head against this problem with merlin not importing properly
and in the end I came up with the idea of just truncating the merlin
database tables and doing a re-import and that worked
So I bashed up a quick script ( which was obviously nicked off the web from
http://david-burger.blogspot.com/2008/02/truncate-all-tables-in-mysql-databa
se.html) and I call that as part of the nagios reload script I run
<snip>
#!/bin/bash
user=merlin
PASS=XXXX
dbname=merlin
basecmd="mysql -u ${user} -p$PASS -D ${dbname}"
tables=$(${basecmd} -e "SHOW TABLES;" | grep -v "+--" | grep -v
"Tables_in_${dbname}"| grep -v "ninja*" | grep -v "user*")
#tables=$(${basecmd} -e "SHOW TABLES;" | grep -v "+--" | grep -v "ninja*" )
if [ $? -ne 0 ]; then
echo "Unable to retrieve the table names." >&2
exit 1
fi
cmd=""
for table in ${tables}; do
cmd="${cmd} TRUNCATE ${table};"
echo ${table}
done
$(${basecmd} -e "${cmd}")
php /usr/local/nagios/etc/addons/merlin/import.php
--cache=/usr/local/nagios/var/objects.cache
</snip>
As you can see I'm not touching the ninja or the user tables just the merlin
ones, now I'm not sure if this is the correct approach to this problem but
it works for me
Cheers
Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.op5.com/pipermail/op5-users/attachments/20090810/5fe5e261/attachment.html
More information about the op5-users
mailing list