I am trying to use PowerShell to automate adding nodes. I can't not get the volumes to be monitored. I can add them to the database and they show up under the node's summary page, but the volumes have no data. Searching I did find and readhttps://thwack.solarwinds.com/thread/79088?q=Not%20mo, even though I made suer that VolumeType is set to "Fixed Disk" the VolumeTypeID is still showing up as 0.
Here is the part of the code that gets the drive information from WMI, and then adds them to the database:
$drives = Get-WmiObject -Credential ($creds) -ComputerName $Hostname -Class win32_Volume -Filter DriveType=3
foreach ($drive in $drives){
#Getting information from the driver and using it to build requirments in SolarWinds
$DriveCaption = "$($drive.Caption) Label:$($drive.Label) $([Convert]::ToString($drive.SerialNumber, 16))";
$DriveDescrption = "$($drive.Caption) Label:$($drive.Label) Serial Number $([Convert]::ToString($drive.SerialNumber, 16))";
#Adding everything to a hash
$AddDrive = @{
<#
NodeID=$NodeID; # NodeID on which the interface is working on
VolumeIndex= "4";
VolumeTypeID = "4";
Status=1;
#Type ="Fixed Disk";
VolumeType = "Fixed Disk";
Icon ="FixedDisk.gif";
Caption=$DriveCaption;
VolumeDescription=$DriveDescrption;
FullName = "$hostname-$DriveCaption"
PollInterval=120;
StatCollection=15;
RediscoveryInterval=30;
NextRediscovery=[DateTime]::UtcNow;
#>
NodeID=$NodeID;
VolumeType="Fixed Disk";
VolumeTypeID="4";
Icon="FixedDisk.gif";
VolumeIndex="4";
Caption=$DriveCaption;
VolumeDescription=$DriveDescrption;
#status=1
FullName = "$hostname-$DriveCaption"
PollInterval="120";
StatCollection="15";
RediscoveryInterval="30";
#NextRediscovery=[DateTime]::UtcNow;
}
#Inserting drives to be monitored into the database
$driveURI = New-swisobject $swis -EntityType "Orion.volumes" -properties $AddDrive
Here is the code that is adding the pollers and the pollers that I am adding:
function AddPoller($PollerType){
Write-Verbose "Adding $pollertype to database"
#Getting the first part of the WMI string before the period (.), which Solarwinds needs for it's database.
$NetobjectPrefix = $Pollertype.split("{.}")
#setting params for the database fields
$poller["PollerType"]=$PollerType;
$poller["NetObject"]= $NetObjectprefix[0] +":"+$nodeid;
$poller["NetobjectType"] = $NetobjectPrefix[0];
$poller["NetObjectID"] = $nodeid;
#Adding to the database
$pollerUri = New-SwisObject $swis -EntityType "Orion.Pollers" -Properties $poller
}
Addpoller("I.StatisticesErrors32.SNMP.IfTable")
Addpoller("I.StatisticsTraffic.SNMP.Universal");
Addpoller("I.Status.SNMP.IfTable");
Addpoller("I.Rediscovery.SNMP.IfTable");
Addpoller("N.Status.ICMP.Native");
Addpoller("N.ResponseTime.ICMP.Native");
Addpoller("N.Details.WMI.Vista");
Addpoller("N.CPU.WMI.Windows");
Addpoller("N.Uptime.WMI.XP");
Addpoller("N.CPU.WMI.Windows");
Addpoller("N.Memory.WMI.Windows");
Addpoller("N.AssetInventory.Wmi.Generic");
Addpoller("V.Details.SNMP.Generic");
Addpoller("V.Statistics.SNMP.Generic");
Addpoller("V.Status.SNMP.Generic");
If I add the node via the web portal, everything is monitored. I pulled the pollers from this test. If I added them to the database myself, it doesn't seem to work properly.