侦听TCP端口上JSON事件的CANopsis连接器

tcp2canopsis的Python项目详细描述


https://travis-ci.org/linkdd/tcp2canopsis.svg?branch=master

此包提供一个连接器,用于侦听TCP端口上的事件。

用法

在指定的端口(8000在本例中)上运行脚本,并使用url AMQP服务器的:

$ tcp2canopsis -p 8000 -a "amqp://guest:guest@localhost:5672/" -t token

然后使用telnet发布事件:

$ telnet localhost 8000
Trying ::1...
Connected to localhost.
Escape character is '^]'.
token
{"connector": "test", "connector_name": "testname", "event_type": "check", "source_type": "resource", "component": "testcmp", "resource": "testrsrc", "state": 0, "output": "test output"}
{"connector": "test", "connector_name": "testname", "event_type": "check", "source_type": "resource", "component": "testcmp", "resource": "testrsrc", "state": 1, "output": "test output 2"}
{"connector": "test", "connector_name": "testname", "event_type": "check", "source_type": "resource", "component": "testcmp", "resource": "testrsrc", "state": 0, "output": "test output 3"}
Connection closed by foreign host.

或者在json文件中:

{"tcp2canopsis":{"port":8000,"amqp":"amqp://guest:guest@localhost:5672/","token":"token"}}

并使用以下命令加载文件:

$ tcp2canopsis -c path/to/config.json

安装

只需键入:

$ pip install tcp2canopsis

或者,在本地安装:

$ ./makefile

这将在当前文件夹中创建一个虚拟python环境,并安装由requirements.txt列出的依赖项。 最后,它将执行python setup.py install

执行此脚本后,连接器将在当前文件夹(现在是虚拟python环境)中可用。

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

推荐PyPI第三方库


热门话题
Spring启动测试中的java MockBean注释导致NonuniqueBeandDefinitionException   java Spring Hateoas调试模板不能为null   递归培根游戏Java程序?   java在Android中保存少量数据(对象)的最简单方法是什么?   异常处理Java中finally块的要点是什么?   是java。util。货币真的是工厂方法模式吗?   java如何输入字符以停止循环   java如何对流的某些部分执行缩减操作   java new Gson()。单例类的toJson(object)返回null   java Itext泰米尔字体显示不正确   java运行时。getRuntime()。gpg命令不起作用的exec()   java如何在preparedstatemenet中将字符连接到SQL字符串   java将同一实体的多个表示形式与lazyload合并时出错   JavaSpring、Hibernate和JPA:在entitymanager上调用persist似乎并没有提交到数据库   java osgi r6服务。组成部分注释属性列表