6 Replies Latest reply on Jul 2, 2015 3:17 PM by mr_future

    SDK Monitor Volumes

    mr_future

      Hello,

       

      I have a powershell script where I add an Orion node and assign application templates to the node.  The missing piece of the puzzle would be to add monitoring for all disks.  Does anyone have an example of scripting this?

      Screen Shot 2015-07-01 at 4.58.02 PM.png

        • Re: SDK Monitor Volumes
          tdanner

          The technique described in this post might do what you want: Triggering discovery of SNMPV2 device through JSON API

          • Re: SDK Monitor Volumes
            mr_future

            I am getting close!  With my PS script, I have managed to check the "/" resource.  I have also added a volume, "/", which shows accurate statistics.  The only issue is that the volume is not listed under AppStack.  Even though I am setting the VolumeTypeID to "4", it shows as "0" in the database manager.  Any thoughts?

             

            $newVolumeProps = @{

                NodeID=$nodeProps["NodeID"];

                VolumeType="Fixed Disk";

                VolumeTypeID="4";

                VolumeSize="14701412352";

                Icon="FixedDisk.gif";

                VolumeIndex="31";

                Caption="/";

                VolumeDescription="/";

                PollInterval="300";

                StatCollection="15";

                RediscoveryInterval="30";

                FullName="Changeme";

                }

             

            $newUri = New-SwisObject $swis –EntityType "Orion.Volumes" –Properties $newVolumeProps

             

            #$newVolUri = New-SwisObject $swis –EntityType "Orion.Volumes" –Properties $newVolProps

            $VolProps = Get-SwisObject $swis -Uri $newUri

             

            ## Disk Poller

            $poller = @{

              NetObject="V:"+$VolProps['VolumeID'];

              NetObjectType="V";

              NetObjectID=$VolProps['VolumeID'];

            }

            # Details

            foreach ($pollerType in @('V.Status.SNMP.Generic','V.Details.SNMP.Generic','V.Statistics.SNMP.Generic')) {

                $poller["PollerType"]=$pollerType;

                $pollerUri = New-SwisObject $swis -EntityType "Orion.Pollers" -Properties $poller

            }

              • Re: SDK Monitor Volumes
                tdanner

                I think you need two more instances of Orion.Pollers with the PollerType values V.Statistics.SNMP.Generic and V.Status.SNMP.Generic.

                 

                For an example of calling the discovery API using PowerShell, see this post: Re: Re: How do we programmatically discover the non-interface properties [in Orion] and enable them

                  • Re: SDK Monitor Volumes
                    mr_future

                    Thank you for the reply.  The script in the link does not meet my requirements because:

                     

                    1- I want to assign application monitor templates when creating the node.

                    2- I do not want to monitor the interface, because it uses up an NPM license seat.

                     

                    Could you be more specific on how I would add two more instances of Orion.Pollers?

                     

                    Thanks,

                     

                    Brandt

                      • Re: SDK Monitor Volumes
                        tdanner

                        Looks like I misread the script. You are already adding all of the appropriate pollers.

                         

                        You correctly identified the problem with AppStack when you said, "Even though I am setting the VolumeTypeID to "4", it shows as "0" in the database manager. "

                         

                        I went through the code to figure out why your VolumeTypeID property value is not being honored. The way it works is that it is ignoring the VolumeTypeID you pass in and instead taking the VolumeType value and looking it up in a table in the code to get the corresponding VolumeTypeID number. And the table in the code has "FixedDisk", not "Fixed Disk", so you just get 0.

                         

                        Change "Fixed Disk" to "Fixed Disk" in your script and see if the volume starts showing up in AppStack.

                         

                        I'll open a bug for this.