使用完整pingdom api的python库

PingdomLib3的Python项目详细描述


作者:kenneth wilke<;kenneth.wilke@gmail.com>;

这是一个python库,提供对pingdom api的完全访问,以及 一些额外的特性使api的使用变得更容易和更像pythonic。

用法示例

连接到pingdom

importpingdomlibapi=pingdomlib.Pingdom(username,password,apikey)

显示所有未处于“上升”状态的检查

# See pingdomlib.pingdom documentation to see available calls and settingspingdomchecks=api.getChecks()forcheckinpingdomchecks:# See pingdomlib.check documentation for information on PingdomCheck classifcheck.status!='up':printcheck

创建新支票

newcheck=api.newCheck("New check name","www.hostnametocheck.com")

更新支票

# Updates to check objects are pushed immediately to pingdomnewcheck.paused=True

禁用更改推送检查

api.pushChanges=False

发送最近10个pingdom警报

importdatetimeforalertinapi.alerts(limit=10):time=datetime.datetime.fromtimestamp(alert['time'])timestamp=time.strftime('%Y-%m-%d %H:%M:%S')print"[%s] %s is %s"%(time,alert['name'],alert['status'])

因特定检查而停机

importdatetimecheck=api.getCheck(227878)foroutageincheck.outages():# timestamp conversiontime_start=datetime.datetime.fromtimestamp(outage['timefrom'])timestamp_start=time_start.strftime('%Y-%m-%d %H:%M:%S')time_end=datetime.datetime.fromtimestamp(outage['timeto'])timestamp_end=time_end.strftime('%Y-%m-%d %H:%M:%S')print"%s: %s from %s to %s [%dm]"%(check.name,outage['status'],timestamp_start,timestamp_end,(outage['timeto']-outage['timefrom'])/60)

贡献者

  • wil clouser
  • 柏林灰烬
  • 吴江
  • 格特詹·欧德·洛伊斯
  • 本杰明·鲍德劳
  • 布里特·格雷沙姆
  • 阿拉德·霍夫
  • 威廉·德格罗特
  • 阿伦·费伊
  • 里克范德洛
  • 库什琴科
  • 史蒂文·贝利

特别感谢

anders ekman,pingdom,为api提供热情而有用的支持

待办事项列表

计划改进

  • 可选的gzip压缩
  • 在禁用pushchanges的情况下改进检查更新过程

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java创建猜谜游戏程序   JavaWebSocketContainer。connectToServer似乎挂起了   如何在java中中断函数   java c#socket client multiple BeginSend()未到达服务器   不可见的组件然后在Java中的窗格之间切换   java在应用程序类中使用静态接口安全吗?   java等待函数完成,直到回调到来   使用DataOutputStream时的java新行,Android   java服务对象的定义是什么?   基于视图的javahibernate复合密钥   java将varchar连接到char在JPA(oracle)中不起作用   如何在java中通过point类读取多个点?