Węzły
Interfejs API dla węzłów daje wiele możliwości dostępu, modyfikacji, dodawania i usuwania danych węzła z NetCruncha. Może być używany do zarządzania NetCrunchem poprzez skrypty oraz aplikacje zewnętrzne.
add-node
Dodaj węzeł
Dodaj węzeł do atlasu i włącz monitorowanie. "Name" lub "networkAddress" są obowiązkowe, a pozostałe właściwości są opcjonalne.
POST /api/rest/2/nodes
cURL
curl --request POST --url "https://<netcrunch>/api/rest/2/nodes?api_key=<api key>" --header "Content-Type: application/json" --data "\"name\": \"<node name or address to add>\"}"
curl --request POST --url "http://<netcrunch>/api/rest/2/nodes?api_key=<api-key>&name=<node name or address to add>"
Node.js
const http = require('http'), options = { method: 'POST', hostname: 'localhost', path: '/api/rest/2/nodes', headers: { 'Content-Type': 'application/json', "x-api-key": '<your-api-key>' } }, nodeData = { "name": "NewNode.ac.acme"
}; 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(nodeData)); req.end();
PowerShell
$url = "http://localhost/api/rest/2/nodes" $viewData = @{ name='NewNode.ac.acme' } $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/nodes' data = { "name": "NewNode.ac.acme" } headers = { 'Content-Type': 'application/json', 'x-api-key': '<your-api-key>' } requests.post(url=url, data=data, headers=headers)
| Nazwa pola | Opis |
|---|---|
| name | Nazwa DNS |
| networkAddress | Adres IP |
| networkPrefixLength | Długość prefiksu maski sieci |
| displayName | Wyświetlana nazwę dla węzła |
| organization | Nazwa organizacji. Musi zostać dodana do NetCruncha przed użyciem jej w API |
| snmpManaged | prawda / fałsz - włącz monitorowanie SNMP w węźle |
| snmpProfile | Nazwa profilu SNMP |
| snmpPort | Port SNMP |
| snmpTimeout | Limit czasu monitorowania SNMP w milisekundach |
| snmpRetryCount | Liczba ponownych prób dla monitorowania SNMP |
| networkServices | Lista usług sieciowych do monitorowania |
| monitoringTime | czas monitorowania przedstawiony w minutach |
| dependsOnNode | ID/nazwa/adres węzła, od którego zależy ten węzeł |
| identification | Identyfikacja węzła do monitorowania. Wartości: 'default', 'ipAddress', 'dnsName', 'macAddress' |
| deviceType | obiekt reprezentujący typ urządzenia |
| parentNode | ID/nazwa/adres węzła nadrzędnego |
| children | Lista identyfikatorów węzłów/nazw/adresów reprezentujących elementy zależne tego węzła |
| enabled | włącz/wyłącz monitorowanie tego węzła (prawda / fałsz) |
| simplifiedMonitoring | Ustaw uproszczony monitoring na prawda/fałsz |
| disabledFrom | Ustaw, aby wyłączyć monitorowanie |
| disabledUntil | Ustaw, aby wyłączyć monitorowanie |
| customFields | obiekt reprezentujący listę niestandardowych wartości pól |
| interfacesMonitoringEnabled | włącz/wyłącz monitorowanie interfejsów w tym węźle |
| snmpTrapPage | strona kodowa pułapki snmp |
| sysLogPage | strona kodowa syslog |
| organization | nazwa organizacji dla tego węzła |
| osMonitorType | Nazwa używanego monitora systemu operacyjnego. Wartości: 'auto', 'none', 'windows', 'macOS', 'linux', 'bsd', 'esx', 'solaris' |
Przykład
{ "name": "admin.ad.acme", "networkAddress": "192.168.0.25", "networkPrefixLength": 24, "displayName": "My New Node", "organization": "My organization", "identification": "ipAddress", "deviceType": { "class": "Switch", "manufacturer": "3Com", "model": "LinkSwitch 2200" }, "dependsOnNode": "10.10.10.2", "children": [ "10.10.2.34", "10.10.2.35" ], "snmpManaged": true, "snmpProfile": "Default (read-write)", "snmpPort": 161, "snmpTimeout": 5000, "snmpRetryCount": 3, "interfacesMonitoringEnabled": true, "osMonitorType": "linux", "networkServices": [ { "name": "SSH", "timeout": 5000, "repeat": 3, "additionalRepeat": 0, "monitoringTime": 5 }, { "name": "CIFS/SMB", "isLeading": true } ], "simplifiedMonitoring": false, "enabled": true }
Kody statusu
| Status Code | Description |
|---|---|
| 200 | OK |
| 401 | Brak dostępu |
Wynik
Wynik zawiera identyfikator dodanego węzła.
{ "id": 1001 }
get-node-properties
Uzyskaj właściwości węzła
Uzyskaj właściwości węzła na podstawie filtru.
Lista wszystkich dostępnych właściwości
GET/api/rest/2/nodes/<node>?properties=<filter>
cURL
curl --request GET --url "http://<netcrunch>/api/rest/2/nodes/192.168.0.25?api_key=api_key=<your-api-key>&properties=name,status"
Node.js
const http = require('http'); http.get('http://localhost/api/rest/2/nodes/192.168.0.25?api_key=<your-api-key>&properties=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/nodes/192.168.0.25?api_key=<your-api-key>&properties=properties=name,status"
Python
import requests requests.get('http://localhost/api/rest/2/nodes/192.168.0.25?api_key=<your-api-key>&properties=properties=name,status')
Parametry
| Nazwa | Opis |
|---|---|
| node identifier | ID węzła, nazwa DNS lub adres IP |
| filter | Lista właściwości. Zwraca wszystkie właściwości. W razie pominięcia wartością jest "all" lub "*" |
Kody statusu
| Kod statusu | Opis |
|---|---|
| 200 | OK |
| 412 | Brakujący lub nieprawidłowy parametr |
| 401 | Brak dostępu |
| 404 | Nie znaleziono węzła |
Wynik przykładu
{ "id": 1001, "name": "admin.ad.acme", "dnsName": "admin.ad.acme", "networkAddress": "192.168.0.25", "networkPrefixLength": 24, "snmpComputerName": "admin.ad.acme", "snmpOsDescription": "Hardware: Intel64 Family 6 Model 26 Stepping 5 AT/AT COMPATIBLE - Software: Windows Version 6.3 (Build 16299 Multiprocessor Free)", "snmpSysObjId": "1.3.6.1.4.1.311.1.1.3.1.1", "snmpLocation": "Development", "snmpAvailable": true, "snmpManaged": true, "snmpProfile": "Default (read-write)", "snmpPort": 161, "snmpTimeout": 5000, "snmpRetryCount": 3, "displayName": "My Node", "monitoringTime": "5", "networkServices": [ { "name": "SSH", "status": "Not Responding", "errorMessage": "Can't open connection" }, { "name": "CIFS/SMB", "isLeading": true, "status": "OK" } ], "dependsOnNode": { "nodeId": 1003, "name": "test.ad.acme", "networkAddress":"10.10.3.72", "dnsName":"test.ad.acme" }, "netBiosName": "ADMIN", "identification": "default", "deviceType":{ "class":"Server/Workstation", "os":"Windows Server", "version":"Windows 2012 R2 Server" }, "parentNode": { "nodeId": 1003, "name": "test.ad.acme", "networkAddress":"10.10.3.72", "dnsName":"test.ad.acme" }, "simplifiedMonitoring": false, "status": "OK", "avgResponseTime":10, "maxResponseTime":100, "alerts24h":{ "count":5, "critical":2, "warning":3, "unacknowledged":1 }, "lastAlert":{ "id":585266, "info":"Node Down", "serverity":"Critical", "time":"2018-10-09T06:15:15.000Z" }, "macAddress":"D89EF32B5ADD", "enabled":true, "disabledFrom":"2018-03-08T13:27:34.876Z", "disabledUntil":"2018-03-09T13:27:34.876Z", "addTime":"2018-02-08T13:27:34.876Z", "lastStatusChange":"2018-10-09T10:08:58.885Z", "issueCount": 2, "connectedToSwitch":{ "nodeId":1078, "interface":"Port-channel2", "port":464, "vlanId":999 }, "virtualization": { "type": "Hyper-V", "hostNodeId": 1023, "hostName": "virt-host.ad.acme", "dataCenter": "Master Data Center" }, "monitoringEngines":[ {"name":"nt", "name": "Windows", "enabled":true, "status":"OK", credentials: 'MyPassword', monitoringTime: 4}, {"name":"ntsvc", "name": "Windows Services", "enabled":true, "status":"unknown"}, {"name":"ntlog", "name": "Windows Event Log", "enabled":true, "status":"OK"} ], "children":[1506,1507], "pendingAlertsCount":0, "customFields":{ "Info 1":"Wacław", "Info 2":"Misiek", "Pick":"3", "Date Field":"1990-10-04T23:00:00.000Z" }, "interfacesMonitoringEnabled": true, "organizationalUnit": "Testing", "snmpTrapCodePage":4294967295, "sysLogCodePage":4294967295, "lastNote":null, "templateNode": { "nodeId": 1234, "name": "template", "networkAddress":"", "dnsName":"" }, "addressSpace":"", "sensors":[{ "UId":"Pending Reboot#1546607522658", "Status":"Unknown", "Changed":"2019-01-04T08:37:08.057Z", "Object":"MyObject", "Instance":"MyObject", "Name":"My Sensor", "Alerts":0, "CfgGroup":"sensors", "Message":"", "Enabled":true, "MonitoringTime":1, "Credentials":"<Use from Windows monitor>" }] }{ "id": 1001, "name": "admin.ad.acme", "dnsName": "admin.ad.acme", "networkAddress": "192.168.0.25", "networkPrefixLength": 24, "snmpComputerName": "admin.ad.acme", "snmpOsDescription": "Hardware: Intel64 Family 6 Model 26 Stepping 5 AT/AT COMPATIBLE - Software: Windows Version 6.3 (Build 16299 Multiprocessor Free)", "snmpSysObjId": "1.3.6.1.4.1.311.1.1.3.1.1", "snmpLocation": "Development", "snmpAvailable": true, "snmpManaged": true, "snmpProfile": "Default (read-write)", "snmpPort": 161, "snmpTimeout": 5000, "snmpRetryCount": 3, "displayName": "My Node", "monitoringTime": "5", "networkServices": [ { "name": "SSH", "status": "Not Responding", "errorMessage": "Can't open connection" }, { "name": "CIFS/SMB", "isLeading": true, "status": "OK" } ], "dependsOnNode": { "nodeId": 1003, "name": "test.ad.acme", "networkAddress":"10.10.3.72", "dnsName":"test.ad.acme" }, "netBiosName": "ADMIN", "identification": "default", "deviceType":{ "class":"Server/Workstation", "os":"Windows Server", "version":"Windows 2012 R2 Server" }, "parentNode": { "nodeId": 1003, "name": "test.ad.acme", "networkAddress":"10.10.3.72", "dnsName":"test.ad.acme" }, "simplifiedMonitoring": false, "status": "OK", "avgResponseTime":10, "maxResponseTime":100, "alerts24h":{ "count":5, "critical":2, "warning":3, "unacknowledged":1 }, "lastAlert":{ "id":585266, "info":"Node Down", "serverity":"Critical", "time":"2018-10-09T06:15:15.000Z" }, "macAddress":"D89EF32B5ADD", "enabled":true, "disabledFrom":"2018-03-08T13:27:34.876Z", "disabledUntil":"2018-03-09T13:27:34.876Z", "addTime":"2018-02-08T13:27:34.876Z", "lastStatusChange":"2018-10-09T10:08:58.885Z", "issueCount": 2, "connectedToSwitch":{ "nodeId":1078, "interface":"Port-channel2", "port":464, "vlanId":999 }, "virtualization": { "type": "Hyper-V", "hostNodeId": 1023, "hostName": "virt-host.ad.acme", "dataCenter": "Master Data Center" }, "monitoringEngines":[ {"name":"nt", "name": "Windows", "enabled":true, "status":"OK", credentials: 'MyPassword', monitoringTime: 4}, {"name":"ntsvc", "name": "Windows Services", "enabled":true, "status":"unknown"}, {"name":"ntlog", "name": "Windows Event Log", "enabled":true, "status":"OK"} ], "children":[1506,1507], "pendingAlertsCount":0, "customFields":{ "Info 1":"Hello", "Info 2":"Test", "Pick":"3", "Date Field":"1990-10-04T23:00:00.000Z" }, "interfacesMonitoringEnabled": true, "organizationalUnit": "Testing", "snmpTrapCodePage":4294967295, "sysLogCodePage":4294967295, "lastNote":null, "templateNode": { "nodeId": 1234, "name": "template", "networkAddress":"", "dnsName":"" }, "addressSpace":"", "sensors":[{ "UId":"Pending Reboot#1546607522658", "Status":"Unknown", "Changed":"2019-01-04T08:37:08.057Z", "Object":"MyObject", "Instance":"MyObject", "Name":"My Sensor", "Alerts":0, "CfgGroup":"sensors", "Message":"", "Enabled":true, "MonitoringTime":1, "Credentials":"<Use from Windows monitor>" }] }
get-node-property
Uzyskaj właściwość węzła
Uzyskaj pojedynczą wartość właściwości
GET/api/rest/2/nodes/<node identifier>/<property>
Lista wszystkich dostępnych właściwości
cURL
curl --request GET --url "http://<netcrunch>/api/rest/2/nodes/1001/name?api_key=<api key>"
Node.js
const http = require('http'); http.get('http://localhost/api/rest/2/nodes/1001/name?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/nodes/1001/name?api_key=<your-api-key>"
Python
import requests requests.get('http://localhost/api/rest/2/nodes/1001/name?api_key=<your-api-key>')
Parametry
| Nazwa | Opis |
|---|---|
| node identifier | Identyfikator węzła, nazwa DNS lub adres IP |
| property | Nazwa właściwości węzła do pobrania. Nazwa właściwości może zawierać kropkę, aby wysłać zapytanie o właściwość podobiektu. Na przykład: lastAlert.id or customFields.Info 1 |
Kody statusu
| Kody statusu | Opis |
|---|---|
| 200 | OK |
| 401 | Brak dostępu |
| 404 | Nie znaleziono węzła |
Wynik
Wynik zawiera właściwość i wartość
{ "name": "email.ac.acme", }
get-list-of-maps-of-the-node
Pobierz listę map węzła
Uzyskaj listę widoków węzła. Wynik jest zwracany jako tablica obiektów JSON.
GET/api/rest/2/nodes/<node identifier>/maps
cURL
curl --request GET --url "http://<netcrunch>/api/rest/2/nodes/1001/maps?api_key=<api key>"
Node.js
const http = require('http'); http.get('http://localhost/api/rest/2/nodes/1001/maps?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/nodes/1001/maps?api_key=<your-api-key>"
Python
import requests requests.get('http://localhost/api/rest/2/nodes/1001/maps?api_key=<your-api-key>')
Parametry
| Nazwa | Opis |
|---|---|
| node identifier | ID, nazwa lub adres IP węzła |
Kody statusu
| Kod statusu | Opis |
|---|---|
| 200 | OK |
| 401 | Brak dostępu |
| 404 | Nie znaleziono węzła |
Wynik
[ {"id":75,"name":"Locations"}, {"id":219,"name":"Operating System Monitoring"}, {"id":1005,"name":"Monitoring Dependencies"}, {"id":1006,"name":"10.10.8.13/26"}, {"id":1007,"name":"Windows 10"}, {"id":1008,"name":"Workstations"} ]
get-list-of-monitoring-packs-of-the-node
Pobierz listę pakietów monitorowania węzła
Uzyskaj listę pakietów monitorowania węzła, lista jest zwracana jako tablica obiektów JSON.
GET/api/rest/2/nodes/<node identifier>/policies
cURL
curl --request GET --url "http://<netcrunch>/api/rest/2/nodes/1001/policies?api_key=<api key>"
Node.js
const http = require('http'); http.get('http://localhost/api/rest/2/nodes/1001/policies?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/nodes/1001/policies?api_key=<your-api-key>"
Python
import requests requests.get('http://localhost/api/rest/2/nodes/1001/policies?api_key=<your-api-key>')
Parametry
| Nazwa | Opis |
|---|---|
| node identifier | ID, nazwa lub adres IP węzła |
Kody statusu
| Kody statusu | Opis |
|---|---|
| 200 | OK |
| 401 | Brak dostępu |
| 404 | Nie znaleziono węzła |
Wynik
[ {"id":64,"name":"Basic Windows Monitoring"}, {"id":78,"name":"Node Status"}, {"id":79,"name":"Service Status"} ]
set-node-properties
Ustaw właściwości węzła
Użyj pojedynczego żądania, aby zmienić lub ustawić wiele właściwości węzła. Możesz wykorzystać dane z pliku JSON do zmiany wielu właściwości naraz.
Lista wszystkich dostępnych właściwości
PUT/api/rest/2/nodes/<node identifier>/<property>
cURL
curl --request PUT --url "http://<netcrunch>/api/rest/2/nodes/1001/name?api_key=<api key>&value=<value>"
Node.js
const http = require('http'), options = { method: 'PUT', hostname: 'localhost', path: '/api/rest/2/nodes/1001', headers: { 'Content-Type': 'application/json', "x-api-key": '<your-api-key>' } }, viewData = { "name": "NewNodeName.ac.acme" }; 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/nodes/1001" $viewData = @{ name='NewNodeName.ac.acme' } $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/nodes/1001' data = { "name": "NewNodeName.ac.acme" } headers = { 'Content-Type': 'application/json', 'x-api-key': '<your-api-key>' } requests.put(url=url, data=data, headers=headers)
Parametry
| Nazwa | Opis |
|---|---|
| node identifier | ID węzła, nazwa DNS lub adres IP |
| property | Nazwa właściwości węzła do pobrania. Nazwa właściwości może zawierać kropkę, aby wysłać zapytanie o właściwość podobiektu. Na przykład: lastAlert.id lub customFields.Info 1 |
| value | Wartość do ustawienia dla pola |
Kody statusu
| Kod statusu | Opis |
|---|---|
| 200 | OK |
| 401 | Brak dostępu |
| 404 | Nie znaleziono węzła |
Wynik
{ "status": "ok" }
set-node-property
Ustaw właściwość węzła
Zmień lub ustaw jedną właściwość węzła.
Lista wszystkich dostępnych właściwości
PUT/api/rest/2/nodes/<node identifier>/<property>
cURL
curl --request PUT --url "http://<netcrunch>/api/rest/2/nodes/1001/name?api_key=<api key>&value=<value>"
Node.js
const http = require('http'), options = { method: 'PUT', hostname: 'localhost', path: '/api/rest/2/nodes/1001', headers: { 'Content-Type': 'application/json', "x-api-key": '<your-api-key>' } }, viewData = { "name": "NewNodeName.ac.acme" }; 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/nodes/1001" $viewData = @{ name='NewNodeName.ac.acme' } $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/nodes/1001' data = { "name": "NewNodeName.ac.acme" } headers = { 'Content-Type': 'application/json', 'x-api-key': '<your-api-key>' } requests.put(url=url, data=data, headers=headers)
Parametry
| Nazwa | Opis |
|---|---|
| node identifier | Identyfikator węzła, nazwa DNS lub adres IP |
| property | Nazwa właściwości węzła do pobrania. Nazwa właściwości może zawierać kropkę, aby wysłać zapytanie o właściwość podobiektu. Na przykład: lastAlert.id lub customFields.Info 1 |
| value | Wartość do ustawienia dla pola |
Kody statusu
| Kody statusu | Opis |
|---|---|
| 200 | OK |
| 401 | Brak dostępu |
| 404 | Nie znaleziono węzła |
Wynik
{ "id": 1001 }
manage-node-monitoring-state
Zarządzaj statusem monitorowania węzła
Włącz lub wyłącz monitorowanie węzła przez ustawienie wartości na on lub off, dodatkowo zaplanuj czas, kiedy węzeł powinien być wyłączony i ponownie włączony
PUT/api/rest/2/nodes/<node>/monitoring/<value>
cURL
curl --request PUT --url "http://<netcrunch>/api/rest/2/nodes/1001/monitoring/off?api_key=<your-api-key>" --header "Content-Type: application/json" --data "{\"disabledFrom\": \"2018-03-08T13:27:34.876Z\", \"disabledUntil\": \"2018-03-09T13:27:34.876Z\"}"
Node.js
const http = require('http'), options = { method: 'POST', hostname: 'localhost', path: '/api/rest/2/nodes/1001/monitoring/off', headers: { 'Content-Type': 'application/json', "x-api-key": '<your-api-key>' } }, viewData = { "disabledFrom": "2018-03-08T13:27:34.876Z", "disabledUntil": "2018-03-09T13:27:34.876Z" }; 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/nodes/1001/monitoring/off" $viewData = @{ disabledFrom='2018-03-08T13:27:34.876Z' disabledUntil='2018-03-09T13: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 Post -Body $body -Headers $hdrs
Python
import requests url = 'http://localhost/api/rest/2/nodes/1001/monitoring/off' data = { "disabledFrom": "2018-03-08T13:27:34.876Z" "disabledUntil": "2018-03-09T13:27:34.876Z" } headers = { 'Content-Type': 'application/json', 'x-api-key': '<your-api-key>' } requests.post(url=url, data=data, headers=headers)
Parametry
| Nazwa | Opis |
|---|---|
| node identifier | ID, nazwa lub adres IP węzła |
| value | Wartości "on" / "off" |
| disabledFrom | Data od kiedy wyłączyć monitorowanie. Zignorowane, jeśli wartość wynosi "on" |
| disabledUntil | Data do kiedy wyłączyć monitorowanie. Zignorowane, jeśli wartość wynosi "on" |
Kody statusu
| Kody statusu | Opis |
|---|---|
| 200 | OK |
| 401 | Brak dostępu |
| 404 | Nie znaleziono węzła |
Wynik
{ "status": "ok" }
add-network-service
Dodaj usługę sieciową
Dodaj usługę sieciową do węzła. Identyfikator węzła i nazwa usługi sieciowej są obowiązkowe, jeśli nie są podane inne parametry, zostaną użyte wartości domyślne programu.
POST/api/rest/2/nodes/<node>/network-services
curl --request POST --url "https://localhost/api/rest/2/nodes/192.168.3.10/network-services?api_key=<your-api-key>&name=SSH"
Node.js
const http = require('http'); http.post('http://localhost/api/rest/2/nodes/1001/network-services?api_key=<your-api-key>&name=SSH', (res) => { res.setEncoding('utf8'); res.on('error', (error) => { console.log(error) }); res.on('data', (chunk) => { console.log(chunk) }) });
PowerShell
Invoke-RestMethod -Method Post -Uri "http://localhost/api/rest/2/nodes/1001/network-services?api_key=<your-api-key>&name=SSH"
Python
import requests requests.post('http://localhost/api/rest/2/nodes/1001/network-services?api_key=<your-api-key>&name=SSH')
Parametry
| Nazwa | Opis |
|---|---|
| node identifier | ID, nazwa lub adres IP węzła |
| name | Nazwa monitorowanej usługi |
| timeout | Określa maksymalny czas oczekiwania NetCruncha na odpowiedź w milisekundach |
| repeat | Liczba żądań do wysłania na pojedyncze sprawdzenie |
| additionalRepeat | Liczba dodatkowych kontroli, gdy usługa nie odpowiada (błąd, przekroczenie limitu czasu itp.) |
| monitoringTime | Czas ustawiony w minutach |
Kody statusu
| Kody statusu | Opis |
|---|---|
| 200 | OK |
| 401 | Brak dostępu |
| 404 | Nie znaleziono węzła |
Wynik
{ "status": "ok" }
set-network-services-parameters
Ustaw parametry usług sieciowych
Zmodyfikuj parametry monitorowanej usługi sieciowej węzła
PUT/api/rest/2/nodes/<node identifier>/network-services/<service>
cURL
curl --request PUT --url "https://localhost/api/rest/2/nodes/192.168.3.10/network-services/SSH?api_key=<your-api-key>&timeout=2000"
Node.js
const http = require('http'); http.put('https://localhost/api/rest/2/nodes/192.168.3.10/network-services/SSH?api_key=<your-api-key>&timeout=2000', (res) => { res.setEncoding('utf8'); res.on('error', (error) => { console.log(error) }); res.on('data', (chunk) => { console.log(chunk) }) });
PowerShell
Invoke-RestMethod -Method put -Uri "https://localhost/api/rest/2/nodes/192.168.3.10/network-services/SSH?api_key=<your-api-key>&timeout=2000"
Python
import requests requests.put('https://localhost/api/rest/2/nodes/192.168.3.10/network-services/SSH?api_key=<your-api-key>&timeout=2000')
Parametry
| Nazwa | Opis |
|---|---|
| node identifier | ID, nazwa lub adres IP węzła |
| service | Name of network service to modify |
| timeout | Określa maksymalny czas oczekiwania NetCruncha na odpowiedź w milisekundach |
| timeout | Określa maksymalny czas oczekiwania NetCruncha na odpowiedź w milisekundach |
| repeat | Liczba żądań do wysłania na pojedyncze sprawdzenie |
| monitoringTime | Czas ustawiony w minutach |
| isLeading | Prawda/fałsz, usługa wiodąca to usługa sieciowa jako jedyna zaprojektowana do sprawdzania, gdy węzeł jest w stanie DOWN |
Kody statusu
| Kody statusu | Opis |
|---|---|
| 200 | OK |
| 401 | Brak dostępu |
| 404 | Nie znaleziono węzła |
Wynik
{ "status": "ok" }
remove-network-service
Usuń usługę sieciową
Usuń monitorowanie usługi sieciowej z węzła
DELETE/api/rest/2/nodes/<node identifier>/network-services/<service>
cURL
curl --request DELETE --url "https://localhost/api/rest/2/nodes/192.168.3.10/network-services/SSH?api_key=<your-api-key>&name=SSH"
Node.js
const http = require('http'); http.delete('http://localhost/api/rest/2/nodes/1001/network-services?api_key=<your-api-key>&name=SSH', (res) => { res.setEncoding('utf8'); res.on('error', (error) => { console.log(error) }); res.on('data', (chunk) => { console.log(chunk) }) });
PowerShell
Invoke-RestMethod -Method delete -Uri "http://localhost/api/rest/2/nodes/1001/network-services?api_key=<your-api-key>&name=SSH"
Python
import requests requests.delete('http://localhost/api/rest/2/nodes/1001/network-services?api_key=<your-api-key>&name=SSH')
Parametry
| Nazwa | Opis |
|---|---|
| node identifier | ID, nazwa lub adres IP węzła |
| service | Nazwa usługi sieciowej do usunięcia |
Kody statusu
| Kod statusu | Opis |
|---|---|
| 200 | OK |
| 401 | Brak dostępu |
| 404 | Nie znaleziono węzła |
Wynik
{ "status": "ok" }
set-custom-field-value
Ustaw wartość pola niestandardowego
Ustaw wartość niestandardowego pola w węźle. Niestandardowe pole musi zostać zdefiniowane w NetCrunchu w celu ustawienia w nim wartości.
PUT/api/rest/2/nodes/<node>/custom-fields/<field>
cURL
curl --request PUT --url "https://localhost/api/rest/2/nodes/192.168.3.10/custom-fields/Info%201?api_key=<your-api-key>&value=My_Value"
Node.js
const http = require('http'); http.put('https://localhost/api/rest/2/nodes/192.168.3.10/custom-fields/Info%201?api_key=<your-api-key>&value=My_Value', (res) => { res.setEncoding('utf8'); res.on('error', (error) => { console.log(error) }); res.on('data', (chunk) => { console.log(chunk) }) });
PowerShell
Invoke-RestMethod -Method put -Uri "https://localhost/api/rest/2/nodes/192.168.3.10/custom-fields/Info%201?api_key=<your-api-key>&value=My_Value"
Python
import requests requests.put('https://localhost/api/rest/2/nodes/192.168.3.10/custom-fields/Info%201?api_key=<your-api-key>&value=My_Value')
Parametry
| Nazwa | Opis |
|---|---|
| node identifier | ID, nazwa lub adres IP węzła |
| field | Nazwa niestandardowego pola do ustawienia |
| value | Nowa wartość pola |
Kody statusu
| Kody statusu | Opis |
|---|---|
| 200 | OK |
| 401 | Brak dostępu |
| 404 | Nie znaleziono węzła lub pola |
Wynik
{ "status": "ok" }
remove-custom-field-value
Usuń wartość pola niestandardowego
Usuń wartość pola niestandardowego z węzła.
DELETE/api/rest/2/nodes/<node identifier>/custom-fields/<field>
cURL
curl --request DELETE --url "https://localhost/api/rest/2/nodes/192.168.3.10/custom-fields/Info%201?api_key=<your-api-key>"
Node.js
const http = require('http'); http.delete('https://localhost/api/rest/2/nodes/192.168.3.10/custom-fields/Info%201?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 -Method delete -Uri "https://localhost/api/rest/2/nodes/192.168.3.10/custom-fields/Info%201?api_key=<your-api-key>"
Python
import requests requests.delete('https://localhost/api/rest/2/nodes/192.168.3.10/custom-fields/Info%201?api_key=<your-api-key>')
Parametry
| Nazwa | Opis |
|---|---|
| node identifier | ID, nazwa lub adres IP węzła |
| field | Nazwa niestandardowego pola do usunięcia |
Kody statusu
| Kod statusu | Opis |
|---|---|
| 200 | OK |
| 401 | Brak dostępu |
| 404 | Nie znaleziono węzła lub pola |
Wynik
{ "status": "ok" }
add-secondary-interface
Dodaj podrzędny interfejs
Dodaj podrzędny interfejs do węzła. Zarówno węzeł głównego, jak i podrzędnego interfejsu muszą być monitorowane przez NetCruncha.
POST/api/rest/2/nodes/<node identifier>/children/<child>
cURL
curl --request POST --url "https://localhost/api/rest/2/nodes/192.168.3.10/children/192.168.3.20?api_key=<your-api-key>"
Node.js
const http = require('http'); http.post('https://localhost/api/rest/2/nodes/192.168.3.10/children/192.168.3.20?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 -Method Post -Uri "https://localhost/api/rest/2/nodes/192.168.3.10/children/192.168.3.20?api_key=<your-api-key>"
Python
import requests requests.post('https://localhost/api/rest/2/nodes/192.168.3.10/children/192.168.3.20?api_key=<your-api-key>')
Parametry
| Nazwa | Opis |
|---|---|
| node identifier | ID, nazwa lub adres IP węzła |
| child | ID, nazwa lub adres IP węzła do dodania |
Kody statusu
| Kod statusu | Opis |
|---|---|
| 200 | OK |
| 401 | Brak dostępu |
| 404 | Nie znaleziono węzła lub elementu zależnego |
Wynik
{ "status": "ok" }
remove-secondary-interface
Usuń podrzędny interfejs
Usuń węzeł interfejsu podrzędnego z węzła
DELETE/api/rest/2/nodes/<node identifier>/children/<child>
cURL
curl --request DELETE --url "https://localhost/api/rest/2/nodes/192.168.3.10/children/192.168.3.20?api_key=<your-api-key>"
Node.js
const http = require('http'); http.delete('https://localhost/api/rest/2/nodes/192.168.3.10/children/192.168.3.20?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 -Method delete -Uri "https://localhost/api/rest/2/nodes/192.168.3.10/children/192.168.3.20?api_key=<your-api-key>"
Python
import requests requests.delete('https://localhost/api/rest/2/nodes/192.168.3.10/children/192.168.3.20?api_key=<your-api-key>')
Parametry
| Nazwa | Opis |
|---|---|
| node identifier | ID, nazwa lub adres IP węzła |
| child | ID, nazwa lub adres IP węzła do usunięcia |
Kody statusu
| Kod statusu | Opis |
|---|---|
| 200 | OK |
| 401 | Brak dostępu |
| 404 | Nie znaleziono węzła lub elementu zależnego |
Wynik
{ "status": "ok" }
set-sensor-parameters
Ustaw parametry czujnika
PUT/api/rest/2/nodes/<node>/sensors/<sensor>
curl --request PUT --url "https://localhost/api/rest/2/nodes/192.168.3.10/sensors/My%20Sensor?api_key=<your-api-key> --header "Content-Type: application/json" --data "{\"enabled\": true, \"credentials\": \"CredentialsProfile\", \"monitoringTime\": 5 }""
Node.js
const http = require('http'), querystring = require('querystring'), options = { method: 'PUT', hostname: 'localhost', path: '/api/rest/2/nodes/192.168.3.10/sensors/' + querystring.escape('My Sensor') , headers: { "content-type": "application/json", "x-api-key": '<your-api-key>' } }, data = { "enabled": true, "credentials": "CredentialsProfile", "monitoringTime": 5 }; 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(data)); req.end();
PowerShell
$url = "http://localhost/api/rest/2/nodes/192.168.3.10/sensors/My%20Sensor" $data = @{ enabled=true, credentials='CredentialsProfile', monitoringTime=5 } $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/nodes/192.168.3.10/sensors/My%20Sensor' data = { "enabled": true, "credentials": "CredentialsProfile", "monitoringTime": 5 } headers = { 'Content-Type': 'application/json', 'x-api-key': '<your-api-key>' } response = requests.put(url=url, data=data, headers=headers)
Parametry adresu URL
| Nazwa | Opis |
|---|---|
| node identifier | ID, nazwa lub adres IP węzła do usunięcia |
| sensor | UID lub nazwa czujnika do modyfikacji. Może to być lista wartości oddzielonych przecinkami |
Parametry danych
| Nazwa | Opis |
|---|---|
| enabled | Prawda/Fałsz |
| credentials | Nazwa profilu danych uwierzytelniających |
| monitoring time | Wartość w minutach |
Kody statusu
| Kod statusu | Opis |
|---|---|
| 200 | OK |
| 401 | Brak dostępu |
| 404 | Nie znaleziono węzła lub czujnika |
set-monitoring-engine-parameters
Ustaw parametry silnika monitorującego
PUT/api/rest/2/nodes/<node>/monitoring-engines/<engine>
curl --request PUT --url "https://localhost/api/rest/2/nodes/192.168.3.10/monitoring-engines/Windows?api_key=<your-api-key> --header "Content-Type: application/json" --data "{\"enabled\": true, \"profileName\": \"CredentialsProfile\", \"monitoringTime\": 5}""
Node.js
const http = require('http'), querystring = require('querystring'), options = { method: 'PUT', hostname: 'localhost', path: '/api/rest/2/nodes/192.168.3.10/monitoring-engines/Windows', headers: { "content-type": "application/json", "x-api-key": '<your-api-key>' } }, data = { "enabled": true, "profileName": "CredentialsProfile", "monitoringTime": 5 }; 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(data)); req.end();
PowerShell
$url = "http://localhost/api/rest/2/nodes/192.168.3.10/monitoring-engines/Windows" $data = @{ enabled=true, profileName='CredentialsProfile', monitoringTime=5 } $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/nodes/192.168.3.10/monitoring-engines/Windows' data = { "enabled": true, "profileName": "CredentialsProfile", "monitoringTime": 5 } headers = { 'Content-Type': 'application/json', 'x-api-key': '<your-api-key>' } response = requests.put(url=url, data=data, headers=headers)
Parametry adresu URL
| Nazwa | Opis |
|---|---|
| node identifier | ID, nazwa lub adres IP węzła do usunięcia |
| engine | ID lub nazwa silnika monitorowania |
Parametry danych
| Nazwa | Opis |
|---|---|
| enabled | Prawda/Fałsz |
| credentials | Nazwa profilu danych uwierzytelniających |
| monitoringTime | Wartość w minutach. Ustaw jako null, aby użyć wartości domyślnej (z węzła) |
Kody statusu
| Kod statusu | Opis |
|---|---|
| 200 | OK |
| 401 | Brak dostępu |
| 404 | Nie znaleziono węzła ani silnika monitorowania |
delete-sensor
Usuń czujnik
DELETE/api/rest/2/nodes/<node>/sensors/<sensor>
curl --request DELETE --url "https://localhost/api/rest/2/nodes/192.168.3.10/sensors/My%20Sensor?api_key=<your-api-key>"
Node.js
const http = require('http'), querystring = require('querystring'), options = { method: 'DELETE', hostname: 'localhost', path: '/api/rest/2/nodes/192.168.3.10/sensors/' + querystring.escape('My Sensor') , 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/nodes/192.168.3.10/sensors/My%20Sensor" $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/nodes/192.168.3.10/sensors/My%20Sensor' headers = { 'Content-Type': 'application/json', 'x-api-key': '<your-api-key>' } response = requests.delete(url=url, headers=headers)
Parametry
| Nazwa | Opis |
|---|---|
| node identifier | ID, nazwa lub adres IP węzła do usunięcia |
| sensor | UID lub nazwa czujnika do modyfikacji. Może to być lista wartości oddzielonych przecinkami |
Kody statusu
| Kod statusu | Opis |
|---|---|
| 200 | OK |
| 401 | Brak dostępu |
| 404 | Nie znaleziono węzła lub czujnika |
delete-node
Usuń węzeł
Usuń węzeł z atlasu
DELETE/api/rest/2/nodes/<node identifier>
curl --request DELETE --url "https://localhost/api/rest/2/nodes/192.168.3.15?api_key=<your-api-key>"
Node.js
const http = require('http'); http.delete('https://localhost/api/rest/2/nodes/192.168.3.15?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 -Method delete -Uri "https://localhost/api/rest/2/nodes/192.168.3.15?api_key=<your-api-key>"
Python
import requests requests.delete('https://localhost/api/rest/2/nodes/192.168.3.15?api_key=<your-api-key>')
Parametry
| Nazwa | Opis |
|---|---|
| node identifier | ID, nazwa lub adres IP węzła do usunięcia |
Kody statusu
| Kod statusu | Opis |
|---|---|
| 200 | OK |
| 401 | Brak dostępu |
| 404 | Nie znaleziono węzła |