livebox:xap_cacti

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
livebox:xap_cacti [2013/05/29 01:59] brettlivebox:xap_cacti [2013/05/31 11:57] (current) – [Customizing for xAP] garrydwilms
Line 62: Line 62:
 The installation of [[http://www.cacti.net|CACTI]] is beyond the scope of this document and I'll assume you already have it setup and running, there are many guides our there to show you how to install this product.  I will however show how I did it. The installation of [[http://www.cacti.net|CACTI]] is beyond the scope of this document and I'll assume you already have it setup and running, there are many guides our there to show you how to install this product.  I will however show how I did it.
  
-===== Installing Cacti on CentOS =====+==== Installing Cacti on CentOS6 ====
  
 For CentOS6.x installing is a snap For CentOS6.x installing is a snap
Line 81: Line 81:
 You need to include one custom script that will called by the cacti data poller to reach our to our LUA caching web applet to grab xAP data values. You need to include one custom script that will called by the cacti data poller to reach our to our LUA caching web applet to grab xAP data values.
  
-On my system this script appear on a linux server at: ''/usr/share/cacti/scripts/xapquery.py'' don't forget to set the permission bits+On my system this script appear on a linux server at: ''/var/lib/cacti/scripts/xapquery.py'' don't forget to set the permission bits
  
 <code> <code>
Line 100: Line 100:
 import sys import sys
 import time import time
-from os import popen+import urllib2
  
 def getValue(target,section,key): def getValue(target,section,key):
-        popen("wget -qO- http://livebox.local:8080/%s/%s/%s" % (target,section,key)) +        urllib2.urlopen("http://livebox.local:8080/%s/%s/%s" % (target,section,key)) 
-        ret = x.read() +        ret = f.read() 
-        x.close() +        if key == "state": 
-        if ret: +            if ret == "on": return 1 
-                return ret +        elif ret: 
-        return "0"+            return ret 
 +        return 0
  
 if len(sys.argv) < 3: if len(sys.argv) < 3:
  • livebox/xap_cacti.1369792763.txt.gz
  • Last modified: 2013/05/29 01:59
  • by brett