module Nagiosharder module Filters # irb> Nagiosharder::Filters.value(:host) # => 0 # irb> Nagiosharder::Filters.value(:host, :state_acknowledged) # => 4 # irb> Nagiosharder::Filters.value(:host, :state_acknowledged, :checks_disabled) # => 20 def self.value(type, *args) args.each.inject(0) do |i, arg| begin i += const_get("#{type}_#{arg}".upcase) rescue NameError i end end end #/********************* EXTENDED INFO CGI DISPLAY TYPES *********************/ DISPLAY_PROCESS_INFO=0 DISPLAY_HOST_INFO=1 DISPLAY_SERVICE_INFO=2 DISPLAY_COMMENTS=3 DISPLAY_PERFORMANCE=4 DISPLAY_HOSTGROUP_INFO=5 DISPLAY_DOWNTIME=6 DISPLAY_SCHEDULING_QUEUE=7 DISPLAY_SERVICEGROUP_INFO=8 #/************************ COMMAND CGI COMMAND MODES *************************/ CMDMODE_NONE=0 CMDMODE_REQUEST=1 CMDMODE_COMMIT=2 #/******************** HOST AND SERVICE NOTIFICATION TYPES ******************/ NOTIFICATION_ALL=0 #/* all service and host notifications */ NOTIFICATION_SERVICE_ALL=1 #/* all types of service notifications */ NOTIFICATION_HOST_ALL=2 #/* all types of host notifications */ NOTIFICATION_SERVICE_WARNING=4 NOTIFICATION_SERVICE_UNKNOWN=8 NOTIFICATION_SERVICE_CRITICAL=16 NOTIFICATION_SERVICE_RECOVERY=32 NOTIFICATION_HOST_DOWN=64 NOTIFICATION_HOST_UNREACHABLE=128 NOTIFICATION_HOST_RECOVERY=256 NOTIFICATION_SERVICE_ACK=512 NOTIFICATION_HOST_ACK=1024 NOTIFICATION_SERVICE_FLAP=2048 NOTIFICATION_HOST_FLAP=4096 NOTIFICATION_SERVICE_CUSTOM=8192 NOTIFICATION_HOST_CUSTOM=16384 #/********************** HOST AND SERVICE STATE TYPES **********************/ HISTORY_STATE_ALL=0 HISTORY_STATE_SOFT=1 HISTORY_STATE_HARD=2 #/********************** HOST AND SERVICE ALERT TYPES **********************/ HISTORY_ALL=0 #/* all service and host alert */ HISTORY_SERVICE_ALL=1 #/* all types of service alerts */ HISTORY_HOST_ALL=2 #/* all types of host alerts */ HISTORY_SERVICE_WARNING=4 HISTORY_SERVICE_UNKNOWN=8 HISTORY_SERVICE_CRITICAL=16 HISTORY_SERVICE_RECOVERY=32 HISTORY_HOST_DOWN=64 HISTORY_HOST_UNREACHABLE=128 HISTORY_HOST_RECOVERY=256 #/****************************** SORT TYPES *******************************/ SORT_NONE=0 SORT_ASCENDING=1 SORT_DESCENDING=2 #/***************************** SORT OPTIONS ******************************/ SORT_NOTHING=0 SORT_HOSTNAME=1 SORT_SERVICENAME=2 SORT_SERVICESTATUS=3 SORT_LASTCHECKTIME=4 SORT_CURRENTATTEMPT=5 SORT_STATEDURATION=6 SORT_NEXTCHECKTIME=7 SORT_HOSTSTATUS=8 SORT_HOSTURGENCY=9 #/****************** HOST AND SERVICE FILTER PROPERTIES *******************/ HOST_SCHEDULED_DOWNTIME=1 HOST_NO_SCHEDULED_DOWNTIME=2 HOST_STATE_ACKNOWLEDGED=4 HOST_STATE_UNACKNOWLEDGED=8 HOST_CHECKS_DISABLED=16 HOST_CHECKS_ENABLED=32 HOST_EVENT_HANDLER_DISABLED=64 HOST_EVENT_HANDLER_ENABLED=128 HOST_FLAP_DETECTION_DISABLED=256 HOST_FLAP_DETECTION_ENABLED=512 HOST_IS_FLAPPING=1024 HOST_IS_NOT_FLAPPING=2048 HOST_NOTIFICATIONS_DISABLED=4096 HOST_NOTIFICATIONS_ENABLED=8192 HOST_PASSIVE_CHECKS_DISABLED=16384 HOST_PASSIVE_CHECKS_ENABLED=32768 HOST_PASSIVE_CHECK=65536 HOST_ACTIVE_CHECK=131072 HOST_HARD_STATE=262144 HOST_SOFT_STATE=524288 SERVICE_SCHEDULED_DOWNTIME=1 SERVICE_NO_SCHEDULED_DOWNTIME=2 SERVICE_STATE_ACKNOWLEDGED=4 SERVICE_STATE_UNACKNOWLEDGED=8 SERVICE_CHECKS_DISABLED=16 SERVICE_CHECKS_ENABLED=32 SERVICE_EVENT_HANDLER_DISABLED=64 SERVICE_EVENT_HANDLER_ENABLED=128 SERVICE_FLAP_DETECTION_ENABLED=256 SERVICE_FLAP_DETECTION_DISABLED=512 SERVICE_IS_FLAPPING=1024 SERVICE_IS_NOT_FLAPPING=2048 SERVICE_NOTIFICATIONS_DISABLED=4096 SERVICE_NOTIFICATIONS_ENABLED=8192 SERVICE_PASSIVE_CHECKS_DISABLED=16384 SERVICE_PASSIVE_CHECKS_ENABLED=32768 SERVICE_PASSIVE_CHECK=65536 SERVICE_ACTIVE_CHECK=131072 SERVICE_HARD_STATE=262144 SERVICE_SOFT_STATE=524288 end end