{"id":17680279,"url":"https://github.com/kostya/nagios_helper","last_synced_at":"2025-05-12T22:55:36.021Z","repository":{"id":4599665,"uuid":"5742548","full_name":"kostya/nagios_helper","owner":"kostya","description":"Gem for writing, testing, executing Nagios checks inside Rails application. Checks running throught http or script.","archived":false,"fork":false,"pushed_at":"2014-08-22T20:03:22.000Z","size":304,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-12T22:55:30.835Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kostya.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-09-09T23:02:37.000Z","updated_at":"2023-01-16T13:57:58.000Z","dependencies_parsed_at":"2022-08-27T13:33:22.189Z","dependency_job_id":null,"html_url":"https://github.com/kostya/nagios_helper","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kostya%2Fnagios_helper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kostya%2Fnagios_helper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kostya%2Fnagios_helper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kostya%2Fnagios_helper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kostya","download_url":"https://codeload.github.com/kostya/nagios_helper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253837400,"owners_count":21971982,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-24T09:06:25.241Z","updated_at":"2025-05-12T22:55:35.989Z","avatar_url":"https://github.com/kostya.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"NagiosHelper\n============\n\nGem for writing, testing, executing Nagios checks inside Rails application.\nChecks running throught http or script.\n\n```\ngem 'nagios_helper', :require =\u003e 'nagios'\n```\n\n    $ rails generate nagios:check some\n\nCheck example:\n--------------\n\napp/nagios/some.rb\n\n```ruby\nclass Nagios::Some \u003c Nagios::Check\n  params :x\n\n  def execute\n    count = User.count + x.to_i\n\n    warn \"hmmm\" if count \u003c 10\n    crit \"ouch\" if count \u003c 5\n\n    ok \"good #{count}\"\n  end\n\nend\n```\n\nRun:\n\n    $ RAILS_ENV=production bundle exec nagios_check some x 1\n\n### Nagios Check Initilizers:\nAll files in app/nagios/initializers will auto loads.\n\nServer:\n-------\n\n### Inside rails server\n\nCreate controller: app/controllers/nagios_controller.rb\n\n```ruby\nclass NagiosController \u003c ApplicationController\n  http_basic_authenticate_with :name =\u003e \"nagios\", :password =\u003e \"password\"\n\n  def check\n    status, message = Nagios::Runner.check(params)\n    render :text =\u003e \"#{status}|#{message}\", :layout =\u003e false\n  end\n\nend\n```\n\n    $ curl http://nagios:password@localhost:3000/nagios/check?method=some\u0026x=1\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkostya%2Fnagios_helper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkostya%2Fnagios_helper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkostya%2Fnagios_helper/lists"}