TransWikia.com

Creating a Zabbix item on the zabbix server to ping agentless host machine where vm (with agent) runs on

Server Fault Asked by Ankur22 on December 9, 2021

We’re working with Zabbix (2.4.7), i’m going to call this the zabbix server. The zabbix server has many machines which it is monitoring. The machines have zabbix agent installed on them.

The machines are actually VMs. We would like to ping the host machine that the vm is running on. The host machines that the vms are running on do not have the zabbix agent installed and we do not have access to those host machines.

The Zabbix server can ping the vms on address 192.168.15.10.
The host machine where the vm runs on has an ip address of 192.168.15.5.
The third quadrant of the ip changes per vm but the vm is always on .10 address and the host is always on the .5 address.

We would like to create a trigger to say, if the host is pingable but the vm is not, then alert.

I can create the item to ping the vm, but how do i create the item to ping the host? I’d like to add this into the template not add an item per host as we have many vms.

EDIT

Here’s a clearer description:

Image showing zabbix server connected to two vms but not the hosts that the vms run in

  1. We have an auto discovery rule setup to find new vms. So zabbix server has auto detected the vms 192.168.15.10 and 192.168.16.10.
  2. Zabbix has no knowledge of the host machines 192.168.15.5 and 192.168.16.5 since zabbix agent is not installed on the host machine.
  3. New vms are added to zabbix, and the correct templates are attached to the new vms.
  4. We can ping the vms to ensure that it is up.
  5. Therefore there is an entry for the two hosts in zabbix.

How do we now go about creating a template that can easily be added to each new vm during auto discovery, where the template has an item that pings the host machine on the .5 address, an item that pings the vm on .10 address, and a trigger to say “if host is pingable and vm is not pingable, then trigger an alert”?

As far as i can tell there’s no way of setting up a zabbix item to:

  1. Use the vm ip address
  2. remove .10
  3. Add .5
  4. Now use this new address in the item to ping it

One Answer

Apparently host prototypes can help with this, but I couldn't get my head around host prototypes, so the approach taken was to use external checks:

  1. Create a bash script that zabbix can run against all the vms
  2. Bash script takes the vm ip address as an argument
  3. Bash script alters the ip
  4. Ping the altered ip
  5. Results recorded as an item
  6. There is already a ping item against the vm
  7. Trigger created to check the new item and existing ping item to capture and alert when host is pingable and vm is not

Answered by Ankur22 on December 9, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP