Tag Archives: item preprocessing

What’s Up, Home? – Baby, Don’t Cry

Post Syndicated from Janne Pikkarainen original https://blog.zabbix.com/whats-up-home-baby-dont-cry/25354/

Can you detect a crying baby with Zabbix? Of course, you can! By day, I am a monitoring tech lead in a global cyber security company. By night, I monitor my home with Zabbix & Grafana and do some weird experiments with them. Welcome to my blog about the project.

Time really flies. Our little baby girl at home is already about three and a half months old, and that shows in so many ways. If during her first month or two she cried quite a lot and quite easily due gassy stomach and whatnot, she nowadays mostly is a chill mini-human just observing the world.

Which then raised the question for me — how often she cries? Could I monitor that? Oh yes. And oh no. We’ll get to no part later, but let’s start with the good bits.

Hey Siri, help me

As I pretty much always have my iPhone with or near me, and wear my Apple Watch nearly 24×7, I thought I would give their sound recognition abilities a try.

To start, I opened the Settings on my iPhone and went to Accessibility Sound recognitionBaby crying and enabled that.

Next, I opened Shortcuts and created a new Personal automation.

Here’s the advanced CRYENGINE in action.

So, every time my iDevice thinks that our baby is crying, it appends to a text file stored on my iCloud account.

Zabbix Time!

How to get that data to Zabbix?

I have a MacBook Pro and a Zabbix agent running on that, so the next natural step was to make it monitor that particular text file. There would be so many ways to detect if this file has been changed; as I’m appending to the text file, I just made Zabbix keep an eye on the file size.

How does that look like on my graphs? Not so surprisingly, the value changes.

I also set up a simple trigger that screams if the file size has changed since the last check.

The result? Well, here’s some alert history.

Sleep Learn Adapt reporting

I also added our baby as a Service to my Zabbix, just because it was too fun to skip as the terminology involves child services, parent services and such.

And here’s a totally inaccurate and unmeaningful SLA report about her.

The wobbly bits

Just like our baby is still clumsy and has a lot to learn, it seems that Siri is like that too when it comes to detecting emotions. Yes, Siri can detect if our baby is crying, but it also easily gets worried whenever our baby makes loud joyful sounds. It reminds me of the golden times when T-800 practiced smiling. It just doesn’t know or understand human feelings. At least, not yet.

Then the other odd part is that about one day after I enabled the cry detection on my iPhone, it’s not doing it anymore. Did the detection process crash? Probably. I have not restarted my iPhone yet, because I just could not bother to do that yet. But, in theory, we can detect a crying baby, or many more usual sounds like a doorbell, a dog barking just by using Siri and Zabbix.

I have been working at Forcepoint since 2014 and I think my human skills still beat the ones Siri has. — Janne Pikkarainen

This post was originally published on the author’s LinkedIn account.

What’s Up, Home? – Catching the Northern Lights

Post Syndicated from Janne Pikkarainen original https://blog.zabbix.com/whats-up-home-catching-the-northern-lights/24836/

Can you monitor Northern Lights with Zabbix? Of course, you can! By day, I am a monitoring tech lead in a global cyber security company. By night, I monitor my home with Zabbix & Grafana and do some weird experiments with them. Welcome to my blog about this project.

Christmas is coming, and (at least if you believe Hollywood movies) part of that magic would be staring at the sky and marvel the Northern Lights. Well, in practice you probably won’t see them, as even if the Northern Lights would be up there, a thick layer of clouds will probably prevent you from seeing them. Or then you live in an area with so many street lights that you don’t see the sky properly.

We have tried to watch them several times with my wife, but our attempts all over the years and all the seasons have failed so far. But, for the sake of the Christmas spirit, let’s imagine you could actually see the lights.

Getting the data

There are probably actual APIs for getting the data — at first, I went to NASA’s open data site but then quickly gave up; there’s so much data that I would not have an actual idea how to start parsing this beautiful sky flames phenomenon.

