example external plugin to help understand API

Hi! I’m brand new to Netdata and really to analytics in general. We’re using Netdata to monitor a colletion of servers that operate a workflow system, and we want to add a custom data collector for our workflow data, to correlate it against the server analytics.

Naturally, I read the docs at https://learn.netdata.cloud/docs/improving-netdata—developers/external-plugins start to finish, and it sort of makes sense to me, but I think it’d be really helpful to just read an existing plugin implemented with this API so I can better understand the flow of the lines going to stdout.

Can someone point me in the direction of some code I can read?

I’m also not really clear on where my compiled plugin needs to go for Netdata to be able to discover it and run it. I’m on arch linux, for reference.

You don’t need a new external plugin. Start with Monitor anything with Netdata | Learn Netdata

I would disagree. To get the kind of analytics we’re after, we need to query a database and process the data in a particular way, then send that processed data to Netdata. We’re basically trying to correlate resource usage (RAM, CPU, etc) to workflow concurrency for a variety of workflows across servers.

I think I’ve written an external plugin correctly as per the API, the only thing I’m missing is where my binary is supposed to be placed to be picked up by the Netdata service…

So, I re-read the documentation, and it looks like I’m supposed to place plugins in the /usr/libexec/netdata/plugins.d directory, is that correct?

I’ve placed the plugin I wrote in there, though I’m not sure what I’m supposed to look for to see that it’s working. The journald logs haven’t mentioned a new plugin or anything and I don’t see it in my dashboard yet…

For anyone else interested, I was able to find a work around. I still wish I could understand how to get my external plugin working, but I worked around this by using statsd. Check out the stats docs here:

My use case was essentially counting how many of a given working were running at a given time, so I made a small app that queries out database for the running jobs, counts the ones considered “same”, and uses a statsd library to send a “count” to the netdata statsd server. Works well enough for my use case!

Thanks for sharing your updates @ericsartor - good going with the statsd approach have seen that used before for stuff like this.

I was wondering if something like this might be useful: Monitor any SQL metrics with Netdata (and Pandas ❤️) | Netdata Blog

Or a more general “sql collector” that could just query database directly to get the metrics and collect them into netdata?