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 601 forks source link

GraphiteHandler connection error #715

Closed irfanjs closed 2 years ago

irfanjs commented 6 years ago

i am using hosted graphite server on the https://www.hostedgraphite.com/app/agent/ and installed all the packages (hg-agent etc) on the Linux VM instance

i have following diamond.conf file

# hg-agent diamond configuration.
# Do not edit by hand.
# Generated 2018-06-29T13:09:16.101373 UTC.
[server]
collectors_path = /opt/hg-agent/collectors/
handlers = diamond.handler.graphite.GraphiteHandler, diamond.handler.archive.ArchiveHandler

[handlers]
[[default]]

[[ArchiveHandler]]
log_file = /var/log/hg-agent/archive.log
days = 7

[[GraphiteHandler]]
host = localhost

[collectors]
[[default]]
path_prefix = hg_agent
hostname_method = smart
interval = 30

[[CPUCollector]]
enabled = True

[[DiskSpaceCollector]]
enabled = True

[[DiskUsageCollector]]
enabled = True

[[FilesCollector]]
enabled = True
dir = /var/opt/hg-agent/drop

[[LoadAverageCollector]]
enabled = True

[[MemoryCollector]]
enabled = True

[[NetworkCollector]]
enabled = True

[[SockstatCollector]]
enabled = True

[[VMStatCollector]]
enabled = True

[[SelfCollector]]
enabled = True

but getting following error in the diamond.log file

1530293930.69   [Handlers:1146:DEBUG]   GraphiteHandler: Reconnect failed.
1530293930.69   [Handlers:1146:WARNING] GraphiteHandler: Trimming backlog. Removing oldest 1 and keeping newest 4 metrics
1530293930.69   [Handlers:1146:DEBUG]   GraphiteHandler: Socket is not connected. Reconnecting.
1530293930.69   [Handlers:1146:DEBUG]   GraphiteHandler: Failed to connect to localhost:2003. [Errno 111] Connection refused.
1530293930.69   [Handlers:1146:DEBUG]   GraphiteHandler: Reconnect failed.
1530293930.69   [Handlers:1146:WARNING] GraphiteHandler: Trimming backlog. Removing oldest 1 and keeping newest 4 metrics
1530293930.69   [Handlers:1146:DEBUG]   GraphiteHandler: Socket is not connected. Reconnecting.
1530293930.69   [Handlers:1146:DEBUG]   GraphiteHandler: Failed to connect to localhost:2003. [Errno 111] Connection refused.
1530293930.69   [Handlers:1146:DEBUG]   GraphiteHandler: Reconnect failed.
1530293930.69   [Handlers:1146:WARNING] GraphiteHandler: Trimming backlog. Removing oldest 1 and keeping newest 4 metrics
1530293930.69   [Handlers:1146:DEBUG]   GraphiteHandler: Socket is not connected. Reconnecting.
1530293930.69   [Handlers:1146:DEBUG]   GraphiteHandler: Failed to connect to localhost:2003. [Errno 111] Connection refused.
1530293930.69   [Handlers:1146:DEBUG]   GraphiteHandler: Reconnect failed.
1530293930.69   [Handlers:1146:WARNING] GraphiteHandler: Trimming backlog. Removing oldest 1 and keeping newest 4 metrics
1530293930.69   [Handlers:1146:DEBUG]   GraphiteHandler: Socket is not connected. Reconnecting.
1530293930.7    [Handlers:1146:DEBUG]   GraphiteHandler: Failed to connect to localhost:2003. [Errno 111] Connection refused.
1530293930.7    [Handlers:1146:DEBUG]   GraphiteHandler: Reconnect failed.
1530293930.7    [Handlers:1146:WARNING] GraphiteHandler: Trimming backlog. Removing oldest 1 and keeping newest 4 metrics
1530293930.7    [Handlers:1146:DEBUG]   GraphiteHandler: Socket is not connected. Reconnecting.
1530293930.7    [Handlers:1146:DEBUG]   GraphiteHandler: Failed to connect to localhost:2003. [Errno 111] Connection refused.
1530293930.7    [Handlers:1146:DEBUG]   GraphiteHandler: Reconnect failed.
1530293930.7    [Handlers:1146:WARNING] GraphiteHandler: Trimming backlog. Removing oldest 1 and keeping newest 4 metrics
1530293930.7    [Handlers:1146:DEBUG]   GraphiteHandler: Socket is not connected. Reconnecting.
1530293930.7    [Handlers:1146:DEBUG]   GraphiteHandler: Failed to connect to localhost:2003. [Errno 111] Connection refused.
1530293930.7    [Handlers:1146:DEBUG]   GraphiteHandler: Reconnect failed.
1530293930.7    [Handlers:1146:WARNING] GraphiteHandler: Trimming backlog. Removing oldest 1 and keeping newest 4 metrics
1530293930.7    [Handlers:1146:DEBUG]   GraphiteHandler: Socket is not connected. Reconnecting.
1530293930.7    [Handlers:1146:DEBUG]   GraphiteHandler: Failed to connect to localhost:2003. [Errno 111] Connection refused.
1530293930.7    [Handlers:1146:DEBUG]   GraphiteHandler: Reconnect failed.

not getting where is the issue? i just want to collect the system metrics using hosted graphite server using the agent installed on my linux VM

i think , i need to use correct url in diamond.conf file ... but now getting what should be the correct url for hosted graphite server ... please suggest

ggvanleeuwen commented 5 years ago

I found this issue while searching for a solution.

In my setup it appeared that graphite was only listening on localhost as 127.0.0.1 while resolving localhost resulted in ::1 - editing /etc/hosts to only return the former fixed it for me:

127.0.0.1      localhost
shortdudey123 commented 2 years ago

If the above solution doesn't work, reopen.