telegraf: Telegraf Graylog Doesn't Pull Metrics
Relevant telegraf.conf
# Read flattened metrics from one or more GrayLog HTTP endpoints
[[inputs.graylog]]
## API endpoint, currently supported API:
##
## - multiple (Ex http://<host>:12900/system/metrics/multiple)
## - namespace (Ex http://<host>:12900/system/metrics/namespace/{namespace})
##
## For namespace endpoint, the metrics array will be ignored for that call.
## Endpoint can contain namespace and multiple type calls.
##
## Please check http://[graylog-server-ip]:12900/api-browser for full list
## of endpoints
servers = [
"http://192.168.187.15:9000/api/system/metrics",
]
timeout = "5s"
## Metrics list
## List of metrics can be found on Graylog webservice documentation.
## Or by hitting the web service api at:
## http://[graylog-host]:12900/system/metrics
metrics = [
"org.graylog2.inputs",
"org.graylog2.plugins",
"org.graylog2.buffers",
"org.graylog2.throughput"
]
## Username and password
username = "admin"
password = "********"
## Optional TLS Config
# tls_ca = "/etc/telegraf/ca.pem"
# tls_cert = "/etc/telegraf/cert.pem"
# tls_key = "/etc/telegraf/key.pem"
## Use TLS but skip chain & host verification
# insecure_skip_verify = true
Logs from Telegraf
root@influx:~# telegraf --config /etc/telegraf/telegraf.conf --input-filter graylog --test --debug
2022-10-02T00:52:07Z I! Starting Telegraf 1.25.0-ed0b59f1
2022-10-02T00:52:07Z I! Available plugins: 223 inputs, 9 aggregators, 26 processors, 20 parsers, 57 outputs
2022-10-02T00:52:07Z I! Loaded inputs: graylog
2022-10-02T00:52:07Z I! Loaded aggregators:
2022-10-02T00:52:07Z I! Loaded processors:
2022-10-02T00:52:07Z W! Outputs are not used in testing mode!
2022-10-02T00:52:07Z I! Tags enabled:
2022-10-02T00:52:07Z D! [agent] Initializing plugins
2022-10-02T00:52:07Z D! [agent] Starting service inputs
2022-10-02T00:52:07Z D! [agent] Stopping service inputs
2022-10-02T00:52:07Z D! [agent] Input channel closed
2022-10-02T00:52:07Z D! [agent] Stopped Successfully
System info
Telegraf 1.25.0-ed0b59f1, Debian 11, LXC
Docker
- Running as an LXC container under Proxmox.
Steps to reproduce
- Configure a graylog input to pull from the metrics api
- Test configuration with telegraf cli using --debug
- Validate that no data is received as shown in the telegraf log. …
Expected behavior
When I visit the API for Graylog directly to pull a list of fields, then endpoint is:
http://localhost:9000/api/system/metrics
Actual behavior
The API is accessible directly, but Telegraf just isn’t trying. See the screenshot in Additional Info.
Additional info
Screenshot of the current Graylog API Browser.

It looks like the endpoint changed, the url of the API browser changed, and this may have caused things to break in the Telegraf plugin.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 25 (10 by maintainers)
@hackdefendr I am using an api-token to access. I have used this method since Graylog 2.3 series to access API to use it to pull performance metrics via Zabbix and then alerts in Grafana. I have replicated same method here for TICK stack.
From Joschi (Graylog Guy) - Github repo
Accessing API via token (see line 35) https://gist.github.com/joschi/21bc88207881581099570dd85588f7df[https://gist.github.com/joschi/21bc88207881581099570dd85588f7df
Accessing API via session token https://gist.github.com/joschi/72fb7e75b171c10d3717
You will see that accessing via sesion token has an expiry and so is not suitable for use with telegraf plugin. In your initial post, you are showing a username and password possibly in your telegraf.conf. I suggest replacing with an API key with appropriate permissions. I generally use an admin level key.
From your initial post.
In the telegraf graylog input plugin at https://github.com/influxdata/telegraf/blob/master/plugins/inputs/graylog/graylog.go
We can see the following
Function Gather server makes the request and within in the function sendRequest(serverURL) makes the request.
An in the sendRequest method, we see
This means that if we set the username to the value of an api token and password to “token” , it will match the token example from before so that the authorisation header would be.
For example
Will result in the following header
Therefore looking at the examples provided it is clear that only the permanent api token method is supported. @powersj I think the documentation needs to be updated to reflect this issue or the code could be changed to support session method as well. However, the plugin works and does not need to be depreciated.
Hope this helps. Cyberkryption
I really appreciate that you took the time to look! I’ll leave this bug open to track deprecating the plugin.
I spent the previous evening looking over the code for this plugin and I don’t even know Go, but I was willing to try. In the end, I have nothing to show. I have no idea how to fix this plugin and if you don’t have the time then deprecation is the right path.