|
mac geekeryGet your geek on. |
Generating an RSS Feed of Your Own EventsMarch 30, 2006 - 4:00am
QuestionHow could one setup an RSS feed of various network events? Ideally the feed would: AnswerYou’ll want to write scripts to gather the information you need, then log that information, and then convert that log to RSS. Happily, most of this is already done for you. We can use one of the various local facilities for this purpose. They range from local7.* /var/log/events Then HUP syslogd to activate the new log: sudo killall -HUP syslogd Test with the following command, which should put a log line in /var/log/events: logger -p local7.notice foo Now you’ll need to setup a script like the following to do the testing, logging on failures:
#!/bin/bash
if ! ping -o bob.local
then
logger -p local7.notice Could not contact bob.local
fi
Set that to run periodically with cron or launchd or whatnot. Then, at some interval, run the log2rss.pl script we covered previously on the /var/log/events log and then publish and subscribe to that RSS feed (either locally, or by saving to someone’s Sites folder and using Personal Web Sharing). Voila, a feed of system events that you control. About Adam Knight |
|
||||