This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Add Volume via SDK

Hi all,

I wonder to add volume (disk) for any node via SWIS/Orion SDK. Is it possible? If it is possible can you give me an example script?

volume.png

  • I researched but did not found like "Orion.Volume" verb to add volume. Maybe you can help me about that subject. I don't know to implemented/supported that verb.

  • You can find sample scripts in "C:\Program Files (x86)\SolarWinds\Orion SDK\Samples\PowerShell". We have examples for adding nodes and interfaces. Orion.Volumes can be created in the same way with its properties assigned.

    I have provided an sample powershell script for creating volumes.

    $Target="localhost"

        # Connect to SWIS with default admin credentials

        $swis = Connect-Swis -host $Target -UserName admin -Password ""

    $newVolumeProps = @{
    NodeID="4";
    VolumeType="RAM";
    VolumeSize="345234";
    Icon="RAM.gif";
    Index="1";
    Caption="RAM Caption";
    VolumeDescription="D:\";
    PollInterval="120";
    StatCollection="10";
    RediscoveryInterval="20";
    StatusIcon="Up.gif";
    FullName="D:\ RAM Caption";
    Responding="";
    VolumePercentUsed="";
    VolumeAllocationFailuresThisHour="";
    VolumeSpaceUsed="";
    VolumeAllocationFailuresToday="";
    VolumeSpaceAvailable="";
    DiskQueueLength="";
    DiskTransfer="";
    DiskReads="";
    DiskWrites="";
    TotalDiskIOPS="";
    }

    $newUri = New-SwisObject $swis –EntityType "Orion.Volumes" –Properties $newVolumeProps
  • Thanks madravan. I try to this code and inform you.

  • Hi again,

    I try that below code (also yours). I succesfuly added volume but I can't see on list resources. Is there any wrong that code?

    Maybe I have to add volume detail-statistics pollers?

                Objs.PropBag_Volume pbv = new Objs.PropBag_Volume();

                pbv.Caption = "Physical Memory";

                pbv.FullName = "Physical Memory";

                pbv.Icon = "RAM.gif";

                pbv.Index = "1";

                pbv.NodeID = "8";

                pbv.PollInterval = "120";

                pbv.RediscoveryInterval = "30";

                pbv.Responding = "Y";

                pbv.StatCollection = "15";

                pbv.StatusIcon = "Up.gif";

                pbv.Status = "1";

                pbv.VolumeDescription = "Physical Memory";

                pbv.VolumePercentUsed = DBNull.Value.ToString();

                pbv.VolumeSize = "0";

                pbv.VolumeSpaceAvailable = DBNull.Value.ToString();

                pbv.VolumeSpaceUsed = DBNull.Value.ToString();

                pbv.VolumeType = "RAM";

                pbv.VolumeTypeID = "2";

                pbv.VolumeResponding = "Y";

                string vl = vpc.AddVolume(pbv);

  • Hi again,

    I did finally. At least "Physical Memory", the must columns are "VolumeSpaceAvailable" and "NextRediscovery". If they are null value, on the volume detail screen took an error "Specified cast is not valid".

    First step is adding volume. Second is adding pollers. Finally, if change/set next rediscovery value, there is no problem on volume detail and we get details about that.

    Thanks madhavan