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.

Trigger NCM configuration download from SDK

Is there any way with the SDK to start a configuration download?

For some reason my nightly backup of configs runs into some issues, but when I manually download from node details, it always works fine.

So, I take my email report, put it in a text box in vb, parse it and get the few that had errors.  Would like to be able to take that and click 'try again on all' kind of thing.

  • In C# you may use the following snippet:

    void DL(InfoServiceProxy proxy)

            {

                XmlDocument doc = new XmlDocument();

                doc.LoadXml(

    @"<?xml version=""1.0"" encoding=""utf-8""?>

    <params>

      <ArrayOfguid xmlns:i=""http://www.w3.org/2001/XMLSchema-instance""

      xmlns=""http://schemas.microsoft.com/2003/10/Serialization/Arrays"">

        <guid>2e5b5574-7dcd-4b5f-a9f9-982ae773cedc</guid>

        <guid>99f11cbd-849b-4786-b45e-35cd2dd55017</guid>

        <guid>d4b6f228-53f2-493b-b406-e657ef7e090e</guid>

        <guid>17693dd7-5104-4778-bd2f-8689ee5b8bcf</guid>

        <guid>088fc2a0-7434-418a-b311-3e82d5b984ff</guid>

        <guid>8dbe44f2-5707-482e-a216-c9167768256c</guid>

      </ArrayOfguid>

      <string xmlns=""http://schemas.microsoft.com/2003/10/Serialization/"">Running</string>

      <string xmlns=""http://schemas.microsoft.com/2003/10/Serialization/"">admin</string>

    </params>

    ");

                XmlElement[] xmlElements = doc.DocumentElement.ChildNodes.Cast<XmlElement>().ToArray();

                proxy.Invoke("Cirrus.ConfigArchive", "Download", xmlElements);

            }

    This post may give you idea on how to instantiate the InfoServiceProxy object which comes as parameter to this method.

    As you can see we pass array of Guids (element Arrayofguid) - they are NCM node ids. You would have to provide your Node IDs.

    To find which Node Id corresponds to IP address you may use SWQL studio and query:

    SELECT NodeID, AgentIP, AgentIPv6

    FROM Cirrus.Nodes

    The next parameter is config type, in his sample it is Running.

    The last parameter specifies the Orion user name whos account is used to download configs, in this sample it is admin.

    After you call the Download verb the statuses of download will be reflected in the Cirrus.TransferQueue entity and obviously you can follow them on NCM web.

  • FormerMember
    0 FormerMember in reply to Denys.Pavlov

    Can someone please let me know how to do this using the REST API?

    Thanks,

    Scott

  • Using curl, it would look like this:

    curl -k -u admin: -X POST -H "Content-Type: application/json" https://localhost:17778/SolarWinds/InformationService/v3/Json/Invoke/Cirrus.ConfigArchive/Download -d @download.json

    Where download.json contains something like this:

    [

      ["ef324766-a202-4438-81bf-2c8cbf527743"],

      "Running",

      "ignored"

    ]

    The GUID that appears on line 2 should be the value of Cirrus.Nodes.NodeID for the nodes you want to download configs for. You can have more than one of these. The second parameter (on line 3) is the config type. The third parameter (on line 4) is ignored.

    [Update 10/10: Corrected URL]

  • FormerMember
    0 FormerMember in reply to tdanner

    Okay, great.

    Now, I’m experimenting with this and I got back “” (and No json data) when calling it from SoapUI. This seems like it might be wrong, so I’m wondering what I’m actually expecting as a ‘return value’ when making this call, if any.

    Also, where might I find the possible values for the ‘Second parameter/Line 3’ value?

    Thanks a million!

    Scott

  • FormerMember
    0 FormerMember in reply to tdanner

    D’OH! That call was made against the wrong server. However, when I fixed it, I got the following;

    "The data contract type 'System.Runtime.Serialization.KeyValue`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' cannot be deserialized because the required data members 'Key, Value' were not found."

    My ‘application/json’ body: [["16a83fcc-04c5-487c-8de5-01ae7f0d5e0c"], "Running", "ignored"] (the Guid was retrieved via a query to Cirrus.Nodes, so I know that shouldn’t be the problem.)

    POST lsdorioneast:17778/.../Download HTTP/1.1

    Accept-Encoding: gzip,deflate

    Content-Type: application/json

    Content-Length: 64

    Host: lsdorioneast:17778

    Connection: Keep-Alive

    User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

    Authorization: Basic TUdNV…

    Tried to format a couple of different ways, but not getting it.

    Thoughts? Key names?

  • Your formatting looks fine. That error doesn't really make sense to me. But if you look in the SWISv3 log file (C:\ProgramData\SolarWinds\InformationService\v3.0\Orion.InformationService.log) it should have a stack trace to go with that error. With that hopefully I can figure out what is going wrong.

  • As for the config types, the default ones are "Running" and "Startup". You can define custom ones on /Orion/NCM/Admin/Settings/ConfigSettings.aspx.

  • FormerMember
    0 FormerMember in reply to tdanner

    Awww shucks!

    I’m not finding anything in that log that matches the exception I got. I ran it again so I could match up the times and .. nothing. The last exception/error I see is from 10 minutes ago. Do I need to do something to get the buffer to flush to the log or something? (I even checked the other server instance just in case.)

  • The log file on lsdorioneast doesn't have the error? That is very strange.

    What version(s) of the .NET Framework are installed on that server?

  • FormerMember
    0 FormerMember in reply to tdanner

    Looks like 4.0.