Zabbix Documentation 2.0

2.23.04.04.2 (current)In development:4.4 (devel)Unsupported:1.82.02.43.23.4

User Tools

Site Tools


Sidebar

manual:appendix:api:webcheck:create

webcheck.create

Description

object webcheck.create(object/array webScenarios)

This method allows to create new web scenarios.

Creating a web scenario will automatically create a set of web monitoring items.

Parameters

(object/array) Web scenarios to create.

Additionally to the standard web scenario properties, the method accepts the following parameters.

Parameter Type Description
hostid
(required)
string ID of the host that the web scenario belongs to.
steps
(required)
array Web scenario steps.

Return values

(object) Returns an object containing the IDs of the created web scenarios under the httptestids property. The order of the returned IDs matches the order of the passed web scenarios.

Examples

Creating a web scenario

Create a web scenario to monitor the company home page. The scenario will have two steps, to check the home page and the “About” page and make sure they return the HTTP status code 200.

Request:

{
    "jsonrpc": "2.0",
    "method": "webcheck.create",
    "params": {
        "name": "Homepage check",
        "applicationid": "654",
        "hostid": "30079",
        "steps": [
            {
                "name": "Homepage",
                "url": "http://mycompany.com",
                "status_codes": 200,
                "no": 1
            },
            {
                "name": "Homepage / About",
                "url": "http://mycompany.com/about",
                "status_codes": 200,
                "no": 2
            }
        ]
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}

Response:

{
    "jsonrpc": "2.0",
    "result": {
        "httptestids": [
            "5"
        ]
    },
    "id": 1
}

See also

Source

CWebCheck::create() in frontends/php/api/classes/CWebCheck.php.