Quantcast
Channel: THWACK: Popular Discussions - Orion SDK
Viewing all articles
Browse latest Browse all 3719

Adding of interfaces to a node. XML?

$
0
0

Hello everyone!

 

I'm moving along in my scripting adventure with the SDK and PowerShell but I've hit a snag when it comes to handling the addition of interfaces. I'm looking at the example given after installing the SDK and it looks just like adding a node, awesome! But when I try to add an interface to a node I'm getting an error back stating that '

A positional parameter cannot be found that accepts argument '.'.'

 

I'm looking at the verbs and I'm seeing XML but the sample script does not show any need for XML. Has this changed?

 

My code below:

#Function to add Interfaces

##############################################################

function AddInterface ($NewNodeID, $InterfaceInfo, $Pollers)

{

Write-Host "Entering AddInterface Function"

$AllInterfacePollers = Get-SwisData $swis "Select Distinct PollerType from Orion.Pollers Where NetObjectType = 'I'"

 

 

 

 

    foreach ($Interface in $InterfaceInfo)

    {

    $InterfaceIndex = $Interface.Interfaceindex

    Write-Host "Interface index: $InterfaceIndex"

    $Caption = $Interface.InterfaceName

    Write-Host "Interface name: $Caption"

   

    $newIfaceProps = @{

        NodeID=$NewNodeID; # NodeID on which the interface is working on

        InterfaceName=$Caption; # description name of the interface to add

        InterfaceIndex=$InterfaceIndex;

        ObjectSubType="SNMP";

        Status=0;

        RediscoveryInterval=5;

        PollInterval=120;

        StatCollection=10;

            }

   

    $newIfaceUri = New-SwisObject $swis -EntityType "Orion.NPM.Interfaces" -Properties $newIfaceProps.

    $ifaceProps = Get-SwisObject $swis -Uri $newIfaceUri

   

    $newIfaceUri

 

 

    ForEach ($PollerAdd in $Pollers){

    IF($AllInterfacePollers -contains $PollerAdd)

    {

    Write-Host "Found Poller $PollerAdd"

      $poller = @{

        PollerType="$PollerAdd";

        NetObject="I:"+$ifaceProps["InterfaceID"];

        NetObjectType="I";

        NetObjectID=$ifaceProps["InterfaceID"];

        }

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

    $pollerUri

    }

    }

 

    }

Write-Host "Exiting AddInterface function"

 

 

}


Viewing all articles
Browse latest Browse all 3719

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>