Zabbix Discovery of guest

From Linux-VServer

Jump to: navigation, search

Zabbix and Vserver guest discovery

Zabbix 2.4+ has an discovery system for ressources like disks and cpu. You can use it to detect running guest and monitor some 'stuff' like this:

  • 1/ on the agentd configuration add


And restart the agent

  • 2/ create the script /pathto/my/script/
               echo -n '{';
               echo -n '"data":['
               for n in $(ls -d /proc/virtual/[0-9]*); do
                       guest=$(vserver-info "$xid" ID);
                       name=$(vserver-info "$guest" NAME);
                       if [ "$I" != "0" ]; then echo -n ','; fi   
                       echo -n "{\"{#GUESTNAME}\":\"$name\",\"{#GUESTCTX}\":\"$xid\"}";
               echo -n "]}";

make it executable : chmod 755 /pathto/my/script/;

  • 3/ add a discovery rule on a zabbix template using vserver.discovery as the key, then {#GUESTNAME} and {#GUESTCTX} as you see fit in your prototype.

Enjoy !

Ghislain. AQUEOS.

Personal tools