I am new learner to use pingdom-api in django-project to check the status of website. I have imported pingdom library to access methods directly in my views.py
my views.py
import datetime
import pingdomlib
api = pingdomlib.Pingdom( username = "anilxxxx@gmail.com", password = "xxxxxx", apikey = "xf8xyxxxxxxxxxxxxxxxxxxxxxxx")
def get_actions_alerts(request):
pingdomactions=api.actions()
print "pingdomactions=", pingdomactions
for alert in api.alerts(limit=10):
time = datetime.datetime.fromtimestamp(alert['time'])
timestamp = time.strftime('%Y-%m-%d %H:%M:%S')
print timestamp
print "[%s] %s is %s" % (time, alert['name'], alert['status'])
return render_to_response("base_audit_template.html") #need to render data to this page
def get_checks(request):
pingdomchecks = api.getChecks()
print "pingdomchecks" , pingdomchecks
for check in pingdomchecks:
# See pingdomlib.check documentation for information on PingdomCheck class
if check.status != 'up':
print check
else :
print "status up:" , check
return render_to_response("base_audit_template.html")
But pingdomactions list is empty on hiting url, also not reading alerts
Terminal putput :
pingdomactions= {u'alerts': []}
[21/Jul/2013 05:19:08] "GET /data/actions/ HTTP/1.1" 200 2075
Questions:
What are the possible problems for getting empty action list ? . Do you have any solutions for this error.
Am i using this pingdomlib correctly? or there is another-way to use it.