PDF

Atlas-Ansichten und Ordner

Die API für Ansichten und Ordner ermöglicht das Hinzufügen, Entfernen, auf Daten von Ordnern und Ansichten zuzugreifen und sie in Netcrunch abzurufen.

add-view

Die Ansicht hinzufügen

Fügen Sie dem Atlas eine statische Ansicht hinzu. Wenn kein übergeordneter Ordner vorhanden ist, wird die Ansicht auf der Ebene "Benutzerdefinierte Ansichten" hinzugefügt.

POST/api/rest/2/views

cURL

curl --request POST --url "https://localhost/api/rest/2/views?api_key=<your-api-key>" --header "Content-Type: application/json" --data "{\"name\": \"New view\"}"

Node.js

const http = require('http'), options = { method: 'POST', hostname: 'localhost', path: '/api/rest/2/views', headers: { 'Content-Type': 'application/json', "x-api-key": '<your-api-key>' } }, viewData = { "name": "New View" }; const req = http.request(options, (res) => { res.setEncoding('utf8'); res.on('error', (error) => { console.log(error) }); res.on('data', (chunk) => { console.log(chunk) }) }); req.write(JSON.stringify(viewData)); req.end();

PowerShell

$url = "http://localhost/api/rest/2/views" $viewData = @{ name='New View' } $body = (ConvertTo-Json $viewData) $hdrs = @{} $hdrs.Add("X-API-KEY","<your-api-key>") $hdrs.Add("Content-Type","application/json") Invoke-RestMethod -Uri $url -Method Post -Body $body -Headers $hdrs

Python

import requests url = 'http://localhost/api/rest/2/views' data = { "name": "New View" } headers = { 'Content-Type': 'application/json', 'x-api-key': '<your-api-key>' } requests.post(url, data=data, headers=headers)

Parameter

Name Beschreibung
name Name der neuen Ansicht
parent ID, Name oder Pfad zur übergeordneten Karte

Statuscodes

Statuscode Beschreibung
200 OK
400 Name fehlt
400 NetCrunch-Anforderungsfehler
401 Zugriff abgelehnt
412 Kein API-Schlüssel

Ergebnis

Das Ergebnis enthält die ID der hinzugefügten (oder gefundenen) Ansicht.

{ "id": 1001 }

add-folder

Den Ordner hinzufügen

Fügen Sie dem Atlas einen leeren Ordner hinzu. Wenn kein übergeordneter Ordner vorhanden ist, wird er auf der Ebene "Benutzerdefinierte Ansichten" hinzugefügt

POST/api/rest/2/views/folder

cURL

curl --request POST --url "https://localhost/api/rest/2/views/folder?api_key=<your-api-key>" --header "Content-Type: application/json" --data "{\"name\": \"New Folder\"}"

Node.js

const http = require('http'), options = { method: 'POST', hostname: 'localhost', path: '/api/rest/2/views/folder', headers: { 'Content-Type': 'application/json', "x-api-key": '<your-api-key>' } }, viewData = { "name": "New Folder" }; const req = http.request(options, (res) => { res.setEncoding('utf8'); res.on('error', (error) => { console.log(error) }); res.on('data', (chunk) => { console.log(chunk) }) }); req.write(JSON.stringify(viewData)); req.end();

PowerShell

$url = "http://localhost/api/rest/2/views/folder" $viewData = @{ name='New Folder' } $body = (ConvertTo-Json $viewData) $hdrs = @{} $hdrs.Add("X-API-KEY","<your-api-key>") $hdrs.Add("Content-Type","application/json") Invoke-RestMethod -Uri $url -Method Post -Body $body -Headers $hdrs

Python

import requests url = 'http://localhost/api/rest/2/views/folder' data = { "name": "New Folder" } headers = { 'Content-Type': 'application/json', 'x-api-key': '<your-api-key>' } requests.post(url, data=data, headers=headers)

Parameter

