Skip to content
Snippets Groups Projects
httpcheck.conf 6.83 KiB
Newer Older
  • Learn to ignore specific revisions
  • jurgenhaas's avatar
    jurgenhaas committed
    # netdata python.d.plugin configuration for httpcheck
    #
    # This file is in YaML format. Generally the format is:
    #
    # name: value
    #
    # There are 2 sections:
    #  - global variables
    #  - one or more JOBS
    #
    # JOBS allow you to collect values from multiple sources.
    # Each source will have its own set of charts.
    #
    # JOB parameters have to be indented (using spaces only, example below).
    
    # ----------------------------------------------------------------------
    # Global Variables
    # These variables set the defaults for all JOBs, however each JOB
    # may define its own, overriding the defaults.
    
    # update_every sets the default data collection frequency.
    # If unset, the httpcheck default is used, which is at 3 seconds.
    # update_every: 1
    
    # priority controls the order of charts at the netdata dashboard.
    # Lower numbers move the charts towards the top of the page.
    # If unset, the default for python.d.plugin is used.
    # priority: 60000
    
    # chart_cleanup sets the default chart cleanup interval in iterations.
    # A chart is marked as obsolete if it has not been updated
    # 'chart_cleanup' iterations in a row.
    # They will be hidden immediately (not offered to dashboard viewer,
    # streamed upstream and archived to backends) and deleted one hour
    # later (configurable from netdata.conf).
    # -- For this plugin, cleanup MUST be disabled, otherwise we lose response
    #    time charts
    chart_cleanup: 0
    redirect: no
    
    # Autodetection and retries do not work for this plugin
    
    # ----------------------------------------------------------------------
    # JOBS (data collection sources)
    #
    # The default JOBS share the same *name*. JOBS with the same name
    # are mutually exclusive. Only one of them will be allowed running at
    # any time. This allows autodetection to try several alternatives and
    # pick the one that works.
    #
    # Any number of jobs is supported.
    #
    # -------------------------------
    # ATTENTION: Any valid configuration will be accepted, even if initial connection fails!
    # -------------------------------
    #
    # There is intentionally no default config, e.g. for 'localhost'
    
    # job_name:
    #     name: myname            # [optional] the JOB's name as it will appear at the
    #                             #   dashboard (by default is the job_name)
    #                             #   JOBs sharing a name are mutually exclusive
    #     update_every: 3         # [optional] the JOB's data collection frequency
    #     priority: 60000         # [optional] the JOB's order on the dashboard
    #     retries: 60             # [optional] the JOB's number of restoration attempts
    #     timeout: 1              # [optional] the timeout when connecting, supports decimals (e.g. 0.5s)
    
    #     url: http[s]://host-ip-or-dns[:port][path]
    
    jurgenhaas's avatar
    jurgenhaas committed
    #                             # [required] the remote host url to connect to. If [:port] is missing, it defaults to 80
    #                             #   for HTTP and 443 for HTTPS. [path] is optional too, defaults to /
    #     redirect: yes           # [optional] If the remote host returns 3xx status codes, the redirection url will be
    #                             #   followed (default).
    #     status_accepted:        # [optional] By default, 200 is accepted. Anything else will result in 'bad status' in the
    #                             #   status chart, however: The response time will still be > 0, since the
    #                             #   host responded with something.
    #                             #   If redirect is enabled, the accepted status will be checked against the redirected page.
    #       - 200                 # Multiple status codes are possible. If you specify 'status_accepted', you would still
    #                             #   need to add '200'. E.g. 'status_accepted: [301]' will trigger an error in 'bad status'
    #                             #   if code is 200. Do specify numerical entries such as 200, not 'OK'.
    #     regex: None             # [optional] If the status code is accepted, the content of the response will be searched for this
    #                             #   regex (if defined). Be aware that you may need to escape the regex string. If redirect is enabled,
    #                             #   the regex will be matched to the redirected page, not the initial 3xx response.
    
    # Simple example:
    #
    # jira:
    
    #   url: https://jira.localdomain/
    
    jurgenhaas's avatar
    jurgenhaas committed
    
    
    # Complex example:
    #
    # cool_website:
    
    #   url: http://cool.website:8080/home
    
    jurgenhaas's avatar
    jurgenhaas committed
    #   status_accepted:
    #     - 200
    #     - 204
    #   regex: <title>My cool website!<\/title>
    #   timeout: 2
    
    # This plugin is intended for simple cases. Currently, the accuracy of the response time is low and should be used as reference only.
    {% for item in netdata_httpcheck|default([]) %}
    
    {% if not item.disabled|default(false) and item.username is not defined %}
    
    jurgenhaas's avatar
    jurgenhaas committed
    
    {{ item.name|to_uuid }}:
    
        name: {{ item.name }}
        url: {{ item.url }}
    
    {% if item.regex is defined %}
    
    jurgenhaas's avatar
    jurgenhaas committed
        regex: {{ item.regex|regex_escape() }}
    
    {% endif %}
    
    jurgenhaas's avatar
    jurgenhaas committed
    {% if item.redirect|default(false) %}
        redirect: yes
    {% endif %}
    
    {% if item.timeout is defined %}
        timeout: {{ item.timeout }}
    {% endif %}
    
    {% if item.header is defined %}
        header: {{ item.header|to_json }}
    {% endif %}
    
    jurgenhaas's avatar
    jurgenhaas committed
    {% endif %}
    {% endfor %}
    
    {% for drupal in drupal_settings|default([]) %}
    {% for site in drupal.domains|default([]) %}
    
    {% if site.uptime is defined and not site.uptime.disabled|default(false) %}
    
    
    {{ site.uptime.name|to_uuid }}:
    
        name: {{ site.uptime.name }}
    
        url: {{ site.protocol|default('https') }}://{{ site.domain }}{% if site.uptime.path is defined %}/{{ site.uptime.path }}{% endif %}
    
    {% if site.uptime.pollerParams|default(false) and site.uptime.pollerParams.body|default(false) %}
        regex: {{ site.uptime.pollerParams.body|regex_escape() }}
    {% endif %}
    {% if site.uptime.timeout|default(false) %}
        timeout: {{ site.uptime.timeout }}
    {% endif %}
    
    {% if site.uptime.header is defined %}
        header: {{ site.uptime.header|to_json }}
    
    {% endif %}
    {% endfor %}
    {% endfor %}
    {% for site in nextcloud_settings|default([]) %}
    
    {% if site.uptime is defined and not site.uptime.disabled|default(false) %}
    
    
    {{ site.uptime.name|to_uuid }}:
    
        name: {{ site.uptime.name }}
    
        url: {{ site.protocol|default('https') }}://{{ site.domain }}{% if site.uptime.path is defined %}/{{ site.uptime.path }}{% endif %}
    
    {% if site.uptime.pollerParams|default(false) and site.uptime.pollerParams.body|default(false) %}
        regex: {{ site.uptime.pollerParams.body|regex_escape() }}
    {% endif %}
    {% if site.uptime.timeout|default(false) %}
        timeout: {{ site.uptime.timeout }}
    {% endif %}
    
    {% if site.uptime.header is defined %}
        header: {{ site.uptime.header|to_json }}
    
    {% if site.ocs is defined %}
    
    {{ site.domain|to_uuid }}:
        name: NextCloud OCS {{ site.id }}
        url: {{ site.protocol|default('https') }}://{{ site.domain }}/ocs/v2.php/apps/serverinfo/api/v1/info?format=json
        header:
          Authorization: Basic {{ (site.ocs.username + ':' + site.ocs.password) | b64encode }}
        regex: {{ '"status":"ok"'|regex_escape() }}
    {% endif %}