首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Pingingget_actions_alerts方法返回空列表

Pingingget_actions_alerts方法返回空列表
EN

Stack Overflow用户
提问于 2013-07-21 11:13:21
回答 1查看 544关注 0票数 0

我是一个新的学习者,使用pingdom在django-项目检查网站的状态。我已经将pingdom库导入到直接访问views.py中的方法

我的views.py

代码语言:javascript
复制
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")

但是pingdomaction列表在hiting url上是空的,也没有读取警报。

代码语言:javascript
复制
Terminal putput :


pingdomactions= {u'alerts': []}
[21/Jul/2013 05:19:08] "GET /data/actions/ HTTP/1.1" 200 2075

问题:

  1. 获得空操作列表可能存在哪些问题?您对此错误有什么解决方案吗?
  2. 我正确地使用了这个pingdomlib吗?或者还有另一种方法来利用它。
EN

回答 1

Stack Overflow用户

发布于 2013-08-16 17:44:12

api.action()将传递由pingdom返回的警报,如果pingdom没有对警报采取任何行动,它将是空的。通常,我从行动中看到的是,pingdom发送的电子邮件通知列表,作为对下降的响应,所以如果您没有从pingdom发送任何邮件/sms/其他警告,那么这很可能是空的原因。

总的来说,你好像在按我的意思使用我的库,如果它还在给你任何挣扎,请告诉我!

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17771723

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档