Name Beschreibung
name Name der neuen Ansicht
parent ID, Name oder Pfad zur übergeordneten Karte

Statuscodes

Statuscode Beschreibung
200 OK
400 Name fehlt
400 NetCrunch-Anforderungsfehler
401 Zugriff abgelehnt
412 Kein API-Schlüssel

Ergebnis

{ "id": 1001 }

get-view-properties

Die Eigenschaften der Ansicht abrufen

Rufen Sie die Eigenschaften der Ansicht basierend auf dem Filter ab

Liste der Eigenschaften

Liste der zusätzlichen Eigenschaften der IP-Netzwerkansicht

GET/api/rest/2/views/<view>?properties=<filter>

cURL

curl --url "http://localhost/api/rest/2/views/Custom%20Views?api_key=<your-api-key>&properties=name,status"

Node.js

const http = require('http'); http.get('http://localhost/api/rest/2/views/Custom%20Views?api_key=<your-api-key>&properties=name,status', (res) => { res.setEncoding('utf8'); res.on('error', (error) => { console.log(error) }); res.on('data', (chunk) => { console.log(chunk) }) });

PowerShell

Invoke-RestMethod -Uri "http://localhost/api/rest/2/views/Custom%20Views?api_key=<your-api-key>&properties=name,status"

Python

import requests requests.get('http://localhost/api/rest/2/views/Custom%20Views?api_key=<your-api-key>&properties=name,status')

Parameter

Name Beschreibung
view ID der Ansicht, Name oder Pfad
filter Liste der Eigenschaften. Es werden alle Eigenschaften zurückgegeben. Wenn der Wert nicht angegeben wird, ist der Wert "all" oder "*"

Statuscodes

Statuscode Beschreibung
200 OK
401 Name fehlt
404 Ansicht nicht gefunden

Ergebnis

{  "id": 1050,  "name": "Parent",  "status": "unknown",  "stats": {    "nodes": {      "total": 0,      "ok": 0,      "unknown": 0,      "warning": 0,      "error": 0,      "alerts": {        "active": 0,        "las24Hours": {          "unacknowledged": 0,          "total": 0,          "critical": 0,          "warning": 0        }      }    },    "maps": {      "total": 2,      "ok": 0,      "unknown": 0,      "warning": 2,      "error": 0    }  },  "path": "/Custom Views",  "isDynamic": true,  "isFolder": true,  "readOnly": false  }

get-view-property

Die Eigenschaft der Ansicht abrufen

Rufen Sie eine einzelne Eigenschaft der Ansicht ab

GET/api/rest/2/views/<view>/<property>

Liste der Eigenschaften

Liste der zusätzlichen Eigenschaften der IP-Netzwerkansicht

cURL

curl --url "http://localhost/api/rest/2/views/Custom%20Views/id?api_key=<your-api-key>"

Node.js

const http = require('http'); http.get('http://localhost/api/rest/2/views/Custom%20Views/id?api_key=<your-api-key>', (res) => { res.setEncoding('utf8'); res.on('error', (error) => { console.log(error) }); res.on('data', (chunk) => { console.log(chunk) }) });

PowerShell

Invoke-RestMethod -Uri "http://localhost/api/rest/2/views/Custom%20Views/id?api_key=<your-api-key>"

Python

import requests requests.get('http://localhost/api/rest/2/views/Custom%20Views/id?api_key=<your-api-key>')

Parameter

Name Beschreibung
view Name, ID oder Pfad zur Ansicht
property Name der Eigenschaft, die abgerufen werden soll

Statuscodes

Statuscode Beschreibung
200 OK
401 Zugriff abgelehnt
404 Ansicht nicht gefunden

Ergebnis

{ "id": 1001 }

set-view-property

Die Eigenschaft der Ansicht festlegen

Ändern Sie oder legen die Eigenschaft der Ansicht fest

PUT/api/rest/2/views/<view>/<property>

cURL

