Hello there!
Our dev team has created this great tool for us to use on our Linux scripts to unmanaged and manage SolarWinds nodes on the command line.
I'm here sharing it with you guys:
Architecture

Configuration
This library/cli uses the following environment variables:
Env Variable | Description |
---|
SOLARWINDS_USERNAME | Username of SolarWinds API user. |
SOLARWINDS_PASSWORD | Password of SolarWinds API user. |
SOLARWINDS_HOSTNAME | Name of host where SolarWinds API is installed, e.g solarwinds.example.com |
SOLARWINDS_PORT | Port of SolarWinds API, default is 17778 . |
How to Install
$ npm install -g solarwinds
CLI Usage
Usage: solarwinds [options] [command] Commands: node Nodes monitored by SolarWinds. vm Virtual machines accessible by SolarWinds. app-template Application templates. credential Credentials. Options: -h, --help output usage information -V, --version output the version number
Nodes
Nodes monitored by SolarWinds. NODE
can be a node id or a hostname.
Usage: solarwinds node [options] [command] Commands: list|ls lists all available nodes inspect <NODE> displays detailed information about a node unmanage [options] <NODE> Unmanages a node for a duration remanage <NODE> remanage node by id of hostname Options: -h, --help output usage information
node create
Usage: solarwinds node create [options] Create a node Options: -h, --help output usage information --name <value> Node name --hostname <value> Node host name for polling. Has to be resolvable by DNS --community [value] Community string (default '') --ip <value> IP addressnode list
Usage: solarwinds node list|ls [options] List all available nodes Options: --filter <value> Filter output based on conditions provided -h, --help output usage information
Filtering
The filtering flag format is "key=value".
The currently supported filters are:
node inspect
Usage: solarwinds node inspect [options] <NODE> Displays detailed information about a node Options: -h, --help output usage information
node unmanage
Usage: solarwinds node unmanage [options] <NODE> Unmanage a node for a duration Options: -h, --help output usage information -d, --duration <value> Duration, for example 15s, 30m, 3h or 1d
node remanage
Usage: solarwinds node remanage [options] <NODE> Remanage node by id of hostname Options: -h, --help output usage information
node remove
Usage: solarwinds node remove|rm [options] <NODE> Remove node Options: -h, --help output usage information
Application Templates
style="margin-bottom:16px;color:rgb(36, 41, 46);font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';font-size:16px"
vm inspect
Usage: solarwinds vm inspect [options] <VM> Display detailed information about a virtual machine Options: -h, --help output usage information
Library Usage
This library by default uses the environment variables specified above that can be overwritten:
import SolarWinds from 'solarwinds' const solarwinds = new SolarWinds('username', 'password', 'url') ... const nodes = await solarwinds.nodes.query()
Resources
Usage Example
The script bellow inspect the node and if the node exists then it unmanages the node
#!/bin/bash# SolarWinds Unmanage Nodes ##define variablesexport SOLARWINDS_USERNAME="ExampleAPIUser"export SOLARWINDS_PASSWORD="EXampleAPiUserP@ssw0rd"export SOLARWINDS_HOSTNAME=Solarwinds.example.com######################## Unmanage Node######################## inspect solarwinds node inspect `hostname` >\tmp\nodes.txt# verify if node exist if [ $? != 0 ]; then echo "Failed please verify node" >>\tmp\nodes.txt mail -a \tmp\nodes.txt -s "Script SolarWinds Node Unmanaged - `hostname`: failed " youremail@example.com exit 1 fi# unmanage node solarwinds node unmanage --duration 1h `hostname`>>\tmp\nodes.txt mail -a \tmp\nodes.txt -s "SolarWinds Node unmanaged- `hostname`: success" youremail@example.com </dev/null#clean variablesunset SOLARWINDS_USERNAMEunset SOLARWINDS_PASSWORDunset SOLARWINDS_HOSTNAME exit 0
The script bellow inspect the node and if the node exists then it remanages the node
#!/bin/bash# SolarWinds remanage Nodes ##define variablesexport SOLARWINDS_USERNAME="ExampleAPIUser"export SOLARWINDS_PASSWORD="EXampleAPiUserP@ssw0rd"export SOLARWINDS_HOSTNAME=Solarwinds.example.com##################################################################### Remanage Node##################################################################### inspect solarwinds node inspect `hostname` > /tmp/nodes.txt# verify if node exist if [ $? != 0 ]; then echo "Failed Please verify node" >>/tmp/nodes.txt mail -a /tmp/nodes.txt -s "SolarWinds Node not Remanaged- `hostname` " youremail@example.com exit 1 fi# Re Manage solarwinds node remanage `hostname` >> \tmp\nodes.txt mail -a /tmp/nodes.txt -s "SolarWinds Node Remanaged- `hostname` failed " youremai@example.com #clean variablesunset SOLARWINDS_USERNAMEunset SOLARWINDS_PASSWORDunset SOLARWINDS_HOSTNAME exit 0
Disclaimer:
Please note, any custom scripts or other content posted herein are provided as a suggestion or recommendation to you for your internal use. This is not part of the SolarWinds software that you have purchased from SolarWinds, and the information set forth herein may come from third party customers. Your organization should internally review and assess to what extent, if any, such custom scripts or recommendations will be incorporated into your environment. Any custom scripts obtained herein are provided to you “AS IS” without indemnification, support, or warranty of any kind, express or implied. You elect to utilize the custom scripts at your own risk, and you will be solely responsible for the incorporation of the same, if any.