Skip to content

33Across/zabbix-rb

 
 

Repository files navigation

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")

other

zbx = Zabbix::Sender.new(config_file: nil) # uses the default config file on the system

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.

Development notes

  • Updated to require 2.3.8+ (currently supported branch minus one)

Dependencies

  • Requires juwelier (tested with 2.4.9) … once that’s installed, the ‘check_dependencies` rake task will prompt for others

Test configuration

  • edit ‘test/zabbix_agentd.conf` and set `Server=` to your actual server if you want the tests to pass

Known issues

  • does not notify for Successful submissions that are Failed by the server

“‘{“response”:“success”,“info”:“processed: 0; failed: 1; total: 1; seconds spent: 0.000019”}“`

  • config reads lots of things, but doesn’t expose or utilize them (bind IP, etc.)

  • tests are local environment specific

  • CI stuff is local-installation dependent.

Copyright © 2010 Matthew Knopp. See LICENSE for details.

About

send data to zabbix from ruby

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%