Nagios

序論


接触 Timeperiods

管理者はしばしば少ない方が良い、ポケットベル、携帯電話呼び出しなどに答える責任を負わなければなりません。 だれも、午前4時に障害を修理するために起こされるのが好きではありません。 しかし、夜中に障害を直すより翌朝9時に立ち寄って不幸なボスの復讐に会う方が大体良いものです。

警報に分担して対応できる技術者のチームを持つ幸運な管理者のために、呼び出しローテーションがしばしば設定されます。 複数の管理者が、週末、週日の夜、休日などに通知を受け取りながら、しばしば交替します。

どうしたら大抵の呼び出し通知ローテーションを行うことのできる方法を timeperiod 定義で作るかをお見せします。 これらの定義は人の問題を扱えませんが(病欠中、シフト交代中、川の中に投げられポケベルの管理者の呼出)、大部分を扱う基本構造の設定は可能です。

シナリオ1: 休日と週末


2人の管理者 - ジョンとボブ - 彼らがNagiosの警報の責任者です。 休日を除いて、ジョンは、平日(24時間)にすべての通知を受け取ります。 ボブは週末、休日の間、通知に対応します。 幸運なボブ。 ここに、timeperiodsを使ってどうこのタイプのローテーションを定義するかがあります。…

まず最初に3つのtimeperiods 休日、平日、および週末の時間範囲を定義します。

define timeperiod{
    name                weekdays
    timeperiod_name     weekdays
    monday              00:00-24:00
    tuesday             00:00-24:00
    wednesday           00:00-24:00
    thursday            00:00-24:00
    friday              00:00-24:00
}

define timeperiod{
    name                weekends
    timeperiod_name     weekends
    saturday            00:00-24:00
    sunday              00:00-24:00
}

define timeperiod{
    name                holidays
    timeperiod_name     holidays
    january 1           00:00-24:00 ; New Year's Day
    2008-03-23          00:00-24:00 ; Easter (2008)
    2009-04-12          00:00-24:00 ; Easter (2009)
    monday -1 may       00:00-24:00 ; Memorial Day (Last Monday in May)
    july 4              00:00-24:00 ; Independence Day
    monday 1 september  00:00-24:00 ; Labor Day (1st Monday in September)
    thursday 4 november 00:00-24:00 ; Thanksgiving (4th Thursday in November)
    december 25         00:00-24:00 ; Christmas
    december 31         17:00-24:00 ; New Year's Eve (5pm onwards)
}

次に、ジョンの呼び出し時間定義(timeperiod)では、平日を含み、上での休日timeperiodで定義された平日の日付/時間は除いています。

define timeperiod{
    timeperiod_name     john-oncall
    use                 weekdays    ; Include weekdays
    exclude             holidays    ; Exclude holiday dates/times defined elsewhere
}

現在、ジョンの連絡先定義中のこのtimeperiodを参照することができます

define contact{
    contact_name                john
    ...
    host_notification_period    john-oncall
    service_notification_period john-oncall
}

新しいボブの呼び出し時間を定義します。それには、週末、上での休暇timepriod 内の日付/時間も含んでいます。

define timeperiod{
    timeperiod_name     bob-oncall
    use                 weekends,holidays ; Include weekend and holiday date/times
    }

今、ボブの連絡先定義中のtimeperiodを参照することができます

define contact{
    contact_name                bob
    ...
    host_notification_period    bob-oncall
    service_notification_period bob-oncall
}

シナリオ2: 交代の日


このシナリオでは、ジョンとボブは、それが週末か平日、または休日にかかわらず一日おきに警報の対応を交替します。

ジョンが通知を受け取れる時間、timeperiodを定義します。 本日の日付が2007年8月1日であり、ジョンが今日からの警報に対応するとの仮定での定義はこの様になります:

define timeperiod{
    timeperiod_name     john-oncall
    2007-08-01 / 2      00:00-24:00 ; Every two days, starting August 1st, 2007
}

今度は、ボブが通知を受けるtimeperiodを定義します。 ジョンが対応できない日にボブが通知を受け取る。そうすると彼の最初の呼び出し日は明日(2007年8月2日)に始まります。

define timeperiod{
    timeperiod_name     bob-oncall
    2007-08-02 / 2      00:00-24:00 ; Every two days, starting August 2nd, 2007
}

今、ジョンとボブの連絡先定義中ののtimeperiod定義を参照にする必要があります。

define contact{
    contact_name                john
    ...
    host_notification_period    john-oncall
    service_notification_period john-oncall
}

シナリオ3: 交代の週


このシナリオでは、ジョンとボブは、隔週に警報の対応を交替します。 ジョンは日曜日から土曜日の間、1週間、警報に対応します。そして、ボブは次の7日間、警報に対応します。 これは永遠に続きます。