Admitting my lameness, I next came up with plan B. The Finnish Institute of meteorology has this page for space weather & Northern Lights predictions. Sorry, the page is all in Finnish, so likely it looks like an alien language to you. Anyway, there’s this snippet that shows the probability of Northern Lights tonight (“Tänä yönä”), tomorrow (“Huomenna” and the day after tomorrow (“Ylihuomenna”).

Is that some kind of advanced form of encryption? No, that’s just the Finnish language for you.
Making it work

But how to parse that? Well, of course, with Zabbix, that is easy with the HTTP Agent item type. It allows you to grab website content and then perform all the advanced processing for the data you would expect from Zabbix item preprocessing.

Then, using dependent items — one for tonight, one for tomorrow, one for the day after tomorrow — and item preprocessing we can extract the interesting bits.

And see, it works!

I also created a (still boring-looking) dashboard, which shows me the current values.

The problem I now have is that I don’t know all the values the page could contain — when I created this blog post, the chances of seeing the Northern Lights were small (“pieni”) or smallish (“pienehkö”). Well, I keep checking my dashboard from now on! For now, I could create triggers that would alert me if the values would be something else than “pieni” or “pienehkö”, but did not have time for that yet.

I have been working at Forcepoint since 2014 and I bring many Nordic values to the company, even though I’m not lucky with the Northern Lights. — Janne Pikkarainen

This post was originally published on the author’s LinkedIn account.

What’s Up, Home? – How Zabbix Can Help You with Rising Electricity Bills

Post Syndicated from Janne Pikkarainen original https://blog.zabbix.com/whats-up-home-how-zabbix-can-help-you-with-rising-electricity-bills/23582/

Can you monitor your upcoming electricity bills with Zabbix? Of course, you can! By day, I am a monitoring technical lead in a global cyber security company. By night, I monitor my home with Zabbix & Grafana Labs and make some weird experiments with them. Welcome to my weekly blog about the project.

With the current world events, energy prices are soaring. But how much do I need to really pay next month for my electricity? Zabbix to the rescue!

(Yes, in Finland I can check that from my electricity company’s page, but where’s the fun in that?)

Fixed vs spot price

There are two kinds of electricity contracts you can subscribe to in Finland. With a fixed price, you can be sure your bill does not fluctuate that much from month to month, as you pay the same price per kilowatt for every hour of the day. In this kind of deal, the electricity company adds some extra to each kilowatt, so you will automatically pay some extra compared to the electricity market price, but at least you don’t get so severely surprised by market price peaks.

Then there’s the spot price, where you pay only the electricity market price. This can and will vary a lot depending on the hour of the day, but at least in theory, this is the cheapest option in the long run. But, if the market price goes WAY up, like it tends to do in the winter, and has now been peaking due to world events, this can add to your bill.

Nordpool, please respond

There’s Nord Pool (“Nord Pool runs the leading power market in Europe, offering day-ahead and intraday markets to our customers”), and there’s a Python library for accessing Nord Pool electricity prices. With it, I could get hour-by-hour prices, but for this experiment, let’s stick with the average kWh price. The example script on the GitHub page shows all kinds of data, and for fun let’s use Zabbix item preprocessing to parse the average price from its output.

I now have the below script on running as a cron task every night, so my results will be updated once per 24 hours.

So, Zabbix then reads the file contents, like in so many of my previous blog posts.

Next, let’s add some preprocessing. The regular expression part gets the Average value from the script output, and the custom multiplier changes the value from “Euros per Megawatt” to “Euros per Kilowatt”, for it to be a familiar value for me from the electricity bills.

And… it’s working! As I know our average consumption, let’s add a new Grafana dashboard.

Four seasons

During summer, we don’t actually use very much electricity compared to our harsh winter; for example, keeping our garage “warm” (about +10C) during winter contributes to our electricity bill quite a lot.
Here’s a dashboard showing some guesstimations of how expensive the different seasons will be for us. Or, hopefully cheap, if the long overdue new Olkiluoto 3 nuclear plant finally could operate at its full capacity here in Finland.

The guesstimate above is missing some taxes and electricity transfer prices, so the reality will be a bit more expensive than this. Maybe I should also add some triggers to Zabbix to make me alert about any really crazy price changes.

Anyway, now I can start gathering nuts for the cold winter as it seems that it will be an expensive one.

I have been working at Forcepoint since 2014 and I’m happy that my laptop does not consume too much electricity. — Janne Pikkarainen

This post was originally published on the author’s LinkedIn account.

The post What’s Up, Home? – How Zabbix Can Help You with Rising Electricity Bills appeared first on Zabbix Blog.