ノード
Nodes APIは、NetCrunchからノードデータにアクセス、変更、追加、削除する多くの可能性を提供します。スクリプトや外部アプリケーションを介してNetCrunchを管理するために使用できます。
add-node
ノード追加
アトラスにノードを追加し、監視を有効にします。"name" または "networkAddress" は必須で、残りのプロパティはオプションです。
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, data=data, headers=headers)
| フィールド名 | 説明 |
|---|---|
| name | DNS名 |
| networkAddress | IPアドレス |
| networkPrefixLength | ネットワークマスクのプレフィックス長 |
| displayName | ノードの表示名 |
| organization | 組織の名前。APIで使用する前にNetCrunchに追加する必要があります |
| snmpManaged | true / false-ノードでSNMP監視を有効にします |
| snmpProfile | SNMPプロフィール名 |
| snmpPort | SNMPポート番号 |
| snmpTimeout | SNMP監視のタイムアウト値 [ミリ秒] |
| snmpRetryCount | SNMP監視のリトライ回数 |
| networkServices | 監視対象のネットワークサービスのリスト |
| monitoringTime | 監視時間 [分] |
| dependsOnNode | このノードのID /名前/IPアドレス |
| identification | 監視のためのノード識別。値:「default」、「ipAddress」、「dnsName」、「macAddress」 |
| deviceType | デバイスタイプ |
| parentNode | 親ノードのID /名前/IPアドレス |
| children | このノードの子を表すノードID /名前/IPアドレスのリスト |
| enabled | このノードの監視を有効/無効設定(true / false) |
| simplifiedMonitoring | 単純監視の有効/無効設定 (true / false) |
| disabledFrom | 監視の無効化 |
| disabledUntil | 監視を無効に設定 |
| customFields | カスタムフィールド値のリスト |
| interfacesMonitoringEnabled | このノード上のインターフェース監視の有効/無効 |
| snmpTrapPage | SNMPトラップコードページ |
| sysLogPage | syslogコードページ |
| organization | このノードの組織の名前 |
| osMonitorType | 使用するOSモニターの名前。値:「auto」、「none」、「windows」、「macOS」、「linux」、「bsd」、「esx」、「solaris」 |
例
{ "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 }
ステータスコード
| ステータスコード | 説明 |
|---|---|
| 200 | OK |
| 401 | アクセスが拒否されました |
結果
結果には、追加されたノードのIDが含まれます。
{ "id": 1001 }
get-node-properties
ノードプロパティの取得(複数)
フィルターに基づいてノードのプロパティを取得します。
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')
パラメータ
| Name | 説明 |
|---|---|
| node identifier | ノードID、DNS名、またはIPアドレス |
| filter | プロパティのリスト。省略された場合、すべてのプロパティを返します。値は「all」または「*」です |
ステータスコード
| ステータスコード | 説明 |
|---|---|
| 200 | OK |
| 412 | パラメータが欠落しているか無効です |
| 401 | アクセスが拒否されました |
| 404 | ノードが見つかりません |
実行例
{ "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
ノードプロパティの取得
単一のプロパティ値を取得
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>')
パラメータ
| 名前 | 説明 |
|---|---|
| node identifier | ノードID、DNS名、またはIPアドレス |
| property | 取得するノードプロパティの名前。プロパティ名には、サブプロパティを照会するためのドットを含めることができます。例:lastAlert.idまたはcustomFields.Info 1 |
ステータスコード
| ステータスコード | 説明 |
|---|---|
| 200 | OK |
| 401 | アクセスが拒否されました |
| 404 | ノードが見つかりません |
結果
結果にはプロパティと値が含まれます
{ "name": "email.ac.acme", }
get-list-of-maps-of-the-node
ノードのマップのリストを取得
ノードのビューのリストを取得します。結果は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>')
パラメータ
| 名前 | 詳細 |
|---|---|
| node identifier | ノードのID、名前、またはIPアドレス |
ステータスコード
| ステータスコード | 説明 |
|---|---|
| 200 | OK |
| 401 | アクセスが拒否されました |
| 404 | ノードが見つかりません |
結果
[ {"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
ノードの監視パックのリストを取得する
ノードの監視パックのリストを取得すると、リストは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>')
パラメータ
| 名前 | 説明 |
|---|---|
| node identifier | ノードのID、名前、またはIPアドレス |
ステータスコード
| ステータスコード | 説明 |
|---|---|
| 200 | OK |
| 401 | アクセスが拒否されました |
| 404 | ノードが見つかりません |
結果
[ {"id":64,"name":"Basic Windows Monitoring"}, {"id":78,"name":"Node Status"}, {"id":79,"name":"Service Status"} ]
set-node-properties
ノードプロパティの設定(複数)
単一の要求を使用して、ノードの複数のプロパティを変更または設定します。JSONファイルをペイロードとして使用して、複数のプロパティを一度に変更できます
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', 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, data=data, headers=headers)
パラメータ
| 名前 | 説明 |
|---|---|
| node identifier | ノードID、DNS名、またはIPアドレス |
| property | 取得するノードプロパティの名前。プロパティ名には、サブプロパティを照会するためのドットを含めることができます。たとえば、lastAlert.idまたはcustomFields.Info 1 |
| value | フィールドに設定する値 |
ステータスコード
| ステータスコード | 説明 |
|---|---|
| 200 | OK |
| 401 | アクセスが拒否されました |
| 404 | ノードが見つかりません |
結果
{ "status": "ok" }
set-node-property
ノードプロパティの設定
ノードの単一のプロパティを変更または設定します。
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', 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, data=data, headers=headers)
パラメータ
| 名前 | 説明 |
|---|---|
| node identifier | ノードID、DNS名、またはIPアドレス |
| property | 取得するノードプロパティの名前。プロパティ名には、サブプロパティを照会するためのドットを含めることができます。たとえば、lastAlert.idまたはcustomFields.Info 1 |
| value | フィールドに設定する値 |
ステータスコード
| ステータスコード | 説明 |
|---|---|
| 200 | OK |
| 401 | アクセスが拒否されました |
| 404 | ノードが見つかりません |
結果
{ "id": 1001 }
manage-node-monitoring-state
ノード監視状態の管理
値をオンまたはオフに設定してノード監視を有効または無効にし、さらにノードを無効にしてから再度有効にする時間をスケジュールします
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: '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, data=data, headers=headers)
パラメータ
| 名前 | 説明 |
|---|---|
| node identifier | ノードID、DNS名、またはIPアドレス |
| value | ”on”:監視有効化、”off”:監視無効化 |
| disabledFrom | 監視無効化を開始する日付。”value” が ”on” の場合は無視されます |
| disabledUntil | 監視無効化を終了する日付。"value" が ”on” の場合は無視されます |
ステータスコード
| ステータスコード | 説明 |
|---|---|
| 200 | OK |
| 401 | アクセスが拒否されました |
| 404 | ノードが見つかりません |
結果
{ "status": "ok" }
add-network-service
ネットワークサービスを追加
ノードにネットワークサービスを追加します。他のパラメータが提供されない場合、ノード識別子とネットワークサービス名は必須です。プログラムのデフォルトが使用されます。
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')
パラメータ
| 名前 | 説明 |
|---|---|
| node identifier | ノードのIDまたは名前またはIPアドレス |
| name | 監視するサービスの名前 |
| timeout | NetCrunchが応答を待つ最大時間をミリ秒で指定します |
| repeat | 1回のチェックで送信するリクエストの数 |
| additionalRepeat | サービスが応答しない場合の追加チェックの数(エラー、タイムアウトなど) |
| monitoringTime | 分単位で設定された時間 |
ステータスコード
| ステータスコード | 説明 |
|---|---|
| 200 | OK |
| 401 | アクセスが拒否されました |
| 404 | ノードが見つかりません |
結果
{ "status": "ok" }
set-network-services-parameters
ネットワークサービスパラメータの設定
ノードの監視対象ネットワークサービスのパラメータを変更する
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')
パラメータ
| 名前 | 説明 |
|---|---|
| node identifier | ノードのIDまたは名前またはIPアドレス |
| service | 変更するネットワークサービスの名前 |
| timeout | NetCrunchが応答を待つ最大時間をミリ秒で指定します |
| repeat | 1回のチェックで送信するリクエストの数 |
| additionalRepeat | サービスが応答しない場合の追加チェックの数(エラー、タイムアウトなど) |
| monitoringTime | 分単位で設定された時間 |
| isLeading | true / false、Leading Serviceは、ノードがダウンしているときに、唯一のサービスとしてチェックされるように設計されたネットワークサービスです |
ステータスコード
| ステータスコード | 説明 |
|---|---|
| 200 | OK |
| 401 | アクセスが拒否されました |
| 404 | ノードが見つかりません |
結果
{ "status": "ok" }
remove-network-service
ネットワークサービスを削除する
ノードからネットワークサービスの監視を削除する
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')
パラメータ
| 名前 | 説明 |
|---|---|
| node identifier | ノードのIDまたは名前またはIPアドレス |
| service | 削除するネットワークサービスの名前 |
ステータスコード
| ステータスコード | 説明 |
|---|---|
| 200 | OK |
| 401 | アクセスが拒否されました |
| 404 | ノードが見つかりません |
結果
{ "status": "ok" }
set-custom-field-value
カスタムフィールド値の設定
ノードのカスタムフィールドの値を設定します。値を設定するには、カスタムフィールドをNetCrunchで定義する必要があります。
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')
パラメータ
| 名前 | 説明 |
|---|---|
| node identifier | ノードのIDまたは名前またはIPアドレス |
| field | 設定するカスタムフィールドの名前 |
| value | 新しいフィールド値 |
ステータスコード
| ステータスコード | 説明 |
|---|---|
| 200 | OK |
| 401 | アクセスが拒否されました |
| 404 | ノードまたはフィールドが見つかりません |
結果
{ "status": "ok" }
remove-custom-field-value
カスタムフィールド値を削除
ノードからカスタムフィールド値を削除します。
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>')
パラメータ
| 名前 | 説明 |
|---|---|
| node identifier | ノードのIDまたは名前またはIPアドレス |
| field | 削除するカスタムフィールドの名前 |
ステータスコード
| ステータスコード | 説明 |
|---|---|
| 200 | OK |
| 401 | アクセスが拒否されました |
| 404 | ノードまたはフィールドが見つかりません |
結果
{ "status": "ok" }
add-secondary-interface
セカンダリインターフェイスを追加
ノードにセカンダリインターフェイスを追加します。プライマリとセカンダリの両方のインターフェイスノードは、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>')
パラメータ
| 名前 | 説明 |
|---|---|
| node identifier | ノードのIDまたは名前またはIPアドレス |
| child | 追加するノードのIDまたは名前またはIPアドレス |
ステータスコード
| ステータスコード | 説明 |
|---|---|
| 200 | OK |
| 401 | アクセスが拒否されました |
| 404 | ノードまたは子が見つかりません |
結果
{ "status": "ok" }
remove-secondary-interface
セカンダリインターフェイスを削除
ノードからセカンダリインターフェイスノードを削除します
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>')
パラメータ
| 名前 | 説明 |
|---|---|
| node identifier | ノードのIDまたは名前またはIPアドレス |
| child | 削除するノードのIDまたは名前またはIPアドレス |
ステータスコード
| ステータスコード | 説明 |
|---|---|
| 200 | OK |
| 401 | アクセスが拒否されました |
| 404 | ノードまたは子が見つかりません |
結果
{ "status": "ok" }
set-sensor-parameters
センサーパラメータの設定
センサーのパラメータを設定する
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, data=data, headers=headers)
URL パラメータ
| 名前 | 説明 |
|---|---|
| node identifier | 削除するノードのID、名前、またはIPアドレス |
| sensor | 変更するセンサーのUIDまたは名前。コンマで区切られた値のリストである場合があります |
Data パラメータ
| 名前 | 説明 |
|---|---|
| enabled | True/False |
| credentials | 資格情報プロファイルの名前 |
| monitoring time | 分単位の値 |
ステータスコード
| ステータスコード | 説明 |
|---|---|
| 200 | OK |
| 401 | アクセスが拒否されました |
| 404 | ノードまたはセンサーが見つかりません |
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\": \"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, "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/monitoring-engines/Windows" $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/monitoring-engines/Windows' data = { "enabled": true, "credentials": "CredentialsProfile", "monitoringTime": 5 } headers = { 'Content-Type': 'application/json', 'x-api-key': '<your-api-key>' } response = requests.put(url, data=data, headers=headers)
URL パラメータ
| 名前 | 説明 |
|---|---|
| node identifier | ノードのID、名前、またはIPアドレス |
| engine | 監視エンジンのIDまたは名前 |
Dataパラメータ
| 名前 | 説明 |
|---|---|
| enabled | true/false |
| credentials | 資格情報プロファイルの名前 |
| monitoringTime | 分単位の値。デフォルトを使用するには、nullに設定します(ノードから) |
ステータスコード
| ステータスコード | 説明 |
|---|---|
| 200 | OK |
| 401 | アクセスが拒否されました |
| 404 | ノードまたは監視エンジンが見つかりません |
delete-sensor
センサーを削除
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, headers=headers)
パラメータ
| 名前 | 説明 |
|---|---|
| node identifier | 削除するノードのID、名前、またはIPアドレス |
| sensor | 変更するセンサーのUIDまたは名前。コンマで区切られた値のリストである場合があります |
ステータスコード
| ステータスコード | 説明 |
|---|---|
| 200 | OK |
| 401 | アクセスが拒否されました |
| 404 | ノードまたはセンサーが見つかりません |
delete-node
ノードを削除
アトラスからノードを削除します
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>')
パラメータ
| 名前 | 説明 |
|---|---|
| node identifier | 削除するノードのID、名前、またはIPアドレス |
ステータスコード
| ステータスコード | 説明 |
|---|---|
| 200 | OK |
| 401 | アクセスが拒否されました |
| 404 | ノードが見つかりません |