Jan 132016
 

If you’re a regular reader of my blog, you’ll know that I’ve set up a Motion daemon to monitor one of my IP Cameras.

Recently, I decided to also make a graph of the motion so that I easily track when motion was detected from my IP Camera. This was easily done with the Zabbix agent as I could send data straight into a Zabbix item with zabbix_sender.

Zabbix Configuration

In Zabbix, an item will need to be configured for the motion server to send data to. This item could be created on any host, but I’ll create it on my Motion server host.

If you’re going to apply this monitoring to many hosts then this would be the time to create the item in a template instead of on a host.

The item should be created with the following settings:

My Motion Tracking Item Configuration

My Motion Tracking Item Configuration


Type: Zabbix trapper
Key: <Set a key name for your item. Choose something that you'll remember>
Type of information: Numeric (unsigned)
Data type: Decimal

You can also create your own application for this if you want. I’ve created one called Motion Detection

Once the item is created, you’re ready to set up Motion to send data to Zabbix

Motion Configuration

You’ll need the Zabbix agent so that Motion can send data into the item that we created in Zabbix
This can be installed from your distributions repositories, or you can download the binaries from http://www.zabbix.com/download.php.
If you download the binaries, copy zabbix_sender to the /bin directory, or alternatively any other directory in your $PATH environment variable.

Once you have the zabbix_sender binary, you can configure motion to run it every time motion is detected.

In the motion.conf file, we’ll need to modify the on_event_start parameter to add in our zabbix_sender command.
In this example, I’ve set up Motion to send the number of changed pixels to Zabbix so I can track how much motion is detected each time it’s detected.

on_event_start zabbix_sender -z [MY ZABBIX HOST] -s [HOST THE ITEM IS ON] -k [YOUR ITEM] -o %D

Save the file, and restart motion. Once it’s restarted, you should get some data in Zabbix whenever motion detects motion.

You should be able to see the data under Latest Data for the item in Zabbix. My item looks like this after I triggered the motion detection:
Item Shows Motion Detected

I’ve also created a screen with this item and a stream of the video so that I can see history, and what’s going on right now. I’ve only set up the motion tracking for one of my cameras in this screenshot.
My Zabbix Security Screen

Share

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)