curl --request PUT --url "https://localhost/api/rest/2/views/1050?api_key=<your-api-key>" --header "Content-Type: application/json" --data "{\"name\": \"New Name\"}"

Node.js

const http = require('http'), options = { method: 'PUT', hostname: 'localhost', path: '/api/rest/2/views/1050', headers: { 'Content-Type': 'application/json', "x-api-key": '<your-api-key>' } }, viewData = { "name": "New Name" }; const req = http.request(options, (res) => { res.setEncoding('utf8'); res.on('error', (error) => { console.log(error) }); res.on('data', (chunk) => { console.log(chunk) }) }); req.write(JSON.stringify(viewData)); req.end();

PowerShell

$url = "http://localhost/api/rest/2/views/1050" $viewData = @{ name='New Name' } $body = (ConvertTo-Json $viewData) $hdrs = @{} $hdrs.Add("X-API-KEY","<your-api-key>") $hdrs.Add("Content-Type","application/json") Invoke-RestMethod -Uri $url -Method Put -Body $body -Headers $hdrs

Python

import requests url = 'http://localhost/api/rest/2/views/1050' data = { "name": "New Name" } headers = { 'Content-Type': 'application/json', 'x-api-key': '<your-api-key>' } requests.put(url, data=data, headers=headers)

Parameter

Name Beschreibung
view ID der Ansicht, Name oder Pfad
property Name der Ansichtseigenschaft, die gesetzt werden soll

Statuscodes

Statuscode Beschreibung
200 OK
401 Zugriff abgelehnt
404 Ansicht nicht gefunden

Ergebnis

{ "status": "ok" }

get-list-of-nodes-in-the-view

Die Liste der Knoten in der Ansicht abrufen

Rufen Sie die Liste der in der Ansicht vorhandenen Knoten ab

GET/api/rest/2/views/<view>/nodes

cURL

curl --url "http://localhost/api/rest/2/views/Unresponding%20Nodes/nodes?api_key=<your-api-key>"

Node.js

const http = require('http'); http.get('http://localhost/api/rest/2/views/Unresponding%20Nodes/nodes?api_key=<your-api-key>', (res) => { res.setEncoding('utf8'); res.on('error', (error) => { console.log(error) }); res.on('data', (chunk) => { console.log(chunk) }) });

PowerShell

Invoke-RestMethod -Uri "http://localhost/api/rest/2/views/Unresponding%20Nodes/nodes?api_key=<your-api-key>"

Python

import requests requests.get('http://localhost/api/rest/2/views/Unresponding%20Nodes/nodes?api_key=<your-api-key>')

Parameter

Name Beschreibung
view Name, ID oder Pfad zur Ansicht
property Name der Eigenschaft, die abgerufen werden soll

Statuscodes

Statuscode Beschreibung
200 OK
401 Zugriff abgelehnt
404 Ansicht nicht gefunden

Ergebnis

[ {"id":1019,"name":"foo","networkAddress":"192.168.1.89","dnsName":"foo.test.com"}, {"id":1019,"name":"bar","networkAddress":"192.168.1.10","dnsName":"bar.test.com"} ]

add-node-to-the-view

Den Knoten zur Ansicht hinzufügen

Fügen Sie einer Ansicht den überwachten Knoten hinzu

POST/api/rest/2/views/<view>/nodes/<node>

cURL

curl --request POST --url "https://localhost/api/rest/2/views/New%20View/nodes/192.168.1.10?api_key=<your-api-key>"

Node.js

const http = require('http'), querystring = require('querystring'), options = { method: 'POST', hostname: 'localhost', path: '/api/rest/2/views/' + querystring.escape('New View') + '/nodes/192.168.1.10' , headers: { "x-api-key": '<your-api-key>' } }; const req = http.request(options, (res) => { res.setEncoding('utf8'); res.on('error', (error) => { console.log(error) }); res.on('data', (chunk) => { console.log(chunk) }) }); req.end();

