Is there a way to get Openstack to run a script right after it creates or deletes a VM(both Windows and Linux)? This script has to be run on the host itself, not on the VM or guest it just created.
The purpose of this is to add/remove the host from our Nagios server automatically. Right now we are adding/removing the hosts on Nagios manually but this is not ideal since we create/delete VMs multiple times a day.
We can easily add a host on Nagios using the following API call:
curl -XPOST "http://10.25.5.2/nagiosxi/api/v1/config/host?apikey=5goacg8s&pretty=1" -d "host_name=openstack_vm_1&address=192.168.10.1&use=xiwizard_generic_host&force=1&applyconfig=1
If I can get Openstack to run the above command, replacing just the hostname and address for each VM it creates, that solves my problem. I can use something similar to remove the host from Nagios as well.