Hello everyone.
I'm looking for suggestions about how best to send an alert via a curl command. For reference, I'm using curl to send a notification to a Cachet server.
I thought I had it right with just a command, but I'm not sure.
I save the Cachet Item ID as a Host Inventory Item (Serial number A, which I think is referenced by {HOST.SERIALNO.A1} ( https://www.zabbix.com/documentation...ed_by_location ). I have this set as the Default Subject and Recovery Subject. The Default Message is 4, and the Recovery Message is 1.
Meanwhile, I've placed a script in /usr/lib/zabbix/alertscripts called notifyZabbix. The contents are:
I went Admin -> Media Types and created a Media called Zabbix_Notify with a type of Script and the Script name of notifyZabbix (set to enabled).
I gave a user the media of Zabbix_Notify.
The action logs show Zabbix_Issue executed with subject and message as expected, but the Cachet server doesn't seem to be updating. I'm wondering if Zabbix is properly executing the script, but I'm not sure how to check.
Any thoughts?
I'm looking for suggestions about how best to send an alert via a curl command. For reference, I'm using curl to send a notification to a Cachet server.
I thought I had it right with just a command, but I'm not sure.
I save the Cachet Item ID as a Host Inventory Item (Serial number A, which I think is referenced by {HOST.SERIALNO.A1} ( https://www.zabbix.com/documentation...ed_by_location ). I have this set as the Default Subject and Recovery Subject. The Default Message is 4, and the Recovery Message is 1.
Meanwhile, I've placed a script in /usr/lib/zabbix/alertscripts called notifyZabbix. The contents are:
Code:
#!/bin/bash
to=$1
compID=$2
statusID=$3
# Comment this next line out for Production
#echo "curl -H 'Content-Type: application/json' -H 'X-Cachet-Token: anapitoken' http://theip/api/components/$compID -d '{"status":$statusID}' -X PUT"
# Uncomment this next line for Production
curl -H 'Content-Type: application/json' -H 'X-Cachet-Token: anapitoken' http://theip/api/components/"$compID" -d "{'status':$statusID}" -X PUT
I gave a user the media of Zabbix_Notify.
The action logs show Zabbix_Issue executed with subject and message as expected, but the Cachet server doesn't seem to be updating. I'm wondering if Zabbix is properly executing the script, but I'm not sure how to check.
Any thoughts?
Comment