PowerShell

$url = "http://localhost/api/rest/2/views/New%20View/nodes/192.168.1.10" $hdrs = @{} $hdrs.Add("X-API-KEY","<your-api-key>") $hdrs.Add("Content-Type","application/json") Invoke-RestMethod -Uri $url -Method Post -Headers $hdrs

Python

import requests url = 'http://localhost/api/rest/2/views/New%20View/nodes/192.168.1.10' headers = { 'Content-Type': 'application/json', 'x-api-key': '<your-api-key>' } response = requests.post(url, headers=headers)

Parameter

Name Beschreibung
view Name, ID oder Pfad zur Ansicht
node ID, Name oder IP-Adresse des hinzuzufügenden Knotens

Statuscodes

Statuscode Beschreibung
200 OK
401 Zugriff abgelehnt
404 Ansicht oder Knoten nicht gefunden

Ergebnis

{ "status":"ok" }

remove-node-from-the-view

Den Knoten aus der Ansicht entfernen

Entfernen Sie den Knoten aus einer Ansicht

DELETE/api/rest/2/views/<view>/nodes/<node>

cURL

curl --request DELETE --url "https://localhost/api/rest/2/views/New%20View/nodes/192.168.1.10?api_key=<your-api-key>"

Node.js

const http = require('http'), querystring = require('querystring'), options = { method: 'DELETE', hostname: 'localhost', path: '/api/rest/2/views/' + querystring.escape('New View') + '/nodes/192.168.1.10', headers: { "x-api-key": '<your-api-key>' } }; const req = http.request(options, (res) => { res.setEncoding('utf8'); res.on('error', (error) => { console.log(error) }); res.on('data', (chunk) => { console.log(chunk) }) }); req.end();

PowerShell

$url = "http://localhost/api/rest/2/views/New%20View/nodes/192.168.1.10" $hdrs = @{} $hdrs.Add("X-API-KEY","<your-api-key>") $hdrs.Add("Content-Type","application/json") Invoke-RestMethod -Uri $url -Method Delete -Headers $hdrs

Python

import requests url = 'http://localhost/api/rest/2/views/New%20View/nodes/192.168.1.10' headers = { 'Content-Type': 'application/json', 'x-api-key': '<your-api-key>' } response = requests.delete(url, headers=headers)

Parameter

Name Beschreibung
view Name, ID oder Pfad zur Ansicht
node ID, Name oder IP-Adresse des zu entfernenden Knotens

Statuscodes

Statuscode Beschreibung
200 OK
401 Zugriff abgelehnt
404 Ansicht oder Knoten nicht gefunden

Ergebnis

{ "status":"ok" }

enable-ip-network-view-monitoring

Die Überwachung der IP-Netzwerkansicht aktivieren

Aktivieren Sie die Überwachung aller Knoten in der Ansicht

PUT/api/rest/2/views/<view>/enable

cURL

curl --request PUT --url "https://localhost/api/rest/2/views/1050/enable?api_key=<your-api-key>"

Node.js

const http = require('http'), options = { method: 'PUT', hostname: 'localhost', path: '/api/rest/2/views/1050/enable', headers: { 'Content-Type': 'application/json', "x-api-key": '<your-api-key>' } }; const req = http.request(options, (res) => { res.setEncoding('utf8'); res.on('error', (error) => { console.log(error) }); res.on('data', (chunk) => { console.log(chunk) }) }); req.end();

PowerShell

$url = "http://localhost/api/rest/2/views/1050/enable" $hdrs = @{} $hdrs.Add("X-API-KEY","<your-api-key>") $hdrs.Add("Content-Type","application/json") Invoke-RestMethod -Uri $url -Method Put -Headers $hdrs

Python

import requests url = 'http://localhost/api/rest/2/views/1050/enable' headers = { 'Content-Type': 'application/json', 'x-api-key': '<your-api-key>' } requests.put(url, headers=headers)

