zabbix low level discovery example use python(web_site_url)


zabbix low discovery example use python(web_site_url)

  
  
  
  
  1. #!/usr/bin/env python

  2. # coding=utf8

  3. # Last modified: 2013-04-12 14:47

  4. # Author: itnihao

  5. # Mail: [email protected]

  6. import os

  7. import json

  8. #r=open('web.txt','r').readlines()

  9. r=open('web.txt','r').read().split()

  10. devices = []

  11. for devpath in  r:

  12.        device = os.path.basename(devpath)

  13.        devices += [{'{#SITENAME}':device}]

  14. print json.dumps({'data':devices},sort_keys=True,indent=7,separators=(',',':'))

web.txt内容如下

  
  
  
  
  1. #cat web.txt  

  2. http://www.baidu.com

  3. http://www.google.com.hk.c44c



你可能感兴趣的:(Discovery,zabbix,low)