We are trying to automate the server build process so wanted to know how to add node in solarwinds using powershell for monitoring.
Correct this is for a single node but you can always use a foreach loop to go through a list,
I have a CSV file with all the nodes and there details
and then use this to loop through:
$Nodes = import-csv -path "c:\scripts\book1.csv"
Foreach ($Node in $Nodes)
{
$NewNode = Orion-AddNode -SwisConnection $Swis -NodeName $Node.NodeName -NodeIPAddress $Node.NodeIPAddress -PollingEngineID $Node.PollingEngineID -PollingMethod $Node.PollingMethod -SNMPV2Community $Node.SNMPV2Community
$NodeProperties = Get-SwisObject $swis -Uri $NewNode
$PollerAdds = Orion-SetStdDevicePollers -SwisConnection $Swis -NodeID $NodeProperties.NodeID -PollingType $Node.PollingMethod
$HHPolling = Orion-SetHardwareHealthSensors -SwisConnection $Swis -NodeID $NodeProperties.NodeID -Action Enable -Manufacturer $Node.NodeManufacturer
$PollNodeID = $NodeProperties.OrionIdPrefix + $NodeProperties.NodeID
$PollNow = Invoke-SwisVerb $Swis Orion.Nodes PollNow @($PollNodeID)
}
Both files are attached.
Start here: GitHub - solarwinds/OrionSDK: SDK for the SolarWinds Orion platform, including tools, documentation, and samples in Powe…
I cracked this one last week, not near my laptop for a few days but will try and post something early next week for you.
It's all possible but took a bit of fiddling in our lab instance to get right.
Hi ,
Can you share the idea with us, so that it will helpful to all.
Attached is an early version of my code that i used before our CMDB integration got involved
You'll find three functions at the top:
Orion-AddNode - This creates either an ICMP or SNMP V2 Node
Orion-SetStdDevicePollers - This assigns either the standard ICMP or SNMP Pollers, doesn't include any custom pollers and may be missing anything new
Orion-SetHardwareHealthSensors - This assigns the HH sensors and you have to specify the hardware manufacturer for it to work.
The rest of the script is the variables for the node your adding and the script itself.
It assumes you have the SwisPowerShell module installed and loaded and your Swis connection is called $Swis.
Good luck
Is it for single node, right? How about multiple nodes?
/MSARKAR
Hi,
very new to this. Actually first day looking at it. I want to automated adding new firewalls to Solarwinds NCM.
I've seen elsewhere that $swis is defined as :
$swis = Connect-Swis -UserName admin -Password "" -Hostname 10.20.30.40
I don't see $swis defined in your script.
Also how do you add a node so that polling is snmpv3? All our firewalls are using snmpv3 now.
I defined $swis in the script, edited the properties at the end (nodename, IP address, manufacturer) and ran it and got this error:
New-SwisObject : The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:00:59.9899819'.
thanks
Roger
> I don't see $swis defined in your script.
Pretty much every code sample will need to define a connection to SWIS. The exact details will depend on your environment (server, credentials). There are details about how to do that here:
PowerShell · solarwinds/OrionSDK Wiki · GitHub
> Also how do you add a node so that polling is snmpv3?
In the sample script, you'll notice these node properties being defined:
$NewSNMPV2NodeProps = @{
IPAddress = $NodeIPAddress;
EngineID = $PollingEngineID;
Caption = $NodeName;
ObjectSubType =$PollingMethod;
Community = $SNMPV2Community;
SNMPVersion = "2";
DNS = "";
SysName = "";
If you update the SNMPVersion property from "2" to "3", you'll change the protocol version. You would probably also want to update a bunch of variable names that refer to SNMPV2 for clarity.
> I defined $swis in the script, edited the properties at the end (nodename, IP address, manufacturer) and ran it and got this error:
> New-SwisObject : The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:00:59.9899819'.
There are several possible causes for this error. You might want to look through the articles here:
https://support.solarwinds.com/SuccessCenter/s/global-search/%40uri#q=The%20socket%20connection%20was%20aborted&t=All&sort=relevancy
You may also want to check the SWIS logs on the Orion server right after making a request. Be default, those logs are at this location:
C:\ProgramData\SolarWinds\InformationService\v3.0
If we are using SNMPV3 how do we specify the username and password?