Overview
Resources
Os_Commands: Get System commands
Get System commands.
GET https://{device}/api/npm.os_commands/1.0/os_commandsAuthorization
This request requires authorization.
Response BodyOn success, the server returns a response body with the following structure:
- JSON
[ { "items": [ { "command": string, "output": string } ], "ipaddr": string, "name": string } ] Example: [ { "items": [ { "output": "lo Link encap:Local Loopback \n inet addr:127.0.0.1 Mask:255.0.0.0\n inet6 addr: ::1/128 Scope:Host\n UP LOOPBACK RUNNING MTU:65536 Metric:1\n RX packets:53900081 errors:0 dropped:0 overruns:0 frame:0\n TX packets:53900081 errors:0 dropped:0 overruns:0 carrier:0\n collisions:0 txqueuelen:0 \n RX bytes:175385250325 (163.3 GiB) TX bytes:175385250325 (163.3 GiB)\n\nprimary Link encap:Ethernet HWaddr 00:25:50:4F:1B:20 \n inet addr:10.38.128.128 Bcast:10.38.191.255 Mask:255.255.192.0\n inet6 addr: 2600:809:200:1a02:225:50ff:fe4f:1b20/64 Scope:Global\n inet6 addr: fe80::225:50ff:fe4f:1b20/64 Scope:Link\n UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1\n RX packets:96257647 errors:0 dropped:0 overruns:0 frame:0\n TX packets:6749582 errors:0 dropped:0 overruns:0 carrier:0\n collisions:0 txqueuelen:1000 \n RX bytes:64336335376 (59.9 GiB) TX bytes:809423309 (771.9 MiB)\n Interrupt:18 Memory:b8820000-b8840000", "command": "ifconfig" }, { "output": "Kernel IP routing table\nDestination Gateway Genmask Flags MSS Window irtt Iface\n10.38.128.0 0.0.0.0 255.255.192.0 U 0 0 0 primary\n0.0.0.0 10.38.128.1 0.0.0.0 UG 0 0 0 primary\nKernel IPv6 routing table\nDestination Next Hop Flags Metric Ref Use Iface\n2600:809:200:1a02::/64 :: UA 256 0 0 primary \nfe80::/64 :: U 256 0 0 primary \n::/0 fe80::214:1bff:fea7:3400 UGDA 1024 0 0 primary \n::1/128 :: U 0 394471 8 lo \n2600:809:200:1a02:225:50ff:fe4f:1b20/128 :: U 0 476 1 lo \nfe80::225:50ff:fe4f:1b20/128 :: U 0 0 1 lo \nff00::/8 :: U 256 0 0 primary", "command": "netstat -nr -Ainet -Ainet6" }, { "output": "? (10.38.128.1) at 00:14:1b:a7:34:00 [ether] on primary\n? (10.38.130.53) at 00:0e:b6:4c:e1:38 [ether] on primary\n? (10.38.130.25) at 00:0e:b6:4c:e0:81 [ether] on primary\n? (10.38.131.75) at ac:1f:6b:41:6c:68 [ether] on primary\n? (10.38.130.51) at a0:42:3f:3a:a9:85 [ether] on primary", "command": "arp -an" }, { "output": "Linux module-1 2.6.32-573.65.2.el6.rvbd.1.x86_64 #1 SMP PREEMPT Mon Oct 29 09:03:41 EDT 2018 x86_64 x86_64 x86_64 GNU/Linux", "command": "uname -a" }, { "output": "Linux version 2.6.32-573.65.2.el6.rvbd.1.x86_64 (mazu@module-1) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC) ) #1 SMP PREEMPT Mon Oct 29 09:03:41 EDT 2018", "command": "cat /proc/version" }, { "output": "MemTotal: 16196544 kB", "command": "(cat /proc/meminfo | grep MemTotal)" } ], "ipaddr": "10.38.128.128", "name": "module-1" } ]
Property Name | Type | Description | Notes |
---|---|---|---|
RootOSCommands | <array of <object>> | System commands. | |
RootOSCommands[SystemOSCommands] | <object> | System commands. | Optional |
RootOSCommands[SystemOSCommands].items | <array of <object>> | System commands per module. | Optional |
RootOSCommands[SystemOSCommands].items [OSCommand] |
<object> | System commands per module. | Optional |
RootOSCommands[SystemOSCommands].items [OSCommand].command |
<string> | System command. | |
RootOSCommands[SystemOSCommands].items [OSCommand].output |
<string> | System command output. | |
RootOSCommands[SystemOSCommands].ipaddr | <string> | Module IP address. | Optional |
RootOSCommands[SystemOSCommands].name | <string> | Module host name. | Optional |
Error Codes
In the event that an error occurs while processing a request, the server will respond with appropriate HTTP status code and additional information in the response body:
{ "error_id": "{error identifier}", "error_text": "{error description}", "error_info": {error specific data structure, optional} }
The table below lists the possible errors and the associated HTTP status codes that may returned.
Error ID | HTTP Status | Comments |
---|---|---|
INTERNAL_ERROR | 500 | Internal server error. |
AUTH_REQUIRED | 401 | The requested resource requires authentication. |
AUTH_INVALID_CREDENTIALS | 401 | Invalid username and/or password. |
AUTH_INVALID_SESSION | 401 | Session ID is invalid. |
AUTH_EXPIRED_PASSWORD | 403 | The password must be changed. Access only to password change resources. |
AUTH_DISABLED_ACCOUNT | 403 | Account is either temporarily or permanently disabled. |
AUTH_FORBIDDEN | 403 | User is not authorized to access the requested resource. |
AUTH_INVALID_TOKEN | 401 | OAuth access token is invalid. |
AUTH_EXPIRED_TOKEN | 401 | OAuth access token is expired. |
AUTH_INVALID_CODE | 401 | OAuth access code is invalid. |
AUTH_EXPIRED_CODE | 401 | OAuth access code is expired. |
RESOURCE_NOT_FOUND | 404 | Requested resource was not found. |
HTTP_INVALID_METHOD | 405 | Requested method is not available for this resource. |
HTTP_INVALID_HEADER | 400 | An HTTP header was malformed. |
REQUEST_INVALID_INPUT | 400 | Malformed input structure. |
URI_INVALID_PARAMETER | 400 | URI parameter is not supported or malformed. |
URI_MISSING_PARAMETER | 400 | Missing required parameter. |