configuration example - CMT Monitor Documentation

Skip to content

# Configuration Example

## Full configuration example

    ---
    # Cavaliba / cmt_monitor / conf.yml
    # CMT Version: 2.0beta

    # Example configuration / template

    # Global section
    # --------------

    global:
      cmt_group: cavaliba
      cmt_node: vmxupm
      cmt_node_env: dev
      cmt_node_role: dev_cmt
      cmt_node_location: France
      enable: yes
      enable_pager: yes
      business_hours: 08:00:00 18:00:00
      #conf_url: http://localhost/txt/
      pager_rate_limit: 3600
      max_execution_time: 55
      load_confd: yes
      alert_max_level: warn
      alert_delay: 90
      tags: demo os=linux os_ver=debian10

    # Metrology section
    # -----------------

    metrology_servers:

      graylog_test1:
          type: graylog_udp_gelf
          host: 10.10.10.13
          port: 12201
          enable: yes

      graylog_test2:
          type: graylog_http_gelf
          url: http://10.10.10.13:8080/gelf
          ssl_verify: yes
          enable: yes

      elastic_test:
          type: elastic_http_json
          url: http://10.10.10.51:9200/cmt/data/?pipeline=timestamp
          ssl_verify: yes
          enable: yes

      # CMT V1.7+ ; compatible with influxdb V1 & V2
      influxdb_test:
          type: influxdb
          # V1
          url: http://10.10.10.13:8086/write?db=cmt
          # V2
          # url:
          # msec, sec, nsec ; anything else, no timestamp
          time_format: msec
          batch: yes
          send_tags: yes
          token: toto
          #username: cmt
          #password : cmt
          ssl_verify: yes
          enable: yes

    # Pager section
    # -------------
    # type : team_channel, teams (idem), pagerduty
    # mode : managed (ratelimit, hysteresis by CMT), allnotifications

    pagers:

      myteams:
        type: teams
        mode: managed
        url: https://outlook.office.com/webhook/xxxxx/IncomingWebhook/yyyyyyyyyyyyyyy
        enable: yes

      mypagerduty:
        type: pagerduty
        mode: allnotifications
        url: https://events.pagerduty.com/v2/enqueue
        key: XXXXXXXXXXXXXXXXXXXXXXXx
        enable: yes

    # checks section
    # --------------

    # module_name:
    #
    #   checkname:
    #      [enable]           : timerange ; default yes ; yes, no, before, after, hrange, ho, hno
    #      [enable_pager]     : timerange ; default NO ; need global/pager to be enabled ; sent if alert found
    #      [alert_max_level]  : alert, warn, notice, none (scale down)  ; overwrites global & module entry
    #      [alert_delay]      : delay before transition from normal to alert (if alert) ; seconds  ; DEFAULT 120
    #      [frequency]        : min seconds between runs ; needs --cron in ARGS ; overrides module config
    #      [root_required]    : [yes|no(default)] -  new 1.4.0 - is root privilege manadatory for this check ?
    #      [tags]             : tag1 tag2[=value] ... ; list of tags ; no blank space aroung optional "=value"
    #      arg1               : specific to module (see doc for each module)
    #      arg2               : specific to module
    #      (...)

    load:

      myload:
        enable: yes
        alert_max_level: alert
        severity_max: warning
        threshold1: 10.3
        threshold5: 8.4
        threshold15: 4.4
        tags: local1 local2=43

    cpu:

      mycpu:
        enable: yes
        alert_max_level: alert
        severity_max: warning

    memory:

      mymemory:
        enable: yes
        alert_max_level: alert
        frequency: 10
        # percent
        threshold: 80.5
        severity_max: warning

    boottime:

      myboottime:
        enable: yes
        alert_max_level: alert
        # days
        threshold: 180
        severity_max: warning

    swap:
      myswap:
        enable: yes
        alert_max_level: warn
        # percent
        threshold: 11.3
        severity_max: warning

    disk:

      disk_root:
        path: /
        alert: 80
        severity_max: warning

      disk_boot:
        path: /boot
        alert: 90
        severity_max: warning

    # ---------
    url:

      www.cavaliba.com:
        enabled: after 2020-01-01
        url: https://www.cavaliba.com/
        pattern: "Cavaliba"
        allow_redirects: yes
        ssl_verify: yes
        #host: toto
        severity_max: warning

      www_non_existing:
        enabled: after 2020-01-01
        url: http://www.nonexisting/
        #pattern: ""
        severity_max: warning

      google:
        url: https://www.google.com/
        severity_max: warning

      yahoo:
        url: https://www.yahoo.com/
        allow_redirects: yes
        ssl_verify: yes
        severity_max: warning

      via_proxy_cavaliba:
        enabled: yes
        url: https://www.cavaliba.com/
        http_proxy: http://72.25.7.140:8080
        severity_max: warning

      url_noenv_proxy:
        url: http://www.monip.org/
        http_proxy: noenv
        severity_max: warning

      url_test_timeout:
        url: http://slowwly.robertomurray.co.uk/delay/4000/url/http://google.co.uk
        timeout: 2
        severity_max: warning

    # ---------
    mount:

      mount_root:
        path: /
        severity_max: warning

      mount_mnt:
        path: /mnt
        severity_max: warning

    # ---------
    process:

      redis:
        psname: redis
        enable_pager: no
        severity_max: warning

      apache:
        psname: httpd
        severity_max: warning

      cron:
        psname: cron
        search_arg: "-f"
        severity_max: warning

      ssh:
        psname: sshd
        severity_max: warning

      ntp:
        psname: ntpd
        severity_max: warning

      mysql:
        psname: mysqld
        severity_max: warning

      php-fpm:
        psname: php-fpm
        enable_pager: yes
        severity_max: warning

    # ---------
    ping:

      ping_vm1:
        host: 192.168.0.1
        severity_max: warning

      ping_locahost:
        host: localhost
        severity_max: warning

      www.google.com:
        host: www.google.com
        severity_max: warning

      wwwtest:
        host: www.test.com
        severity_max: warning

      badname:
        host: www.averybadnammme_indeed.com
        severity_max: warning

    # ---------
    folder:

      test_recursive100:
        path: /opt/cmt/testdata/arbo100
        severity_max: critical
        alert_max_level: alert
        recursive: yes

      test_extension:
        path: /opt/cmt/testdata
        severity_max: warning
        recursive: yes
        filter_extension: ".conf .hl7"

      test_regexp:
        path: /opt/cmt/testdata
        severity_max: warning
        recursive: yes
        filter_regexp: '^Makefile$'

      test_regexp_no_recurse:
        path: /opt/cmt/testdata
        severity_max: warning
        recursive: no
        filter_regexp: '^Makefile$'

      test_regexp_ext:
        path: /opt/cmt/testdata
        severity_max: warning
        recursive: yes
        filter_regexp: '.*.conf$'

      test_wrong_target:
        path: /opt/cmt/testdata
        severity_max: warning
        target:
           is_blabla:

      test_hasfile:
        path: /opt/cmt/testdata
        severity_max: error
        recursive: no
        target:
           has_files:
                - secret.pdf
                #- secret2.pdf

      test_age_min:
        path: /opt/cmt/testdata
        severity_max: error
        target:
           age_min: 1000

      test_age_max:
        path: /opt/cmt/testdata
        severity_max: notice
        target:
           age_max: 300

      test_files_min:
        path: /opt/cmt/testdata
        severity_max: warning
        target:
           files_min: 3

      test_files_max:
        path: /opt/cmt/testdata
        severity_max: warning
        target:
           files_max: 10

      test_size_min:
        path: /opt/cmt/testdata
        severity_max: warning
        target:
           size_min: 100000

      test_size_max:
        path: /opt/cmt/testdata
        severity_max: error
        target:
           size_max: 10

      test_has_recent:
        path: /opt/cmt/testdata
        target:
           has_recent: 3600
        severity_max: warning

      test_has_old:
        path: /opt/cmt/testdata
        target:
           has_old: 86400
        severity_max: warning

      test_missing:
        path: /opt/cmt/testdata/missing
        severity_max: warning

      test_missing:
        path: /opt/cmt/testdata/file_missing.txt
        severity_max: warning

      test_nostore:
        path: /opt/cmt/testdata/file.txt
        recursive: yes
        no_store: yes
        severity_max: warning

      folder_root:
        path: /root
        root_required: yes
        severity_max: warning

    # ---------
    certificate:

      cert_google:
        hostname: google.com
        port: 443
        alert_in: 1 week
        warning_in: 3 months
        notice_in: 6 months
        severity_max: warning

      duck:
        hostname: duckduckgo.com
        alert_in: 1 week
        severity_max: warning

      broken:
        hostname: duckduckgo.com
        port: 80
        alert_in: 2 week
        severity_max: warning

      yahoo:
        hostname: yahoo.com
        port: 443
        alert_in: 2 week
        severity_max: warning

    # ---------
    socket:

      redis:
        socket: local tcp 6379
        #socket: local tcp port | remote tcp host port
        connect: yes
        #send:
        #pattern:
        severity_max: warning

      www_google:
         socket: remote www.google.com tcp 443
         connect: yes
         #send:
         #pattern:
         severity_max: warning

    send:

        test_token1:
          attribute: test
          comment: "a test comment for token1 - cmt_test will be created in elastic"
          unit: "no_unit"
          severity_max: warning

    sendfile:

        mysendfile:
          jsonfile: /opt/cmt/demo.json
          frequency: 3

    mysql:

        mydb:
          defaults_file: /opt/cmt/mysql.cnf
              #  [client]
              #  host     = 127.0.0.1
              #  user     = root
              #  password = xxxxxxx
              #  port     = 3306
              #  socket   = /var/run/mysqld/mysqld.sock
          is_slave: yes
          max_behind: 300
          alert_max_level: notice
          alert_delay: 300
          severity_max: warning

    #  -------------------------------------
    #  timerange field (from documentation)
    #  -------------------------------------
    #  - yes
    #  - no
    #  - after YYYY-MM-DD hh:mm:ss
    #  - before YYYY-MM-DD hh:mm:ss
    #  - hrange hh:mm:ss hh:mm:ss
    #  - ho   (8h30/18h mon>fri) - business hours
    #  - hno  (! (8h30/18h mon>fri)) - non business hours

    # ------------------------------------
    # conf.d/*.yml also included with :
    # - main conf has higher priority
    # - first level lists merged
    # ------------------------------------