Skip to content

Instantly share code, notes, and snippets.

@gcanales75
Created July 28, 2016 20:22
Show Gist options
  • Select an option

  • Save gcanales75/04a163afb35b2a1a54a23ce8be20e3a9 to your computer and use it in GitHub Desktop.

Select an option

Save gcanales75/04a163afb35b2a1a54a23ce8be20e3a9 to your computer and use it in GitHub Desktop.
Envia notificaciones de Alarmas de vCenter a Slack
#! /bin/sh
curl -X POST -H 'Content-type: application/json' \
--data '{ "text":"'$1' '$2'" }' \
https://hooks.slack.com/services/T0xxxxxxx/xxxxxxxxx/1pRj3eXqJtFy74WHK4xxxxxx
@gcanales75
Copy link
Author

Es necesario pasar las variables que deseas ver en la notificacion a Slack. La linea 4 define que 2 variables pueden se pasadas al script. La lista completa de variables que se pueden utilizar esta en:

https://pubs.vmware.com/vsphere-60/topic/com.vmware.vsphere.monitoring.doc/GUID-B8DF4E10-89E3-409D-9111-AE405B7E5D2E_copy.html

En los settings de la alarma, pestaña "Actions", debes agregar la ruta del script y los parametros (ej. "/scripts/notificaciones.sh {alarmName} {targetName}". "Action" debe ser "Run command".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment