Aug 172016

At my job, I’m monitoring ~300 workstations that may or may not be on at any one time.
The difficulties that this presents is that some PCs will alert that they have been down for a period of time, when in fact they just haven’t been used in a while because they just haven’t been needed.

In order to be able to check whether the PC is actually down, or just hasn’t been turned on in a while, I implemented a script in Zabbix so that I could wake up PCs from within the Zabbix interface. This was done using the ether-wake tool that’s available in CentOS.
However, there is a disadvantage to using Zabbix to wake computers up. The MAC Address of the computers is not available to scripts, even though the MAC Addresses are recorded by Zabbix for the inventory.

The workaround for that issue is to dump the MAC Addresses and Hostnames to a file so that ether-wake is able to read the hostname and convert it to the correct MAC address.
This was done with a cronjob that just runs the following command:

mysql -e "select macaddress_a,name from host_inventory WHERE name IS NOT NULL AND name <> '' AND macaddress_a <> ''" zabbix > /etc/ethers

The command above will dump all the MAC addresses and hostnames from the Zabbix database into /etc/ethers.

This then allows me to create a script item in Zabbix that just runs the command /usr/sbin/ether-wake {HOST.NAME} to send the magic packet to the correct computer and wake it up!


 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>



This site uses Akismet to reduce spam. Learn how your comment data is processed.