简体   繁体   English

如何设置NSClient ++自动将指标发送到REST服务器

[英]How to Setup NSClient++ to automatically send metrics to REST server

We'd like to deploy NSClient++ on some windows servers to collect and send in metrics to our central server. 我们想在某些Windows服务器上部署NSClient ++,以收集指标并将其发送到我们的中央服务器。 This central server can talk in any protocol (eg, graphite/carbon protocol) if need be, but we'd really like it to submit each metric in JSON format to a central webserver running a REST interface that can receive them and do further processing. 该中央服务器可以根据需要使用任何协议(例如,石墨/碳协议)进行通信,但是我们真的希望它以JSON格式将每个指标提交给运行REST接口的中央网络服务器,该服务器可以接收它们并进行进一步处理。

We want mostly performance metrics to flow in, once a minute. 我们主要希望性能指标每分钟一次流入。 We don't care about non-numeric data, but if that comes in, too, that'd be fine, we can parse it into an alarm console if we receive it. 我们不在乎非数字数据,但是如果也输入非数字数据就可以了,如果我们收到了数据,我们可以将其解析为警报控制台。

I get that I can install nsclient++ with a downloadable MSI installer. 我知道可以使用可下载的MSI安装程序安装nsclient ++。 Configuring it is a thing, then, but how? 那么,配置它是一件事情,但是如何呢? I even have read that I can have it send performance data to a graphite server, but how do I intercept that performance data and do the sending myself via a REST interface? 我什至已经读到可以将性能数据发送到石墨服务器,但是如何截获性能数据并通过REST接口发送自己呢?

I can code anything in Python, if there's a way to get the data I'm trying to send into my python app, I can use urllib2 (or requests) to send it in. 我可以用Python编写任何代码,如果有办法将要发送的数据发送到python应用程序中,则可以使用urllib2(或请求)将其发送。

Can someone point me to a how-to on this if there is one out there, or explain how this fits together? 如果有人在那里,有人可以指出我的操作方法,或者解释一下这些方法如何组合在一起?

After NSClient++ installation, just copy below configuration in C:\\Program Files\\NSClient++\\nsclient.ini 安装NSClient++之后,只需将以下配置复制到C:\\Program Files\\NSClient++\\nsclient.ini

[/modules]
CheckDisk = enabled
CheckExternalScripts = enabled
CheckHelpers = enabled
CheckNet = enabled
CheckSystem = enabled
GraphiteClient = enabled
Scheduler = enabled


[/settings/graphite/client]
channel = GRAPHITE
hostname=windows

[/settings/graphite/client/targets/default]
address = 192.168.202.128


[/settings/scheduler/schedules/default]
interval = 10s
report = all


[/settings/scheduler/schedules]
cpu=alias_cpu
mem=alias_mem
disk=alias_disk
service=alias_service
channel = GRAPHITE

With NSclient++ we can send metrics to Nagios with NSCA protocol or to Graphite server. 使用NSclient ++,我们可以通过NSCA协议将指标发送到Nagios或Graphite服务器。 So, in the config file we are defining GRAPHITE channel with some config (like address ) and scheduler . 因此,在配置文件中,我们使用一些配置(例如address )和scheduler定义了GRAPHITE通道。 The scheduler will collect the metrics and send it to Channel . scheduler将收集指标并将其发送到Channel According to above config, the Graphite is at 192.168.202.128 . 根据上述配置, Graphite位于192.168.202.128

Issue I was facing 我面临的问题

But it is not picking the hostname . 但是它没有选择hostname According to graphite HTTP Doc , it should send metrics in formate like <machine_name>.<Metric_Name> <Value> , but what I see is <Metrics_name> <Value> . 根据石墨HTTP Doc的说法,它应该以<machine_name>.<Metric_Name> <Value>发送指标,例如<machine_name>.<Metric_Name> <Value> ,但是我看到的是<Metrics_name> <Value> If metrics are pushing from different machines, we can not differentiate. 如果指标来自不同的计算机,我们将无法区分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM