Skip to content

Commit

Permalink
[refactor] use human names for commands
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisLundquist committed Oct 7, 2013
1 parent 4085ad9 commit add22b0
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/nagiosharder.rb
Expand Up @@ -58,7 +58,7 @@ def post_command(body)

def acknowledge_service(host, service, comment)
request = {
:cmd_typ => 34,
:cmd_typ => COMMANDS[:acknowledge_service_problem],
:cmd_mod => 2,
:com_author => @user,
:com_data => comment,
Expand All @@ -74,7 +74,7 @@ def acknowledge_service(host, service, comment)

def acknowledge_host(host, comment)
request = {
:cmd_typ => 33,
:cmd_typ => COMMANDS[:acknowledge_host_problem],
:cmd_mod => 2,
:com_author => @user,
:com_data => comment,
Expand All @@ -89,7 +89,7 @@ def acknowledge_host(host, comment)

def unacknowledge_service(host, service)
request = {
:cmd_typ => 52,
:cmd_typ => COMMANDS[:remove_service_acknowledgement],
:cmd_mod => 2,
:host => host,
:service => service
Expand All @@ -101,7 +101,7 @@ def unacknowledge_service(host, service)
def schedule_service_downtime(host, service, options = {})
request = {
:cmd_mod => 2,
:cmd_typ => 56,
:cmd_typ => COMMANDS[:schedule_service_downtime],
:com_author => options[:author] || "#{@user} via nagiosharder",
:com_data => options[:comment] || 'scheduled downtime by nagiosharder',
:host => host,
Expand Down Expand Up @@ -130,7 +130,7 @@ def schedule_service_downtime(host, service, options = {})
def schedule_host_downtime(host, options = {})
request = {
:cmd_mod => 2,
:cmd_typ => 55,
:cmd_typ => COMMANDS[:schedule_host_downtime],
:com_author => options[:author] || "#{@user} via nagiosharder",
:com_data => options[:comment] || 'scheduled downtime by nagiosharder',
:host => host,
Expand Down Expand Up @@ -184,7 +184,7 @@ def schedule_service_check(host, service)
:host => host,
:service => service,
:force_check => true,
:cmd_typ => 7,
:cmd_typ => COMMANDS[:schedule_service_check],
:cmd_mod => 2
}
post_command(request)
Expand Down Expand Up @@ -296,10 +296,10 @@ def disable_service_notifications(host, service, options = {})
}

if service
request[:cmd_typ] = 23
request[:cmd_typ] = COMMANDS[:disable_service_notifications]
request[:service] = service
else
request[:cmd_typ] = 29
request[:cmd_typ] = COMMANDS[:disable_host_service_checks]
request[:ahas] = true
end

Expand All @@ -314,10 +314,10 @@ def enable_service_notifications(host, service, options = {})
}

if service
request[:cmd_typ] = 22
request[:cmd_typ] = COMMANDS[:enable_service_notifications]
request[:service] = service
else
request[:cmd_typ] = 28
request[:cmd_typ] = COMMANDS[:enable_host_service_notifications]
request[:ahas] = true
end

Expand Down

0 comments on commit add22b0

Please sign in to comment.