File: http.rst

package info (click to toggle)
simplemonitor 1.15.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,520 kB
  • sloc: python: 8,725; sh: 258; makefile: 74; javascript: 69
file content (103 lines) | stat: -rw-r--r-- 1,972 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
http - fetch and verify a URL
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Attempts to fetch a URL and makes sure the HTTP return code is (by default) 200/OK. Can also match the content of the page to a regular expression.

.. confval:: method

    :type: string
    :required: true
    :default: `GET`

    The method used in the HTTP request: `HEAD` `GET` `POST`

.. confval:: url

    :type: string
    :required: true

    the URL to open

.. confval:: regexp

    :type: regexp
    :required: false
    :default: none

    the regexp to look for in the body of the response

.. confval:: allowed_codes

    :type: comma-separated list of integer
    :required: false
    :default: `200`

    a list of acceptable HTTP status codes

.. confval:: allow_redirects

    :type: bool
    :required: false
    :default: true

    Follow redirects

.. confval:: username

    :type: str
    :required: false
    :default: none

    Username for http basic auth

.. confval:: password

    :type: str
    :required: false
    :default: none

    Password for http basic auth

.. confval:: verify_hostname

    :type: boolean
    :required: false
    :default: true

    set to false to disable SSL hostname verification (e.g. with self-signed certificates)

.. confval:: timeout

    :type: integer
    :required: false
    :default: ``5``

    the timeout in seconds for the HTTP request to complete

.. tip:: You can set the headers globally in monitors.ini - just create ``[defaults]`` section on top of the file

.. confval:: headers

    :type: JSON map as string
    :required: false
    :default: none

    JSON map of HTTP header names and values to add to the request

.. warning:: Use only one of the following options - either json OR data.

.. confval:: data

    :type: string
    :required: false
    :default: none

    Data to add to the POST request

.. confval:: json

    :type: JSON as string
    :required: false
    :default: none

    JSON to add to the POST request