How to use unix socket with zscores, changefinder, or anomalies modules

Environment

Running Netdata through a Unix socket instead of localhost port 19999

Problem/Question

I would like to set up the python modules: zscores, changefinder, and anomalies.
However, I cannot figure out how to use a Unix Socket with them.
I’ve tried changing the line in their configs:
host: '127.0.0.1:19999'
To
host: 'unix:/var/run/netdata/netdata.sock'
without success.
Anyone have any suggestions?

What I expected to happen

Hello @Steve8291 - thanks for posting!

I am pretty sure all those collectors use our netdata-pandas library to pull the data. So i think it would just be a case of trying to make that capable to use unix sockets like you suggest.

I’m not 100% sure what would be involved here but i think it might come down to if asks library (which we use to make all the async agent api requests to get the data) can handle unix sockets like you want.

I’ll have a look into it to see. Looking at docs here: asks — asks 1.3.6 documentation

Wondering if might require some new dependency like this: GitHub - msabramo/requests-unixsocket: Use requests to talk HTTP via a UNIX domain socket

@ilyam8 any feeling on if this should be an easy enough one I can look into or might be more complicated?

@Steve8291 fyi - we have implemented some anomaly detection in the agent in much more efficient approach and all c++ based. It is in large part inspired by the anomalies collector (here is a python notebook I’m working on to explain how it all works). We are working on a feature called “Anomaly Advisor” in netdata cloud then that aims to make it all a bit easier and more clearly surface the metrics - here is a 5 min sneak peak of what I mean.

So if you are interested in ML driven Anomaly Detection this would be the best way to go, i could make sure to let you know once the anomaly advisor tab is available for early adopters to beta test a bit - a few weeks is the rough timeline here, we just want to dogfood it a bit more internally first. Just wanted to mention this as i’m keen to find interested users to be early adopters. FYI you could enable the anomaly detection in the agent today if you want. It’s off by default for now but easy to enable that then would give you the basic anomaly detection charts which can still be useful for finding periods of time where the overall anomaly rate was elevated, its just not going to say much about what was anomalous which is main aim of the “Anomaly Advisor” and more features in both Agent and Netdata Cloud that will build on this (for example ability to just see the anomaly rate on every chart in a really easy an ‘natural’ way, also more integration with health and alarms if that’s something users would like once they get used to the anomaly rate).

@andrewm4894 thanks so much for the thorough response to my question.
I would definitely be interested in helping test the new agent ML anomaly detection. As soon as I have time, I’ll enable it and check it out.

1 Like

That is technically possible and we even have an example - python HAproxy collector. But I am not sure using multiple inheritance is the best solution for that. We can discuss other options if you decide to implement this.

Ah, you are using netdata-pandas library - it needs to be updated then.

1 Like

@ilyam8 do I need to update my pandas library or is this something that has to be done with the collector?
I’m currently running:

netdata-pandas 0.0.38
pandas 1.2.5

@Steve8291 it would be an update or PR we would need to make in the netdata-pandas library GitHub - netdata/netdata-pandas: A helper library to pull data from the netdata rest api into a pandas dataframe. in here somewhere.

It’s not a quick or obvious one so would take a little thought i think.

1 Like