Zabbix JSON RPC

Questions / TL;DR:

  1. Is it possible to consume the JSON-RPC based API of Zabbix via the Grafana JSON API Data Source?
  2. Does anyone have any pointers on this?

Grafana v.9.2.6

  • What are you trying to achieve?

Consume the Zabbix JSON-RPC 2.0 API via the Grafana JSON API Data Source.

  • How are you trying to achieve it?

I’ve added a new Data Source of type JSON API, and inserted the relevant URL of my Zabbix instance.

  • What happened?

On the Explore page in Grafana, I attempt POST queries towards the API, but fail to see how I can communicate with the JSON-RPC based API.

I see no means by which that I can authenticate with the API, and do subsequent API calls using the retrieved authentication token (following a login).

Welcome

Does the token have a limited ttl?

Thanks for you reply yosiasz.

As far as I can tell, there is no limitation on the duration of a session after invoking the user.login method of the Zabbix JSON-RPC API. Instead we’re encouraged to call the user.logout method to avoid many open sessions.

My issue or question is more about whether or not the JSON API DataSource in Grafana is suitable for JSON-RPC API such as that provided by Zabbix. I don’t see how I can carry out the login procedure (user.login) where the username and password is passed in the body of a POST request, nor do I see a clear path to using the authentication token returned by the user.login method in subsequent calls to the Zabbix API.

So if you are using user name and password, the infinity plugin is perfect choice.

But if calling the api involves tokens, there are ways to do it but it would be an anti pattern.

For example you could make the login process a grafana variable and call subsequent api calls using that token variable but it exposes the token in the dev tools.