Tag Archives: Zabbix log

What’s Up, Home? – Monitor your website visitor rate

Post Syndicated from Janne Pikkarainen original https://blog.zabbix.com/whats-up-home-monitor-your-website-visitor-rate/25660/

Can you monitor your website visitor rate with Zabbix? Of course, you can! By day, I am a lead site reliability engineer in a global cyber security company. By night, I monitor my home with Zabbix & Grafana and do some weird experiments with them.

I have this website hosted in a domain hotel, and among other features, the admin panel has some standard website access log analyzers (such as awstats) available for me to see the activity of this site. That’s cool, but also boringly easy, and requires me to log in to that admin panel instead of me using my trusted single pane of glass that is Zabbix.

Let’s connect to site logs

If I log in to my site over ssh/sftp, my home directory has a preconfigured access_logs directory. Like the name says, it contains the website access logs in the usual format you would expect it to be:

35.166.xxx.xxx – – [26/Jan/2023:04:24:37 +0200] “GET / HTTP/1.1” 200 10055 “http://whatsuphome.fi” “Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36”

That’s great, but how to monitor that in real time with Zabbix? Let’s use sshfs — it’s like NFS or CIFS, but allows you to mount stuff over ssh. On my dear Raspberry Pi 4, which runs my Zabbix, running

sudo mkdir /var/log/whatsuphome && sudo chown zabbix /var/log/whatsuphome

sudo sshfs -o allow_other mywhatsuphomeaccount@myhotelname:access_logs /var/log/whatsuphome

did mount my remote server access_logs directory perfectly fine.

Time for monitoring

Now that we have our log file, the rest is very straightforward and standard log file monitoring. First, let’s add a master item that reads the log.

Nothing too difficult yet.

Next, let’s add a dependent item that grabs the visitor IP address part from a log line.

… and some item preprocessing to grab only the IP

Items

Sorry about that ugly regular expression.

… after adding a few more items, here’s my template.

I’m currently not parsing the referrer, exact URL, or user-agent values, as for the most part those would just add unnecessary noise and load for my poor little home Zabbix.

Dashboard time!

So, finally, I created a dashboard showing the number of unique IP addresses & hits during the past 24 hours and some graphs. Now that I’ve not posted any posts in a while, welcome to Tumbleweedville!

It’s so silent in here that I can hear my own typing.

After publishing this post, I’ll wait for a while and then update the post with a new screenshot, so we’ll get to see the incredible visitor surge that will be counted in at least tens of new IP addresses.

Update #1 about 15 minutes after publishing the post

Clearly some movement in the access log needle!

Update #2 about 15 minutes after publishing the post

Almost 400 unique IP addresses already? Hello, dear readers and bots.

Update #3 about 15 minutes after publishing the post

Even though IP addresses are a bad way to measure the actual amount of visitors, roughly 400 unique new addresses after publishing my post are very good. Thanks, bots and readers!

This post was originally published on the author’s page.

What’s Up, Home? – Record Your Roomba Dance

Post Syndicated from Janne Pikkarainen original https://blog.zabbix.com/whats-up-home-record-your-roomba-dance/22943/

Can you monitor your several-year-old dumb Roomba iRobot vacuum cleaner 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 and make weird experiments with them. Welcome to my weekly blog about this project.

This post is a tad bit shorter than usual, as my summer vacation was looming and I had much other fish to fry before that. However, my motivation for this post came from guests visiting us at our home that weekend, so doing the hoovering and stuff was a reasonable thing to do.

Monitor your robot vacuum cleaner with Zabbix

So, I just did put our Roomba to do some initial cleaning. While doing so, I attached the RuuviTag I used in my last post to our Roomba, and of course, did so by using the gorgeously ugly brown tape to secure Ruuvi’s trip.

As RuuviTag has acceleration sensors, it may be possible to record Roomba’s movements by using Ruuvi. Does it work? Of course, it does.

See, it works!

This is so far my most rushed blog entry, as I literally started this experiment in about 30 minutes. The RuuviTag was already configured to my Zabbix, as it’s the same one that is/was measuring if our dog Lily is in her bed.

However, Lily’s presence was detected by utilizing Ruuvi’s temperature sensor. This Roomba experiment is done by checking the readings from RuuviTag acceleration sensors. See, it works!

From the graph we can clearly see 1) the moment I did transfer RuuviTag from Lily’s bed to Roomba and 2) Roomba’s movement.

