python-diamond / Diamond

Diamond is a python daemon that collects system metrics and publishes them to Graphite (and others). It is capable of collecting cpu, memory, network, i/o, load and disk metrics. Additionally, it features an API for implementing custom collectors for gathering metrics from almost any source.
http://diamond.readthedocs.org/
MIT License
1.74k stars 600 forks source link

How can I set multi url when using HTTPJSONcollecor #675

Closed stjacob closed 2 years ago

stjacob commented 7 years ago

I tried these methods and failed:

  1. vim /etc/diamond/diamond.conf [[HTTPJSONCollector]] enabled = True url = http://172.17.14.121:18077/monitor?cmd=qps interval = 60

[[HTTPJSONCollector]] hostname = 172_17_14_121 enabled = True url = http://172.17.14.121:18077/monitor?cmd=qps interval = 60

  1. I make new collector file which is copied from httpjson.py and renamed it by hostname.

What is the correct way?

DStape commented 6 years ago

Hi @stjacob,

My first thought was, "does this collector support multiple URLs", unfortunately it doesn't, is this something you think you'd be able to add? No problem if not.

Or alternatively, there is a way to run multiple instances of the same collector:

1) Add collectors_config_path = <some/path/to/your/collector/config> 2) Make sure your HTTPJSONCollector.conf exists at that path 3) Now make a copy of that config file and rename it to HTTPJSONCollector 2.conf (NOTE the space). 4) Make change to the new config file and then start diamond. You should now have two instances of the collector running, each using a different config.

Let me know how you get on with this, thanks.

shortdudey123 commented 2 years ago

Reopen if the above solution does not work.