Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow to filter optionally by hostgroup #29

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,14 @@ Or just muted services, sorted desc by duration:
:sort_option => :state_duration,
)

Or get the details for a single service group:
Or get the details for a single service group, default is 'all':

site.service_status(:group => "AWESOME")

Or filter details for hostgroup, default is 'all':

site.service_status(:hostgroup => "apiservices")


Schedule a host to have services checks run again right now:

Expand Down
4 changes: 4 additions & 0 deletions lib/nagiosharder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ def service_status(options = {})

if @version == 3
params['servicegroup'] = options[:group] || 'all'
params['hostgroup'] = options[:hostgroup] || 'all'
params['style'] = 'detail'
params['embedded'] = '1'
params['noheader'] = '1'
Expand All @@ -254,6 +255,9 @@ def service_status(options = {})
if options[:group]
params['servicegroup'] = options[:group]
params['style'] = 'detail'
elsif options[:hostgroup]
params[:hostgroup] = options[:hostgroup]
params['style'] = 'detail'
else
params['host'] = 'all'
end
Expand Down
2 changes: 1 addition & 1 deletion nagiosharder.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ $:.push File.expand_path('../lib', __FILE__)

Gem::Specification.new do |s|
s.name = 'nagiosharder'
s.version = '0.5.0'
s.version = '0.5.1'
s.date = Time.now.strftime('%Y-%m-%d')
s.platform = Gem::Platform::RUBY
s.authors = ['Josh Nichols', 'Jesse Newland', 'Travis Graham']
Expand Down