So, from these graphs, I can then see for how long Roomba was doing its stuff.

But why?

OK, this is a stupid example, but in the real world, there would be more practical applications for this kind of monitoring. For example, monitor something that should NOT be moving (maybe a grill in your backyard or a safe at work), and if it starts moving, immediately suspect that something is wrong. Or, monitor something that should be in the constant move (conveyor belt?) but is not, and alert accordingly.

I have been working at Forcepoint since 2014 and adding more data points to monitoring is still fascinating. — Janne Pikkarainen

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

The post What’s Up, Home? – Record Your Roomba Dance appeared first on Zabbix Blog.

What’s Up, Home? – A Pawesome Bedtime Story

Post Syndicated from Janne Pikkarainen original https://blog.zabbix.com/whats-up-home-a-pawesome-bedtime-story/22779/

Can you monitor your dogs’ sleeping habits 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 and do some weird experiments with them. Welcome to my weekly blog about this project.

Meet Lily, our soon-eleven-years old French bulldog. As she’s getting old, a year or two ago we got her a very nice bed from a Finnish company PAIKKA. The bed is more advanced than the one we humans in this house have; it has a memory foam mattress and some kind of thermal system to keep our furry buddy warm.

Anyway, even though Lily has three or four additional beds all around our house so she can be with us, no matter in what room we are spending our time, Lily really loves this bed and seemingly spends very long periods of time in it without coming out of it meanwhile.

Or, that’s our impression. But what’s the actual usage pattern? Zabbix to the rescue!

Oh hi, RuuviTag, would you like to do some temperature monitoring?

How to monitor Lily’s bed usage? A surveillance camera and something like ZoneMinder would be weird; a motion sensor would not give any meaningful results … but wait, there’s RuuviTag, a nice little environmental monitoring gadget from another Finnish company Ruuvi. It’s just a Bluetooth Low Energy device… a Bluetooth Beacon… I don’t know how to officially call it, but it has reprogrammable firmware, and by default RuuviTag acts as an environmental monitoring device, measuring temperature, humidity, and movement.

Here’s what Ruuvi’s mobile app looks like. For most people, that would be enough. For me, I skip that altogether after I have tried out with it that a RuuviTag works.

“Installing” RuuviTag to Lily’s bed

So, this part is not too hard. Here, let’s put the RuuviTag under Lily’s mattress.

Now that it’s there, it’s time to harvest data from RuuviTag and insert it into Zabbix.

Bridging RuuviTag and Zabbix

For easy reading of data from RuuviTag, there’s Bluewalker with built-in support for parsing Ruuvi’s data. It can format the output in various formats. I used just the traditional text format, made Zabbix read the log file, and made it parse the log file using item preprocessing.

Here’s the log:

Here’s Zabbix master item for the data:

.. and then I just have a bunch of dependent items parsing individual items from the master item.

… with some preprocessing applied.

Does it work?

Yes, it does. It seems that quite soon after Lily enters her bed the mattress temperature will raise a couple of degrees, so from that data we can guess that Lily is in her bed. And, as we can see, she really stays in her bed for several hours without leaving it, especially during the nighttime.

As you can see from the graph, I already did set up some alert thresholds to guess when Lily is in her bed and when she is not. The threshold is very careful on purpose not to get false alerts.
Anyway, I now also see data like this on my ZBX Viewer app and of course on my Zabbix/Grafana dashboard.

Of course, all this is just me being silly with our dog. But imagine the benefits of deploying this kind of “smart mattress” for the elderly or whoever we might need to monitor for their safety. “Hey, grandma Martha usually wakes up early, she’s still in bed even though it’s 11am, is she OK?”, or vice versa, “Hey, grandma Martha did not ever go to her bed last night, what’s up?”.

I recently just heard that a close relative of one of our friends had found their mother from her home after she had been there for one week in bad shape — luckily just ended up in hospital in the end, but imagine what kind of terror that week must have been. A 30 EUR gadget like RuuviTag or a smartwatch might have helped to detect the situation and alert people to help much, much earlier.

Hey watchdog, I am monitoring you too.

I have been working at Forcepoint since 2014 and even our dog must now think I am a monitoring addict. — Janne Pikkarainen

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

The post What’s Up, Home? – A Pawesome Bedtime Story appeared first on Zabbix Blog.