Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save edmon1024/3645f044a46995c0ea30f676ece4fbab to your computer and use it in GitHub Desktop.

Select an option

Save edmon1024/3645f044a46995c0ea30f676ece4fbab to your computer and use it in GitHub Desktop.

Revisions

  1. @roidelapluie roidelapluie created this gist Nov 13, 2018.
    97 changes: 97 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,97 @@
    groups:
    - name: datetime
    rules:
    - record: daily_saving_time_belgium
    expr: |
    (vector(0) and (month() < 3 or month() > 10))
    or
    (vector(1) and (month() > 3 and month() < 10))
    or
    (
    (
    (month() %2 and (day_of_month() - day_of_week() > (30 + +month() % 2 - 7)) and day_of_week() > 0)
    or
    -1*month()%2+1 and (day_of_month() - day_of_week() <= (30 + month() % 2 - 7))
    )
    )
    or
    (vector(1) and ((month()==10 and hour() < 1) or (month()==3 and hour() > 0)))
    or
    vector(0)
    - record: belgium_localtime
    expr: |
    time() + 3600 + 3600 * daily_saving_time_belgium
    - record: business_day
    expr: |
    vector(1) and day_of_week(belgium_localtime) > 0 and day_of_week(belgium_localtime) < 6 unless count(public_holiday)
    - record: belgium_hour
    expr: |
    hour(belgium_localtime)
    - record: business_hour
    expr: |
    vector(1) and belgium_hour >= 8 < 18 and business_day
    - record: public_holiday
    expr: |
    vector(1) and day_of_month(belgium_localtime) == 1 and month(belgium_localtime) == 1
    labels:
    name: jour de lan
    - record: public_holiday
    expr: |
    vector(1) and day_of_month(belgium_localtime) == 1 and month(belgium_localtime) == 5
    labels:
    name: fete du travail
    - record: public_holiday
    expr: |
    vector(1) and day_of_month(belgium_localtime) == 21 and month(belgium_localtime) == 7
    labels:
    name: fete nationale
    - record: public_holiday
    expr: |
    vector(1) and day_of_month(belgium_localtime) == 15 and month(belgium_localtime) == 8
    labels:
    name: assomption
    - record: public_holiday
    expr: |
    vector(1) and day_of_month(belgium_localtime) == 1 and month(belgium_localtime) == 11
    labels:
    name: toussaint
    - record: public_holiday
    expr: |
    vector(1) and day_of_month(belgium_localtime) == 11 and month(belgium_localtime) == 11
    labels:
    name: armistice de 1918
    - record: public_holiday
    expr: |
    vector(1) and day_of_month(belgium_localtime) == 25 and month(belgium_localtime) == 12
    labels:
    name: noel
    - record: public_holiday
    expr: |
    vector(1) and day_of_month(belgium_localtime) == 22 and month(belgium_localtime) == 4 and year(belgium_localtime) == 2019
    labels:
    name: lundi de paques
    - record: public_holiday
    expr: |
    vector(1) and day_of_month(belgium_localtime) == 30 and month(belgium_localtime) == 5 and year(belgium_localtime) == 2019
    labels:
    name: ascension
    - record: public_holiday
    expr: |
    vector(1) and day_of_month(belgium_localtime) == 10 and month(belgium_localtime) == 6 and year(belgium_localtime) == 2019
    labels:
    name: pentecote
    - alert: It is time to put 2020 legal holidays in prometheus
    for: 7d
    labels:
    alertid: MON-0000
    priority: P5
    repeat_interval: 24h
    recipient: monitoring/circuit
    send_resolved: no
    env: prod
    title: Business Days
    annotations:
    description: It is time to put 2020 legal holidays in prometheus
    action: Update templates/rules/businesshours.yml.j2 in the prometheus rules (Easter Monday, Ascension Day, Whit Monday).
    expr: |
    month() > 6 and year() == 2019