ジョンが通知を受け取れる時間、timeperiodを定義します。 本日の日付が2007年7月29日日曜日であり、ジョンが今週通知に対応する(今日から)との仮定での定義はこの様になります。:

define contact{
    contact_name                bob
    ...
    host_notification_period    bob-oncall
    service_notification_period bob-oncall
}

今度は、ボブが通知を受け取るべきである時の間、timeperiodを定義します。 ジョンが対応できない週にボブが通知を受け取る。そうすると彼の最初に呼び出し日は次の日曜日(2007年8月5日)に始まります。

define timeperiod{
    timeperiod_name     john-oncall
    2007-07-29 / 14     00:00-24:00 ; Every 14 days (two weeks), starting Sunday, July 29th, 2007
    2007-07-30 / 14     00:00-24:00 ; Every other Monday starting July 30th, 2007
    2007-07-31 / 14     00:00-24:00 ; Every other Tuesday starting July 31st, 2007
    2007-08-01 / 14     00:00-24:00 ; Every other Wednesday starting August 1st, 2007
    2007-08-02 / 14     00:00-24:00 ; Every other Thursday starting August 2nd, 2007
    2007-08-03 / 14     00:00-24:00 ; Every other Friday starting August 3rd, 2007
    2007-08-04 / 14     00:00-24:00 ; Every other Saturday starting August 4th, 2007
}

今、ジョンとボブのために連絡先定義とのこれらのtimeperiod定義を参照に必要とします

define timeperiod{
    timeperiod_name     bob-oncall
    2007-08-05 / 14     00:00-24:00 ; Every two weeks, starting Sunday, August 5th, 2007
    2007-08-06 / 14     00:00-24:00 ; Every other Monday starting August 6th, 2007
    2007-08-07 / 14     00:00-24:00 ; Every other Tuesday starting August 7th, 2007
    2007-08-08 / 14     00:00-24:00 ; Every other Wednesday starting August 8th, 2007
    2007-08-09 / 14     00:00-24:00 ; Every other Thursday starting August 9th, 2007
    2007-08-10 / 14     00:00-24:00 ; Every other Friday starting August 10th, 2007
    2007-08-11 / 14     00:00-24:00 ; Every other Saturday starting August 11th, 2007
}

シナリオ4: 休暇日


このシナリオでは、ジョンが休日以外の全て警報に対応します。 彼は、毎月、何日かの計画された休日と同様に計画された休暇を取るとします。 ジョンが休暇かオフィスの外にいるとき、ボブは、通知に対応します。

まず最初に、ジョンの休暇と休日の時間範囲をtimeperiodで定義します。

define contact{
    contact_name                john
    ...
    host_notification_period    john-oncall
    service_notification_period john-oncall
}

次に、上のtimeperiod 中で定義された日時以外のジョンの呼び出し時間を定義します。

define contact{
    contact_name                bob
    ...
    host_notification_period    bob-oncall
    service_notification_period bob-oncall
}

今、ジョンの連絡先定義中のtimeperiodに参照することができます

define timeperiod{
    name                john-out-of-office
    timeperiod_name     john-out-of-office
    day 15              00:00-24:00    ; 15th day of each month
    day -1              00:00-24:00    ; Last day of each month (28th, 29th, 30th, or 31st)
    day -2              00:00-24:00    ; 2nd to last day of each month (27th, 28th, 29th, or 30th)
    january 2           00:00-24:00    ; January 2nd each year
    june 1 - july 5     00:00-24:00    ; Yearly camping trip (June 1st - July 5th)
    2007-11-01 - 2007-11-10  00:00-24:00 ; Vacation to the US Virgin Islands (November 1st-10th, 2007)
}

ジョンが不在の日時を含むボブの新しい呼び出し時間を定義します:

define timeperiod{
    timeperiod_name     john-oncall
    monday              00:00-24:00
    tuesday             00:00-24:00
    wednesday           00:00-24:00
    thursday            00:00-24:00
    friday              00:00-24:00
    exclude             john-out-of-office ; Exclude dates/times John is out
}

今、ボブの連絡先定義中のこのtimeperiodを参照することができます

define contact{
    contact_name                john
    ...
    host_notification_period    john-oncall
    service_notification_period john-oncall
}

他のシナリオ


呼び出しに関する他の多くの通知ローテーション・シナリオが可能です。 timeperiod定義中の日の例外指示は、ほとんどの日と使う可能性のある日の範囲を扱えるの、使える書式を調べます。 timeperiod定義を作るとき誤りをすると、常にエラーでどちらか一方の対応時間にさらに多くの呼び出しが出ます。 :-)

参照 参照: 通知

English Deutsch 日本語

目次