Tuesday, January 12, 2016

Autoregistration of Raspberries/Servers with the same hostname on Zabbix

Possible project

  • At least, 200x Raspberries in different locations 
  • We can have two or three Raspberries in the same location.
  • Firewall in all locations
  • No starting date known
  • Instalallation from the same image so the hostname is the same in all of them.
  • Nobody can log in


 How to monitor those Raspberries with Zabbix?


Zabbix (2.2) uses the hostname as key field. It's not possible to repeat that hostname in the server so, how to proceed?


This is my workflow:

In zabbix-agent:
    • Configure agent as active, disable passive (firewall installed, do you remember it?)
    • I need to create a random hostname but i need to identify each Raspberry in the same/different locations. So i created this python script to get a hostname (i chose publicip-macaddress name):

I had to change the ":" in the macaddr to "_" because ":" is not valid char for the hostname field.

In the agent config you will need to run this script, two keys here:
You will need to put a Meta for the autoregister:
The agent is ready. 

For the server you will need to clone a OS Linux template to convert it as Active. You will need to change the Type item by item in the cloned template:

Now the new autoregistration rule.

Create a new Action and:


That's all.