Sending data to external Graphite 'Can't connect to Graphite on host'?

I have graphite (not graphite web) installed and a working graphite server.
I have the connection to it setup as per https://icinga.com/docs/graphite/latest/doc/02-Installation/ conf file.
In /var/log/icinga2/icinga2.log I get:
[2019-07-30 20:09:42 -0700] critical/GraphiteWriter: Exception during Graphite operation: Verify that your backend is operational!
[2019-07-30 20:09:52 -0700] critical/TcpSocket: getaddrinfo() failed with error code -2, “Name or service not known”
Context:
(0) Reconnecting to Graphite ‘graphite’

[2019-07-30 20:09:52 -0700] critical/GraphiteWriter: Can’t connect to Graphite on host ‘10.100.199.179`’ port ‘2003’.
Context:
(0) Reconnecting to Graphite ‘graphite’

Now I can send data using NC straight from the icinga2 host to the graphite host using the classic graphite test:
$ echo "icinga2.random.diceroll 4 date +%s" | nc 10.100.199.179 2003

What part of Icinga2 would be getting ’ Can’t connect to Graphite on host’ refusal / messages.
Firewall and all is good as I can send the test data just fine using netcat.
I am looking to send all my data offboard and not have it on the icinga2 host system itself so graphite and all that is on another system. I am not lookign to display the data back on icingaweb2 today.

Any help is appreciated.

Hi,

which versions of Icinga and Graphite are involved here?

The graphite feature inside Icinga tries to open the TCP socket, and keep it open during metric transmission. This is to avoid opening a connection on each single metric.

The error returned by the TcpSocket class is low level with DNS resolving.

getaddrinfo() failed with error code -2, “Name or service not known”

Can you try the FQDN instead of the IP address to rule out possible errors here?

Cheers,
Michael

ok let me look at that and try that though any gethostbyaddr() type of routine should not mind and resolve either just as well.

btw in my graphite config its listed by IP as well and should be perfectly valid :
/etc/icinga2/features-enabled/graphite.conf
/**

  • The GraphiteWriter type writes check result metrics and
  • performance data to a graphite tcp socket.
    */

object GraphiteWriter “graphite” {
host = “10.100.199.179”
port = 2003
enable_send_thresholds = true
enable_send_metadata = true
}

My mistake. There was a typo and a single character I missed in the graphite.conf that was causing the error. I fixed that I can see data in my graphite system now.
Thanks for the help.