
Thanks everyone for your help... In the end rookie mistake.. Had imported hosts list from a MS-Excel file and had removed the ^M's but it would seem it still had 'DOS' attributes. Quick dos2unix on the file and the script(s) are working.
Once again, many thanks for your help --Dave
On Thu, Jul 04, 2013 at 02:50:19PM +1000, Matt Taylor wrote:
Hi,
I did this when I bulk added hosts (note: pwd = /opt/observium):
- File named "addhost.sh", chmod +x it of course.
#!/bin/bash echo "Adding: $1" ./addhost.php $1 communityhere v2c ./discovery.php -h $1 ./poller.php -h $1
file named "newhosts", which contains each host on a new line.
Loop through "newhosts", adding each host etc..
for HOST in `cat newhosts`; do ./addhost.sh $HOST; sleep 5; done | tee /tmp/observium-addhost.log
Check "/tmp/observium-addhost.log" later on if there's any dramas.
Cheers, Matt.
On 4/07/13 1:46 PM, Rob J. Epping wrote:
Hi,
On Jul 4, 2013 12:23 AM, "Paul Gear" <observium@gear.dyndns.org mailto:observium@gear.dyndns.org> wrote:
Chris, your script is functionally identical to David's.
Changing variables to upper case and leaving out the quotes will make no difference.
Quotes do make a difference when there is a space in the file. Because of the quotes it will become part of the hostname.
David, can you ping the given host by name? That message means
that the name lookup (whether using the local hosts file or DNS) failed.
On 07/04/2013 07:42 AM, Chris Moody wrote:
Your bash loop syntax is likely the culprit.
If you have your devices/nodes listed in a text file, I'd
iterate like so:
for NODE in `cat textfile.txt`; do ./addhost.php $NODE
community v2c; done
-Chris
On 7/3/13 3:45 PM, David Lagace wrote:
I tried to script it in the following way (please don't hurt
me I'm not much
of a coder)
for file in `cat routerdt1`; do ./addhost.php "$file" mycomm v2c; done
But keep getting: Could not resolve i504562
observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium