In questa pagina
httptest.get
Descrizione
integer/array httptest.get(object parameters)
Il metodo consente di recuperare gli scenari web in base ai parametri specificati.
Questo metodo è disponibile per utenti di qualsiasi tipo. Le autorizzazioni per chiamare il metodo possono essere revocate nelle impostazioni del ruolo utente. Per ulteriori informazioni, vedere Ruoli utente.
Parametri
(object) Parametri che definiscono l'output desiderato.
Il metodo supporta i seguenti parametri.
| Parametro | Tipo | Descrizione |
|---|---|---|
| groupids | ID/array | Restituisce solo gli scenari web appartenenti ai gruppi di host specificati. |
| hostids | ID/array | Restituisce solo gli scenari web appartenenti agli host specificati. |
| httptestids | ID/array | Restituisce solo gli scenari web con gli ID specificati. |
| inherited | boolean | Se impostato su true, restituisce solo gli scenari web ereditati da un template. |
| inheritedTags | boolean | Restituisce gli scenari web che hanno i tags specificati anche nel template/host/template collegati.Valori possibili: true - anche il template/host/template collegati devono avere i tag specificati;false - (predefinito) i tag del template/host/template collegati vengono ignorati. |
| monitored | boolean | Se impostato su true, restituisce solo gli scenari web abilitati appartenenti a host monitorati. |
| selectInheritedTags | query | Restituisce una proprietà inheritedTags con i tag presenti nel template/host/template collegati. |
| templated | boolean | Se impostato su true, restituisce solo gli scenari web appartenenti ai template. |
| templateids | ID/array | Restituisce solo gli scenari web appartenenti ai template specificati. |
| expandName | flag | Espande le macro nel nome dello scenario web. |
| expandStepName | flag | Espande le macro nei nomi dei passaggi dello scenario. |
| evaltype | integer | Metodo di valutazione dei tag. Valori possibili: 0 - (predefinito) And/Or; 2 - Or. |
| tags | array | Restituisce solo gli scenari web con i tag specificati. Formato: [{"tag": "<tag>", "value": "<value>", "operator": "<operator>"}, ...].Un array vuoto restituisce tutti gli scenari web. Valori possibili dell'operatore: 0 - (predefinito) Contiene; 1 - Uguale; 2 - Non contiene; 3 - Non è uguale; 4 - Esiste; 5 - Non esiste. |
| selectHosts | query | Restituisce gli host a cui appartiene lo scenario web come array nella proprietà hosts. |
| selectSteps | query | Restituisce i passaggi dello scenario web nella proprietà steps.Supporta count. |
| selectTags | query | Restituisce i tag dello scenario web nella proprietà tags. |
| sortfield | string/array | Ordina il risultato in base alle proprietà specificate. Valori possibili: httptestid, name. |
| countOutput | boolean | Questi parametri sono descritti nel commento di riferimento. |
| editable | boolean | |
| excludeSearch | boolean | |
| filter | object | |
| limit | integer | |
| output | query | |
| preservekeys | boolean | |
| search | object | |
| searchByAny | boolean | |
| searchWildcardsEnabled | boolean | |
| sortorder | string/array | |
| startSearch | boolean |
Valori restituiti
(integer/array) Restituisce uno dei seguenti:
- un array di oggetti;
- il numero di oggetti recuperati, se è stato utilizzato il parametro
countOutput.
Esempi
Recupero di uno scenario web
Recupera tutti i dati sullo scenario web "9".
{
"jsonrpc": "2.0",
"method": "httptest.get",
"params": {
"output": "extend",
"selectSteps": "extend",
"httptestids": "9"
},
"id": 1
}
Risposta:
{
"jsonrpc": "2.0",
"result": [
{
"httptestid": "9",
"name": "Homepage check",
"delay": "1m",
"status": "0",
"agent": "Zabbix",
"authentication": "0",
"http_user": "",
"http_password": "",
"hostid": "10084",
"templateid": "0",
"http_proxy": "",
"retries": "1",
"ssl_cert_file": "",
"ssl_key_file": "",
"ssl_key_password": "",
"verify_peer": "0",
"verify_host": "0",
"uuid": "",
"headers": [],
"variables": [],
"steps": [
{
"httpstepid": "36",
"httptestid": "9",
"name": "Homepage",
"no": "1",
"url": "http://example.com",
"timeout": "15s",
"posts": "",
"required": "",
"status_codes": "200",
"follow_redirects": "1",
"retrieve_mode": "0",
"post_type": "1",
"headers": [],
"variables": [
{
"name":"{var}",
"value":"12"
}
],
"query_fields": []
},
{
"httpstepid": "37",
"httptestid": "9",
"name": "Homepage / About",
"no": "2",
"url": "http://example.com/about",
"timeout": "15s",
"posts": "",
"required": "",
"status_codes": "200",
"follow_redirects": "1",
"retrieve_mode": "0",
"post_type": "1",
"headers": [],
"variables": [],
"query_fields": []
}
]
}
],
"id": 1
}
Vedi anche
Fonte
CHttpTest::get() in ui/include/classes/api/services/CHttpTest.php.