Parameter

Name Beschreibung
view ID der Ansicht, Name oder Pfad

Statuscodes

Statuscode Beschreibung
200 OK
401 Zugriff abgelehnt
404 Ansicht nicht gefunden

Ergebnis

{ "status":"ok" }

disable-ip-network-view-monitoring

Die Überwachung der IP-Netzwerkansicht deaktivieren

Deaktivieren Sie die Überwachung aller Knoten in der Ansicht

PUT/api/rest/2/views/<view>/disable

cURL

curl --request PUT --url "https://localhost/api/rest/2/views/1050/disable?api_key=<your-api-key>" --header "Content-Type: application/json" --data "{\"disabledFrom\": \"2019-01-01T13:27:34.876Z\", \"disabledUntil\": \""2019-02-01T13:27:34.876Z"\"}"

Node.js

const http = require('http'), options = { method: 'PUT', hostname: 'localhost', path: '/api/rest/2/views/1050/disable', headers: { 'Content-Type': 'application/json', "x-api-key": '<your-api-key>' } }, viewData = { "disabledFrom": "2019-01-01T13:27:34.876Z", "disabledUntil": "2019-02-01T13:27:34.876Z" };

PowerShell

$url = "http://localhost/api/rest/2/views/1050/disable" $viewData = @{ disabledFrom: '2019-01-01T13:27:34.876Z', disabledUntil: '2019-02-01T13:27:34.876Z' } $body = (ConvertTo-Json $viewData) $hdrs = @{} $hdrs.Add("X-API-KEY","<your-api-key>") $hdrs.Add("Content-Type","application/json") Invoke-RestMethod -Uri $url -Method Put -Body $body -Headers $hdrs

Python

import requests url = 'http://localhost/api/rest/2/views/1050/disable' data = { "disabledFrom": "2019-01-01T13:27:34.876Z", "disabledUntil": "2019-02-01T13:27:34.876Z" } headers = { 'Content-Type': 'application/json', 'x-api-key': '<your-api-key>' } requests.put(url, data=data, headers=headers)

Parameter

Name Beschreibung
view ID der Ansicht, Name oder Pfad
disabledFrom 2018-03-08T13:27:34.876Z
disabledUntil 2018-03-09T13:27:34.876Z

Statuscodes

Statuscode Beschreibung
200 OK
401 Zugriff abgelehnt
404 Ansicht nicht gefunden

Ergebnis

{ "status":"ok" }

delete-view

Die Ansicht löschen

Entfernen Sie die Ansicht aus dem Atlas

DELETE/api/rest/2/views/<view>

cURL

curl --request DELETE --url "https://localhost/api/rest/2/views/New%20View?api_key=<your-api-key>"

Node.js

const http = require('http'), querystring = require('querystring'), options = { method: 'DELETE', hostname: 'localhost', path: '/api/rest/2/views/' + querystring.escape('New View'), headers: { "x-api-key": '<your-api-key>' } }; const req = http.request(options, (res) => { res.setEncoding('utf8'); res.on('error', (error) => { console.log(error) }); res.on('data', (chunk) => { console.log(chunk) }) }); req.end();

PowerShell

$url = "http://localhost/api/rest/2/views/New%20View" $hdrs = @{} $hdrs.Add("X-API-KEY","<your-api-key>") $hdrs.Add("Content-Type","application/json") Invoke-RestMethod -Uri $url -Method Delete -Headers $hdrs

Python

import requests url = 'http://localhost/api/rest/2/views/New%20View' headers = { 'Content-Type': 'application/json', 'x-api-key': '<your-api-key>' } response = requests.delete(url, headers=headers)

Parameter

Name Beschreibung
view Name, ID oder Pfad der zu löschenden Ansicht

Statuscodes

Statuscode Beschreibung
200 OK
401 Zugriff abgelehnt
404 Ansicht nicht gefunden

Ergebnis

{ "id": 1001 }