Metrics.NET report to Zabbix
来源:互联网 发布:js数组中移除元素 编辑:程序博客网 时间:2024/06/05 13:48
废话不多说,先上git地址 https://github.com/binking338/Metrics.Reporters.ZabbixReporter
实现了Metrics.NET到Zabbix的报表插件,能够在非常有限的代码配置下自动将所有的Metrics度量数据全部report到zabbix服务器上,支持自动创建zabbix的template、item。
接口
/// <summary>/// 数据导出至Zabbix服务器/// Zabbix服务配置读取至ZabbixApi的配置文件/// </summary>/// <param name="reports"></param>/// <param name="timeInterval">上报时间间隔</param>/// <returns></returns>public static MetricsReports WithZabbix(this MetricsReports reports, TimeSpan timeInterval)/// <summary>/// 数据导出至Zabbix服务器/// </summary>/// <param name="reports"></param>/// <param name="template">Zabbix模板</param>/// <param name="timeInterval">上报时间间隔</param>/// <returns></returns>public static MetricsReports WithZabbix(this MetricsReports reports, string template, TimeSpan timeInterval)/// <summary>/// 数据导出至Zabbix服务器/// </summary>/// <param name="reports"></param>/// <param name="host">Zabbix服务IP地址</param>/// <param name="port">Zabbix服务端口</param>/// <param name="user">Zabbix管理端用户账户</param>/// <param name="password">Zabbix管理端用户密码</param>/// <param name="timeInterval">上报时间间隔</param>/// <returns></returns>public static MetricsReports WithZabbix(this MetricsReports reports, string host, int port, string user, string password, TimeSpan timeInterval)/// <summary>/// 数据导出至Zabbix服务器/// </summary>/// <param name="reports"></param>/// <param name="host">Zabbix服务IP地址</param>/// <param name="port">Zabbix服务端口</param>/// <param name="user">Zabbix管理端用户账户</param>/// <param name="password">Zabbix管理端用户密码</param>/// <param name="template">Zabbix模板</param>/// <param name="timeInterval">上报时间间隔</param>/// <returns></returns>public static MetricsReports WithZabbix(this MetricsReports reports, string host, int port, string user, string password, string template, TimeSpan timeInterval)
示例
使用代码配置
Metric.Config.WithReporting(config => config .WithZabbix("myZabbixServer", 10051, "Admin", "zabbix", "myZabbixServer", TimeSpan.FromSeconds(5)) );
使用配置文件(App.config/Web.config)
代码:
Metric.Config.WithReporting(config => config .WithZabbix(TimeSpan.FromSeconds(5)) );
配置文件:
<?xml version="1.0" encoding="utf-8" ?><configuration> <appSettings> <!--metrics的全局上下文名称,如接口中未传入template参数,该值被用作模板名称--> <add key="Metrics.GlobalContextName" value="globalContextName"/> <!--zabbix服务器主机名/IP,如配置了 ZabbixApi.url 该配置可选--> <add key="Zabbix.host" value="myZabbixServer"/> <!--zabbix服务端口,默认10051--> <add key="Zabbix.port" value="10051"/> <!--zabbix管理端API地址--> <add key="ZabbixApi.url" value="http://myZabbixServer/zabbix/api_jsonrpc.php" /> <!--zabbix管理端用户名称,不提供将不会自动创建template和item--> <add key="ZabbixApi.user" value="Admin" /> <!--zabbix管理端用户密码--> <add key="ZabbixApi.password" value="zabbix" /> </appSettings></configuration>
0 0
- Metrics.NET report to Zabbix
- Generate Code Metrics Report
- Metrics.NET step by step
- Metrics.NET源码阅读笔记
- 8-steps metrics program - an introduction to metrics
- metrics
- metrics
- "INFO metrics.MetricsUtil: Unable to obtain hostName"
- How to collect RDS MySQL metrics
- Report-To-Report 的Control Table
- [VB.NET]Crystal Report
- ASP.NET Crystal Report
- zabbix-Java library to access Zabbix API
- zabbix connection to database 'zabbix' failed:
- 基于dropwizard/metrics ,kafka,zabbix构建应用统计数据收集展示系统
- 基于dropwizard/metrics ,kafka,zabbix构建应用统计数据收集展示系统
- How to Report Bugs Effectively
- How to Report Bugs Effectively
- hadoop MapReduce实例解析
- 如何用.NET生成二维码?
- oracle rac12c dbca创建集群实例时候,只能识别到一个节点
- Android中AsyncTask使用
- 阶段总结2
- Metrics.NET report to Zabbix
- Reflect-Java
- 解决ubuntu解压windows生成的zip文件时乱码问题
- log4j配置
- MFC中的句柄
- ReLu(Rectified Linear Units)激活函数
- 21个webApp前端开发问题
- MathType破解版式保存后字体变化怎么解决?
- java 接口及抽象类