A zabbix-template for OpenEMS

Hi all,

my name is Dustin and I’m new to this community. Since last year I own a Fenecon System, based on OpenEMS.

Today I’ve started to create a template for the foss NMS Zabbix. I want to visualize the data of the EMS in another way and also might need a way to react to certain events, for instance a switch from On-Grid to Off-Grid.

Currently the template is hard-coded, so there is an item for meter0/State and an item for meter2/State. This fits to MY system, but will not fit to others. Zabbix has the possibility to automate item-generation, but i could not find a REST endpoint which creates a list of all channels in the system. this might allow a kind of auto-configuration (called discovery) of the monitoring system.

Do you know if such an endpoint exists?

In addtion, I noticed the meter2 (in my case that seems to be the backup-power), does not return a frequency but null. I reckon this might be because, the system is currently in On-Grid mode and the inverter is turned off, is this assumption correct?

As up to this writing I’ve implemented approximately 100 endpoints manually. Automatic discovery will make things much simpler on systems with more than two meters :wink:

I’m going to publish the template as on github once I’ve polished it a bit. If you are already interested, tell me. Unfortunately I can only test it against my FEMS and not against some other OpenEMS systems.

BR
Dustin

1 Like

Hi Dustin,

thanks for your initiative and welcome to the Community.

Internally OpenEMS Edge uses an EdgeConfig object, that holds all the information you require. Right now, this is not available via the REST-Api, though. It would be available via a Websocket connection - this is what the local OpenEMS UI does - but that might not be trivial to implement in Zabbix. REST would clearly be better. Let me see if we can implement such a feature… It would require some changes in RestHandler.java. I noted this thread as a reference in our internal Dev-Tasks list.

There has been a bugfix recently that had broken another feature, that you could use to receive all Channels and their values: Rest call of Write_Only channel returns error · Issue #2025 · OpenEMS/openems · GitHub. The REST-Api supports wildcards, so /rest/channel/*/* should work with the latest version of OpenEMS and FEMS (version 2023.1.2). Downside of this approach is, that you cannot automatically identify the purpose of the Channels… you could read the _PropertyAlias Channel though, which might give some indication.

I have never used Zabbix myself, but I am also curious to see your implementation. Are those 100 endpoints read with individual REST calls or in another way? We’ve been thinking about providing a GraphQL-Api for such use-cases…

Regards,
Stefan

1 Like

Stefan, thank you for your nice welcome and and your reply.

the wildcards do not work on my FEMS 2023.1.2 and jetty returns a 404.

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 404 Not Found</title>
</head>
<body><h2>HTTP ERROR 404 Not Found</h2>
<table>
<tr><th>URI:</th><td>/rest/channel/*/*</td></tr>
<tr><th>STATUS:</th><td>404</td></tr>
<tr><th>MESSAGE:</th><td>Not Found</td></tr>
<tr><th>SERVLET:</th><td>-</td></tr>
</table>
<hr/><a href="https://eclipse.org/jetty">Powered by Jetty:// 9.4.49.v20220914</a><hr/>

</body>
</html>

That _PropertyAlias channel is an interesting property.

Currently I’m polling each item with an individual rest call. I fear, this will lead to a stressed system. Unfortunately I do not have access to the OS below to measure CPU-load and memory-consumption.

Ok yes, there is actually a bug in the implementation. First: it’s not a simple asterisk, but a regular expression; second the matching for the Component-ID is wrongly implemented at the moment.

But for now at least this works: http://[Edge-IP]/rest/channel/_sum/.*

Polling so many Channels might cause problems, yes. That’s why I am planning to introduce GraphQL eventually… but it’s not on our high-priority roadmap at the moment unfortunately.

Indeed, this wildcard works. It is quite interesting.

Hi,

up to today I did not integrate the wildcard-URI into my template. Nevertheless I’d like to share my first draft template from january with you: GitHub - dmth/zabbix_openems: A template to import data from OpenEMS into Zabbix

It is definitely not fit for production use and might even harm your em-system, due to a very high amount of api-calls.

1 Like