Skip navigation
Currently Being Moderated

Tweet out Events to Twitter

VERSION 3  Click to view document history
Created on: Apr 30, 2010 4:10 PM by Stacy Uden - Last Modified:  Sep 8, 2010 3:46 PM by Stacy Uden

UPDATE (8 Sept 2010) -- This script no longer functions as desired, as Twitter disabled basic auth and requires OAuth authentication.


Here is a handy & simple way to convert events into tweets with an Event Command and a bash script. This uses the Twitter API and doen't require anything other than bash and curl.


First, set up a dedicated, private twitter account. A private account is recommended as to not share your infrastructure status to the world, but your preferences may vary. Using your own personal account, follow this new account (and of course from the new private account, you have to "accept" the follow request).


Second, put this script somewhere convenient like $ZENHOME/scripts. Name it "" and set it to be owned by the "zenoss" user and executable.


---Start script



# This script takes in a message and sends it out as a Twitter tweet.




$curl --basic --user "$user:$pass" --data-ascii \
"status=`echo $@`" \
"" \
>& /dev/null


exit 0

---End Script


Third, set up an Event Command, setting the filters to taste. The command would be:


$$ZENHOME/scripts/ ${evt/device} -- ${evt/summary}

and the clear command might be

$$ZENHOME/scripts/ CLEAR ${evt/device} -- ${evt/summary}


Of course you can edit this command with whatever parameters you prefer, but beware of the 140 character Twitter limit.



Now, if you have your cell phone linked to your personal twitter account, you can have another way to have events sent to you via SMS. It is also a nice way to send events to multiple people without taxing the Zenoss main server. Have your co-workers follow the new private account, and approve their requests.

Comments (2)