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.

SQL - Bulk update Interface Statistics interval

Hey Guys,

I have a requirement to change interface statistics collection to a non global setting based on a custom property on the node level. I have the query where I pull the NodeID that match the criteria and I know the Interface properties to key on, (these are backup interfaces so we don't need the frequency of stats that are global default)

I want to know if its simply changing the column value StatCollection in the Orion.NPM.Interfaces table.

Something along the lines of

update Orion.NPM.Interfaces

set StatCollection = '30'

where NodeID = 'XYZ'

  • That's basically correct, but you don't do it with an "update where" query - SWQL only does SELECT. To modify the data, first get the Uris of the objects to modify, then call an Update operation on them. In PowerShell you do this via the Set-SwisObject cmdlet. Something like this:

    $swis = Connect-Swis [connection options go here]

    $uris = Get-SwisData $swis "SELECT Uri FROM Orion.NPM.Interfaces WHERE NodeID=@nodeid" @{nodeid=1234}

    $uris | Set-SwisData $swis @{StatCollection=30}

  • Ah ok, I was just going to do it from SQL Server Query, but I will make this a API script and do it as you demonstrated.

    Thanks Tim.

  • This isn't working and I have no idea why........

        #!/usr/bin/perl

        use SOAP::Transport::HTTP;

        use XML::Simple;

        use SW::Orion;

        use SW::InformationService;

        use strict;

        my $hostname = '10.224.254.203'; # fill in a hostname

        my $username = 'XXXX';

        my $password = 'XXX';

        my $endpoint = "https://$hostname:17778/SolarWinds/InformationService/OrionBasic";

        my $xs = XML::Simple->new();

        my $swis = SW::InformationService->new();

        $swis->outputxml('true');

        $swis->proxy($endpoint);

        $swis->proxy->http_request->authorization_basic($username, $password);

           print "Startign\n";

           my $response = $swis->Update('swis://$SWHost/Orion/Orion.Nodes/NodeID=33104/Interfaces/InterfaceID=101366',  {'StatCollection'=>'30'});

         return if ($response eq '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Header><log xmlns="http://schemas.solarwinds.com/2007/08/informationservice"/></s:Header><s:Body><UpdateResponse xmlns="http://schemas.solarwinds.com/2007/08/informationservice"/></s:Body></s:Envelope>');

           print $response;

    *******************************************************************************

    ERROR:

    Use of uninitialized value $_[0] in pattern match (m//) at /home/autoeng/lib/perl5/SOAP/Lite.pm line 340.

    ~

  • where is $SWHost defined?

    This won't throw an error because you have it in single quotes, and so the first argument contains that string literally, instead of what you want, which is probably localhost

    i.e.:

    "swis://localhost/Orion/Orion.Nodes/NodeID=33104/Interfaces/InterfaceID=101366"

    /RjL