/zabbix-rb

send data to zabbix from ruby

Primary LanguageRubyMIT LicenseMIT

zabbix-rb

          _     _     _                _     
 ______ _| |__ | |__ (_)_  __     _ __| |__  
|_  / _` | '_ \| '_ \| \ \/ /____| '__| '_ \ 
 / / (_| | |_) | |_) | |>  <_____| |  | |_) |
/___\__,_|_.__/|_.__/|_/_/\_\    |_|  |_.__/

I threw this together this afternoon. It’s absulotely untested. I only just corrected a few syntax errors.

usage

easy

Zabbix::Sender::Easy.run(:"com.yammer.cron.brithday_email_job") do |zbx|
  Users.each_with_index do |user, idx|
    HappyBirthday.send if user.birthday?

    ## let zabbix know we're alive every N users, whatever
    zbx.send_heartbeat if idx % N == 0
  end
end

tedious

zbx = Zabbix::Sender.new
zbx.send_start(:"com.yammer.cron.birthday_email_job")

Users.each_with_index do |user, idx|
  HappyBirthday.send if user.birthday? 

  ## let zabbix know we're alive every N users, whatever
  zbx.send_heartbeat if idx % N == 0
end
zbx.send_stop(:"com.yammer.cron.birthday_email_job")

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.

Copyright © 2010 Matthew Knopp. See LICENSE for details.