My home monitoring included pretty much anything I wanted to see with one exception - my backup NAS. You see, I use embedded XigmaNAS for my backup server and getting telegraf client onto it is problematic at best. However, who needs Telegraf client anyhow?
Collecting stats themselves is easy enough. Basic CPU stats you get from Telegraf client usually can be easily read via command line tools. As long as you keep the same tags and fields as what Telegraf usually sends you can nicely mingle our manually collected stats with what proper client sends.
And how do we send it? Telegram protocol is essentially just a set of lines pushed using HTTP POST. Yes, if you have a bit more secure system, it's probably HTTPS and it might even be authenticated. But it's still POST in essence.
And therein lies XigmaNAS' problem. There is no curl
or wget
tooling available. And thus sending HTTP POST on embedded XigmaNAS is not possible. Or is it?
Well, here is the beauty of HTTP - it's just a freaking text over TCP connection. And ancient (but still beloved) nc
tool is good at exactly that - sending stuff over network. As long as you can "echo" stuff, you can redirect it to nc
and pretend you have a proper HTTP client. Just don't forget to set headers.
To cut the story short - here is my script using nc
to push statistics from XigmaNAS to my Grafana setup. It'll send basic CPU, memory, temperature, disk, and ZFS stats. Enjoy.