Nodes

Nodes API gives many possibilities to access, modify, add, and remove node data from NetCrunch. It can be used to manage NetCrunch through scripts and external applications.

add-node

Add Node

Add node to the Atlas and enable monitoring, "name" or "networkAddress" are mandatory, the rest of the properties are optional.

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)

Field Name Description
name DNS name
networkAddress IP Address
networkPrefixLength Network mask prefix length
displayName Display name for node
organization Name of organization. It must be added to NetCrunch prior to using it in API
snmpManaged true/false - enable SNMP monitoring on the node
snmpProfile Name of SNMP profile
snmpPort SNMP Port
snmpTimeout SNMP monitoring timeout in miliseconds
snmpRetryCount Retry count for SNMP monitoring
networkServices List of network services to monitor
monitoringTime monitoring time represented in minutes
dependsOnNode ID/name/address of node this node depends on
identification node identification for monitoring. Values: 'default', 'ipAddress', 'dnsName', 'macAddress'
deviceType object representing type of device
parentNode ID/name/address of parent node
enabled enable/disable monitoring of this node (true/false)
simplifiedMonitoring Set simplified monitoring to true/false
disabledFrom Set to disable monitoring (this is in UTC time)
disabledUntil Set to disable monitoring (this is in UTC time)
customFields object representing list of custom field values
interfacesMonitoringEnabled enable/disable monitoring of interfaces on this node
snmpTrapPage snmp trap code page
sysLogPage syslog code page
organization name of organization for this node
osMonitorType Name of OS monitor to use. Values: 'auto', 'none', 'windows', 'macOS', 'linux', 'bsd', 'esx', 'solaris'
monitoringProvider Name of the monitoring probe (If parameter is not used or monitoring probe does not exist - NetCrunch Server is a default option

Example

{ "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", "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 }

Status Codes

Status Code Description
200 OK
401 Access denied

Result

The result contains the id of the added node.

{ "id": 1001 }

get-node-properties

Get Node Properties

Get properties of the node based on the filter.

List of all available properties

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=<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=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=name,status"

Python

import requests requests.get('http://localhost/api/rest/2/nodes/192.168.0.25?api_key=<your-api-key>&properties=name,status')

Parameters

Name Description
node identifier Node ID, DNS name or IP Address
filter List of properties. Returns all properties if omitted, a value is "all" or "*"

Status Codes

Status Code Description
200 OK
412 Missing or invalid parameter
401 Access denied
404 Node not found

Example Result

{ "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":[ {"id":"win", "name": "Windows", "enabled":true, "status":"OK", credentials: 'MyPassword', monitoringTime: 4}, {"is":"ntsvc", "name": "Windows Services", "enabled":true, "status":"unknown"}, {"id":"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":[ {"id":"win", "name": "Windows", "enabled":true, "status":"OK", credentials: 'MyPassword', monitoringTime: 4}, {"id":"ntsvc", "name": "Windows Services", "enabled":true, "status":"unknown"}, {"id":"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>" }], "tags": "A,B,C" }

get-node-property

Get Node Property

Get a single property value.

GET/api/rest/2/nodes/<node identifier>/<property>

List of all available properties

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>')

Parameters

Name Description
node identifier Node ID, DNS name or IP Address
property Name of node property to get. The property name can contain a dot to query for sub-property. For example: lastAlert.id or customFields.Info 1

Status Codes

Status Code Description
200 OK
401 Access denied
404 Node not found

Result

The result contains property and value.

{ "name": "email.ac.acme", }

get-list-of-maps-of-the-node

Get List of Views of the Node

Get a list of views of the node. The result is returned as an array of JSON objects.

GET/api/rest/2/nodes/<node identifier>/views

cURL

curl --request GET --url "http://<netcrunch>/api/rest/2/nodes/1001/views?api_key=<api key>"

Node.js

const http = require('http'); http.get('http://localhost/api/rest/2/nodes/1001/views?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/views?api_key=<your-api-key>"

Python

import requests requests.get('http://localhost/api/rest/2/nodes/1001/maps?api_key=<your-api-key>')

Parameters

Name Description
node identifier ID, name or IP address of the node

Status Codes

Status Code Description
200 OK
401 Access denied
404 Node not found

Result

[  {"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

Get List of Monitoring Packs of the Node

Get a list of Monitoring Packs of the node. The list is returned as an array of JSON objects.

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>')

Parameters

Name Description
node identifier ID, name or IP address of the node

Status Codes

Status Code Description
200 OK
401 Access denied
404 Node not found

Result

[  {"id":64,"name":"Basic Windows Monitoring"},  {"id":78,"name":"Node Status"},  {"id":79,"name":"Service Status"} ]

set-node-properties

Set Node Properties

Use a single request to change or set multiple properties of the node. You can use a JSON file as a payload to change multiple properties at once

List of all available properties

PUT/api/rest/2/nodes/<node identifier>

cURL

curl --request PUT --url "http://<netcrunch>/api/rest/2/nodes/1001/name?api_key=<api key>"

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>' } }, data = { "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(data)); req.end();

PowerShell

$url = "http://localhost/api/rest/2/nodes/1001" $data = @{ name='NewNodeName.ac.acme' } $body = (ConvertTo-Json $data) $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)

Parameters

Name Description
node identifier Node ID, DNS name or IP Address
property Name of node property to get. The property name can contain a dot to query for sub-property. For Example, lastAlert.id or customFields.Info 1
value Value to set for the field

Status Codes

Status Code Description
200 OK
401 Access denied
404 Node not found

Result

{ "status": "ok" }

set-node-property

Set Node Property

Change or set a single property of the node.

List of all available properties

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/name', headers: { 'Content-Type': 'application/json', "x-api-key": '<your-api-key>' } }, data = { "value": "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(data)); req.end();

PowerShell

$url = "http://localhost/api/rest/2/nodes/1001/name" $data = @{ value='NewNodeName.ac.acme' } $body = (ConvertTo-Json $data) $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/name' data = { "value": "NewNodeName.ac.acme" } headers = { 'Content-Type': 'application/json', 'x-api-key': '<your-api-key>' } requests.put(url=rul, data=data, headers=headers)

Parameters

Name Description
node identifier Node ID, DNS name or IP Address
property Name of node property to get. The property name can contain a dot to query for sub-property. For example, lastAlert.id or customFields.Info 1
value Value to set for the field

Status Codes

Status Code Description
200 OK
401 Access denied
404 Node not found

Result

{ "id": 1001 }

manage-node-monitoring-state

Manage Node Monitoring State

Enable or disable node monitoring by setting the value to on or off, additionally schedule a time when a node should be disabled and re-enabled

PUT/api/rest/2/nodes/<node identifier>/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: 'PUT', 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 Put -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.put(url=url, data=data, headers=headers)

Parameters

Name Description
node identifier Node ID, DNS name or IP Address
value Values "on" / "off"
disabledFrom Date to disable from. Ignored when value is "on"
disabledUntil Date to disable until. Ignored when value is "on"

Status Codes

Status Code Description
200 OK
401 Access denied
404 Node not found

Result

{ "status": "ok" }

add-network-service

Add Network Service

Add network service to the node. Node identifier and network service name are mandatory if no other parameters are provided program defaults will be used.

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')

Parameters

Name Description
node identifier ID or name or IP address of node
name Name of service to monitor
timeout Specifies the maximum time in milliseconds that NetCrunch should wait for a reply
repeat Number of requests to send in a single check
additionalRepeat Number of additional checks when service is not responding (Error, timeout, etc.)
monitoringTime Time set in minutes

Status Codes

Status Code Description
200 OK
401 Access denied
404 Node not found

Result

{ "status": "ok" }

set-network-services-parameters

Set Network Services Parameters

Modify parameters of monitored network service of a node

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')

Parameters

Name Description
node identifier ID or name or IP address of node
service Name of network service to modify
timeout Specifies the maximum time in milliseconds that NetCrunch should wait for a reply
repeat Number of requests to send in a single check
additionalRepeat Number of additional checks when service is not responding (Error, timeout, etc.)
monitoringTime Time set in minutes
isLeading true/false, Leading Service is a network service designed to be checked as the only service when the node is DOWN

Status Codes

Status Code Description
200 OK
401 Access denied
404 Node not found

Result

{ "status": "ok" }

remove-network-service

Remove Network Service

Remove network service monitoring from the node.

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')

Parameters

Name Description
node identifier ID or name or IP address of node
service Name of network service to remove

Status Codes

Status Code Description
200 OK
401 Access denied
404 Node not found

Result

{ "status": "ok" }

set-custom-field-value

Set Custom Field Value

Set the value of the custom field on a node. The custom field needs to be defined in NetCrunch in order to set the value on it.

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')

Parameters

Name Description
node identifier ID or name or IP address of node
field Name of the custom field to set
value New field value

Status Codes

Status Code Description
200 OK
401 Access denied
404 Node or field not found

Result

{ "status": "ok" }

remove-custom-field-value

Remove Custom Field Value

Remove custom field value from the node.

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>')

Parameters

Name Description
node identifier ID or name or IP address of node
field Name of the custom field to remove

Status Codes

Status Code Description
200 OK
401 Access denied
404 Node or field not found

Result

{ "status": "ok" }

add-secondary-interface

Add Secondary Interface

Add a secondary interface to a node. Both primary and secondary interface nodes must be monitored by NetCrunch.

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>')

Parameters

Name Description
node identifier ID or name or IP address of node
child ID or name or IP address of a node to add

Status Codes

Status Code Description
200 OK
401 Access denied
404 Node or child not found

Result

{ "status": "ok" }

remove-secondary-interface

Remove Secondary Interface

Remove the secondary interface node from the node.

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>')

Parameters

Name Description
node identifier ID or name or IP address of node
child ID or name or IP address of a node to remove

Status Codes

Status Code Description
200 OK
401 Access denied
404 Node or child not found

Result

{ "status": "ok" }

set-sensor-parameters

Set Sensor Parameters

Set parameters of the sensor

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\": \"CredentialProfileName\", \"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": "CredentialProfileName", "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='CredentialProfileName', 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": "CredentialProfileName", "monitoringTime": 5 } headers = { 'Content-Type': 'application/json', 'x-api-key': '<your-api-key>' } response = requests.put(url=url, data=data, headers=headers)

URL Parameters

Name Description
node identifier ID, name, or IP address of a node to delete
sensor UID or name of the sensor to modify. It may be a list of values separated by comma

Data Parameters

Name Description
enabled True/False
credentials Name of credential profile
monitoring time Value in minutes

Status Codes

Status Code Description
200 OK
401 Access denied
404 Node or sensor not found

set-monitoring-engine-parameters

Set Monitoring Engine Parameters

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, \"credentials\": \"<CredentialProfileName>\", \"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, "credentials": "<CredentialProfileName>", "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, credentials='CredentialProfileName', 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, "credentials": "CredentialProfileName", "monitoringTime": 5 } headers = { 'Content-Type': 'application/json', 'x-api-key': '<your-api-key>' } response = requests.put(url=url, data=data, headers=headers)

URL Parameters

Name Description
node identifier ID, name or IP address of a node
engine ID or name of monitoring engine

DataParameters

Name Description
enabled true/false
credentials Name of credential profile
monitoringTime Value in minutes. Set to null to use the default (from the node)

Status Codes

Status Code Description
200 OK
401 Access denied
404 Node or monitoring engine not found

delete-sensor

Delete Sensor

This API has been deprecated for security reasons.

add-node-tag

Add Tag

Add tag to a node.

PUT/api/rest/2/nodes/<node>/tags/<tag>

cURL

curl --request PUT --url "https://localhost/api/rest/2/nodes/192.168.3.10/tags/tagA?api_key=<your-api-key>"

Node.js

const http = require('http'); http.put('https://localhost/api/rest/2/nodes/192.168.3.10/tags/tagA?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 put -Uri "https://localhost/api/rest/2/nodes/192.168.3.10/tags/tagA?api_key=<your-api-key>"

Python

import requests requests.put('https://localhost/api/rest/2/nodes/192.168.3.10/tags/tagA?api_key=<your-api-key>')

Parameters

Name Description
node identifier ID or name or IP address of node
tag Name of the tag to add

Status Codes

Status Code Description
200 OK, tag already exists
201 Created
401 Access denied
404 Node or field not found

Result

{ "status": "ok" }

remove-node-tag

Remove Tag

Remove tag the node.

DELETE/api/rest/2/nodes/<node identifier>/tags/<tag>

cURL

curl --request DELETE --url "https://localhost/api/rest/2/nodes/192.168.3.10/tags/tagA?api_key=<your-api-key>"

Node.js

const http = require('http'); http.delete('https://localhost/api/rest/2/nodes/192.168.3.10/tags/tagA?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/tags/tagA?api_key=<your-api-key>"

Python

import requests requests.delete('https://localhost/api/rest/2/nodes/192.168.3.10/tags/tagA?api_key=<your-api-key>')

Parameters

Name Description
node identifier ID or name or IP address of node
tag Name of the tag to remove

Status Codes

Status Code Description
200 OK
401 Access denied
404 Node or field not found

Result

{ "status": "ok" }

delete-node

Delete Node

Remove the node from the Atlas.

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>')

Parameters

Name Description
node identifier ID, name or IP address of a node to delete

Status Codes

Status Code Description
200 OK
401 Access denied
404 Node not found