tons协议的公共接口,用于监视工具,如nagios/icinga…

argusp的Python项目详细描述


https://img.shields.io/pypi/v/arguspy.svghttps://img.shields.io/pypi/dm/arguspy.svghttps://travis-ci.org/crazy-canux/arguspy.svg?branch=masterhttps://coveralls.io/repos/github/crazy-canux/arguspy/badge.svg?branch=master

arguspy

pic1

[已弃用]由于nagios太旧,此项目已弃用。

请转到另一个项目[super-devops]

Arguspy是纯python代码

它是一个用于监视插件的api包,比如nagios、icinga、naemon、shinken、centreon、opsview和sensu。

[awesome-monitoring]

如何安装

使用PIP安装:

$ pip install super_devops
$ pip install arguspy

如何使用

只需导入您需要的协议:

from arguspy.ftp_ftplib import Ftp
from arguspy.http_requests import Http
from arguspy.mssql_pymssql import Mssql
from arguspy.mysql_pymysql import Mysql
from arguspy.ssh_paramiko import Ssh
from arguspy.winrm_pywinrm import WinRM
from arguspy.wmi_sh import Wmi
from arguspy.wmi_subprocess import Wmi

然后编写自己的函数监视类:

class YourClass(Ftp/Mssql/Ssh/WinRM/Wmi/Http/Snmp/...):
    def __init__(self):
        super(YourClass, self).__init__()
        self.logger.debug("Init YourClass.")

    def define_sub_options(self):
        super(YourClass, self).define_sub_options()
        self.your_parser = self.subparsers.add_parser(...)
        self.your_parser.add_argument(...)
        ...

    def your_handle(self):
        """Put your function monitoring code here."""
        # Default status is ok.
        status = self.ok

        # Call the API and get the monitoring data.
        # Read the document or check the API on python/ipython Interactive console.
        # help(Ftp/...)
        # dir(Ftp/...)
        ...

        #  Compare with the warning and critical value and change the status.
        ...

        self.shortoutput = "..."
        self.longoutput.append(...)
        self.perfdata.append(...)

        self.logger.debug("Return status and output.")
        status(self.output())

如果在一个文件中放置多个函数监视类(不推荐):

class Register(YourClass1, YourClass2, ...):
    def __init__(self):
        super(Register, self).__init__()

最后一步:

def main():
    plugin = Register()
    if plugin.args.option == 'action':
        plugin.action_handle()
    elif ...:
        ...
    else:
        plugin.unknown("Unknown actions.")

if __name__ == "__main__":
    main()

如何扩展

检查todo列表,可以给出测试示例或文档。

你也可以请求你的代码。

待办事项

  • 在测试中编写单元测试/
  • 在文档中写入文档/
  • 在示例中编写示例/
  • 与python3兼容
  • vSphere监视
  • LDAP监视
  • SNMP监视

作者

[Authors]

许可证

[License]

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

推荐PyPI第三方库


热门话题
java无法从spring resttemplate访问sms网关   使用spark上下文方法参数的java并行化集合不正确   java中ReadLock的并发检查副本   java基于属性比较两个列表是否具有相同的元素   字符串Java文本块:缩进前缀中的制表符和空格的混合   java如何将带有@SpringBootApplication的maven模块作为测试范围中的依赖项添加到另一个maven模块   我需要一些关于在Java中使用2个jar文件的帮助   mysql JPA Java Spring Boot执行查找/连接表   java对话框选择具有特定名称的文件   java如何修复Spring工具套件4中的端口8080错误?   Java中的apache poi Excel阅读器   java如何在tomcat访问日志中记录线程上下文值   java有一种方法可以创建类<T>的实例,该类将类作为传递泛型的构造函数中的参数   默认情况下,java GORM onetomany映射执行即时抓取   java不能在安卓中接受全局变量   统计系统的java MongoDB异步驱动程序排名   java如何解析:无法解析插件“org.springframework.ide.eclipse.ui”?   用Java从一副牌中随机抽取5张牌   javaapachecamel动态消费者   java如何克服使用Flood Fill 4算法时的“薄边界”问题?