Interface Service

Service objects describe network services and how they should be checked by Icinga 2.

Best Practice

Rather than creating a Service object for a specific host it is usually easier to just create a Service template and use the apply keyword to assign the service to a number of hosts. Check the apply chapter for details.

Example:

object Service "uptime" {
host_name = "localhost"

display_name = "localhost Uptime"

check_command = "snmp"

vars.snmp_community = "public"
vars.snmp_oid = "DISMAN-EVENT-MIB::sysUpTimeInstance"

check_interval = 60s
retry_interval = 15s

groups = [ "all-services", "snmp" ]
}
interface Service {
    __name: string;
    acknowledgement: bigint;
    acknowledgement_expiry: number;
    acknowledgement_last_change: number;
    action_url: string;
    active: boolean;
    check_attempt: bigint;
    check_command: string;
    check_interval: number;
    check_period: string;
    check_timeout: Value;
    command_endpoint: string;
    display_name: string;
    downtime_depth: bigint;
    enable_active_checks: boolean;
    enable_event_handler: boolean;
    enable_flapping: boolean;
    enable_notifications: boolean;
    enable_passive_checks: boolean;
    enable_perfdata: boolean;
    event_command: string;
    executions: Dictionary;
    flapping: boolean;
    flapping_current: number;
    flapping_ignore_states: string[];
    flapping_last_change: number;
    flapping_threshold: number;
    flapping_threshold_high: number;
    flapping_threshold_low: number;
    force_next_check: boolean;
    force_next_notification: boolean;
    groups: string;
    ha_mode: HAMode;
    handled: boolean;
    host?: Host;
    host_name: string;
    icon_image: string;
    icon_image_alt: string;
    last_check: number;
    last_check_result: CheckResult;
    last_hard_state: ServiceState;
    last_hard_state_change: number;
    last_reachable: boolean;
    last_state: ServiceState;
    last_state_change: number;
    last_state_critical: number;
    last_state_ok: number;
    last_state_type: StateType;
    last_state_unknown: number;
    last_state_unreachable: number;
    last_state_warning: number;
    max_check_attempts: bigint;
    next_check: number;
    next_update: number;
    notes: string;
    notes_url: string;
    original_attributes: Record<string, any>;
    package: string;
    paused: boolean;
    previous_state_change: number;
    problem: boolean;
    retry_interval: number;
    severity: bigint;
    source_location: SourceLocation;
    state: ServiceState;
    state_type: StateType;
    templates: string[];
    vars: Record<string, any>;
    version: number;
    volatile: boolean;
    zone: string;
}

Hierarchy

  • Checkable
    • Service

Properties

__name: string
acknowledgement: bigint
acknowledgement_expiry: number
acknowledgement_last_change: number
action_url: string
active: boolean
check_attempt: bigint
check_interval: number

The check interval (in seconds). This interval is used for checks when the service is in a HARD state. Defaults to 5m.

check_timeout: Value

Check command timeout in seconds. Overrides the CheckCommand's timeout attribute.

display_name: string

A short description of the service.

downtime_depth: bigint
enable_active_checks: boolean
enable_event_handler: boolean
enable_flapping: boolean
enable_notifications: boolean
enable_passive_checks: boolean
enable_perfdata: boolean
executions: Dictionary
flapping: boolean
flapping_current: number
flapping_ignore_states: string[]
flapping_last_change: number
flapping_threshold: number

Deprecated

flapping_threshold_high: number
flapping_threshold_low: number
force_next_check: boolean
force_next_notification: boolean
groups: string

The service groups this service belongs to.

ha_mode: HAMode
handled: boolean
host_name: string

The host this service belongs to. There must be a Host object with that name.

icon_image: string
icon_image_alt: string
last_check: number
last_check_result: CheckResult
last_hard_state: ServiceState

The last hard state (0 = OK, 1 = WARNING, 2 = CRITICAL, 3 = UNKNOWN).

last_hard_state_change: number
last_reachable: boolean
last_state: ServiceState

The previous state (0 = OK, 1 = WARNING, 2 = CRITICAL, 3 = UNKNOWN).

last_state_change: number
last_state_critical: number

When the last CRITICAL state occurred (as a UNIX timestamp).

last_state_ok: number

When the last OK state occurred (as a UNIX timestamp).

last_state_type: StateType
last_state_unknown: number

When the last UNKNOWN state occurred (as a UNIX timestamp).

last_state_unreachable: number
last_state_warning: number

When the last WARNING state occurred (as a UNIX timestamp).

max_check_attempts: bigint

The number of times a service is re-checked before changing into a hard state. Defaults to 3.

next_check: number
next_update: number
notes: string
notes_url: string
original_attributes: Record<string, any>
package: string

for example _etc

paused: boolean
previous_state_change: number
problem: boolean
retry_interval: number

This interval is used for checks when the service is in a SOFT state. Defaults to 1m. Note: This does not affect the scheduling after a passive check result.

severity: bigint
source_location: SourceLocation

The current state (0 = OK, 1 = WARNING, 2 = CRITICAL, 3 = UNKNOWN).

state_type: StateType
templates: string[]
vars: Record<string, any>
version: number
volatile: boolean
zone: string

navigation

check_command: string

The name of the check command.

check_period: string

The name of a time period which determines when this service should be checked. Not set by default (effectively 24x7).

command_endpoint: string
event_command: string
host?: Host