X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=zabbix%2Fhosts.py;h=35b10f3e204ec148bd5f7a1f06f1130a433bff8f;hb=4aa8a9bfafed28f85381f4f315cc4eb30c94d78b;hp=c2dbde7900d6b2503ddac1134be6a4675aea8722;hpb=bf02dca4b0f09d86990a50a4406ab8ecd79cbd5d;p=monitor.git diff --git a/zabbix/hosts.py b/zabbix/hosts.py index c2dbde7..35b10f3 100755 --- a/zabbix/hosts.py +++ b/zabbix/hosts.py @@ -16,7 +16,7 @@ def is_in_file(filename, pattern): return False def add_to_file(filename, data): os.system("echo '%s' >> %s" % (data, filename)) - print "echo '%s' >> %s" % (data, filename) + #print "echo '%s' >> %s" % (data, filename) sites = api.GetSites({'login_base' : 'mlab*'}, ['node_ids']) for s in sites: @@ -24,9 +24,9 @@ for s in sites: for node in nodes: try: i = api.GetInterfaces({ 'interface_id' : node['interface_ids'], 'is_primary' : True}) - print len(i), i - print "%s %s" % (i[0]['ip'], node['hostname']) - #if not is_in_file(HOSTS_FILE, node['hostname']): - # add_to_file(HOSTS_FILE, "%s %s" % (i[0]['ip'], node['hostname'])) + #print len(i), i + #print "%s %s" % (i[0]['ip'], node['hostname']) + if not is_in_file(HOSTS_FILE, node['hostname']): + add_to_file(HOSTS_FILE, "%s %s" % (i[0]['ip'], node['hostname'])) except: pass