Quantcast
Channel: THWACK: All Content - Orion SDK
Viewing all 2677 articles
Browse latest View live

Solar Winds API Connection

$
0
0

When trying to access the database through the Solar Winds REST API I am getting a "Could not connect in call from " error. I am using the proper IP Address and Username/Password. Any suggestions?


Aggregate Functions on NTA entities

$
0
0

Hi community

 

wondering whether we have any updates on SWQL NTA Entities and aggregated functions.

 

i've been asked for a report where the sum of the bytes transferred for a specific IP address is more than 1GB over the last 24 Hours, see below as an example:

 

 

SELECT NodeID, SourceIP, DestinationIP, SUM(TotalBytes) AS SumA
FROM Orion.Netflow.Flows
WHERE TimeStamp>GetDate()-2
AND TimeStamp<GetDate()-1
GROUP BY NodeID, SourceIP, DestinationIP
HAVING SUM(TotalBytes)>1073741824

 

Results include all rows, ignoring the HAVING clause completely. i've opened a similar thread here, where no correct answers were given.

has anyone experienced any similar issues over SWQL and NetFlow ?

 

the actual requirement is more complex where multiple select statements are likely to cause performance issues (in case its actually doable) so that's out of the question sadly

 

 

 

Antonis Athanasiou

Prosperon - UK SolarWinds Partners

Installation | Consultancy | Training | Licenses

facebook_icon.jpglinkedin.pngblogger.pngtwitter-icon.jpg 

Issue with API Creating Discovery

$
0
0

I am having an issue in my production environment this worked fine in a test lab but not production Solarwinds.

The error in the discovery is

 

A Network Discovery job has failed to complete.\r\nState: Failed\r\nProfile id: 106.\r\nThe Job Scheduler is reporting the following error:\r\nSolarWinds.JobEngine.WorkerProcess.JobExecutionException: System.Exception: Unable to deserialize job description. ---> System.Runtime.Serialization.SerializationException: Error in line 0 position 0. Element 'http://schemas.datacontract.org/2004/07/SolarWinds.Orion.Core.Models.Discovery:DiscoveryPluginJobDescriptionBase' contains data from a type that maps to the name 'http://schemas.solarwinds.com/2008/DeviceStudio:DeviceStudioDiscoveryPluginJobDescription'. The deserializer has no knowledge of any type that maps to this name. Consider using a DataContractResolver or add the type corresponding to 'DeviceStudioDiscoveryPluginJobDescription' to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding it to the list of known types passed to DataContractSerializer.

 

 

Here is the code :

 

       public HttpResponseMessage Post([FromBody]NodeInfo info)

        {

             CustomNodeInfo cnInfo = new CustomNodeInfo();

            #region Hard Coded Values for SaaS

            //Hard coding these for now as this is for just the SaaS Poller currently

            info.EngineID = 12;

            cnInfo.Custom1 = "1";

            cnInfo.Custom2 = "2";

            cnInfo.Custom3 = "3";

            //End Hard Coded

            #endregion

 

 

            info.ObjectSubType = "SNMP";

            info.SNMPVersion = "2";

            info.EntityType = "Orion.Nodes";

            info.DynamicIP = false;

            info.Status = 1;

            info.UnManaged = false;

            info.Allow64BitCounters = false;

            if (ModelState.IsValid)

            {

                string query = "{\"query\":\"SELECT PropertyValue FROM Orion.EngineProperties WHERE EngineID=@e AND PropertyName='Orion.Standard.Polling'\",\"parameters\":{\"e\":" + info.EngineID + "}}";

 

 

                JObject pollingRate = JObject.Parse(SWJsonCall.Post("Json/Query", query));

 

 

                int curRate = (Int32)pollingRate["results"][0]["PropertyValue"];

                if (curRate < 85)

                {

                    #region Start Discovery on New Node

                    var dis = new DiscoveryInfo

                    {

                        Name = "API Add Node " + info.IPAddress,

                        EngineID = info.EngineID,

                        JobTimeoutSeconds = 3600,

                        SearchTimeoutMiliseconds = 5000,

                        SnmpTimeoutMiliseconds = 5000,

                        SnmpRetries = 2,

                        RepeatIntervalMiliseconds = 1800,

                        SnmpPort = 161,

                        HopCount = 0,

                        PreferredSnmpVersion = "SNMP2c",

                        DisableIcmp = false,

                        AllowDuplicateNodes = true,

                        IsAutoImport = true,

                        IsHidden = false,

                    };

                    dis.PluginConfigurations = new List<PluginItems> { new PluginItems { PluginConfigurationItem = DiscoveryProfiles.SNMPv2(info.Community, info.IPAddress) } };

 

 

                    DiscoveryInfo[] disArray = new DiscoveryInfo[] { dis };

 

 

                    string createDiscovery = SWJsonCall.Post("Json/Invoke/Orion.Discovery/StartDiscovery", JsonConvert.SerializeObject(disArray));

                    #endregion

 

 

                    JObject disStatus = null;

                    Stopwatch time = new Stopwatch();

                    time.Start();

                    do

                    {

                        string statusQuery = "{\"query\":\"SELECT Status,StatusDescription FROM Orion.DiscoveryProfiles where ProfileID=@id\",\"parameters\":{\"id\":\"" + createDiscovery + "\"}}";

                        disStatus = JObject.Parse(SWJsonCall.Post("Json/Query", statusQuery));

                        if (time.ElapsedMilliseconds > 120000) return Request.CreateResponse(HttpStatusCode.RequestTimeout, "This has taken over 120 seconds it should not take that long this might be something wrong with the information provided.");

                    } while (disStatus["results"][0]["Status"].ToString() == "0" || disStatus["results"][0]["Status"].ToString() == "1" || !disStatus["results"].HasValues);

 

 

                    if (disStatus["results"][0]["Status"].ToString() == "2")

                    {

                        string nodeQuery = "{\"query\":\"SELECT Uri,NodeID FROM Orion.Nodes where IPAddress=@ip AND EngineID=@e\",\"parameters\":{\"ip\":\"" + info.IPAddress + "\", \"e\": " + info.EngineID + "}}";

                        JObject nodeStatus = JObject.Parse(SWJsonCall.Post("Json/Query", nodeQuery));

                        string swisUrl = nodeStatus["results"][0]["Uri"].ToString();

                        string updateProps = SWJsonCall.Post("Json/" + swisUrl + "/CustomProperties", JsonConvert.SerializeObject(cnInfo));

                    }

                    else return Request.CreateResponse(HttpStatusCode.ExpectationFailed, disStatus["results"][0]["StatusDescription"].ToString());

 

 

                    return new HttpResponseMessage(HttpStatusCode.Created);

                }

                else

                {

                    return Request.CreateResponse(HttpStatusCode.InternalServerError, "Polling rate at dangerous level " + curRate + "%. Please consult Admins, node NOT added.");

                }

            }

            else

            {

                var message = string.Join(" | ", ModelState.Values.SelectMany(v => v.Errors).Select(e => e.ErrorMessage));

                var execption = string.Join(" | ", ModelState.Values.SelectMany(v => v.Errors).Select(e => e.Exception));

                return Request.CreateResponse(HttpStatusCode.BadRequest, "Error - " + message + " : " + execption);

            }

        }

 

 

 

Here is the discovery profile model.

 

        public static string SNMPv2(string community, string ipaddress)

        {

            string discoveryProfileXML = "<PluginItems xmlns=\"http://schemas.datacontract.org/2004/07/SolarWinds.Orion.Core.Models.Discovery\">\n" +

            "<knownTypes>\n" +

            "<ArrayOfstring xmlns=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">\n" +

            "<string>SolarWinds.Orion.Core.Models.Discovery.CoreDiscoveryPluginConfiguration,SolarWinds.Orion.Core.Models</string>\n" +

            "</ArrayOfstring>\n" +

            "</knownTypes>\n" +

            "<pluginItem>\n" +

            "<ArrayOfDiscoveryPluginConfigurationBase xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">\n" +

            "<DiscoveryPluginConfigurationBase i:type=\"d2p1:CoreDiscoveryPluginConfiguration\" xmlns:d2p1=\"http://schemas.solarwinds.com/2008/Orion\">\n" +

            "<d2p1:AddressRange/>\n" +

            "<d2p1:AgentsAddresses xmlns:d3p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\"/>\n" +

            "<d2p1:BulkList xmlns:d3p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">\n" +

            "<d3p1:string>"+ipaddress+"</d3p1:string>\n" +

            "</d2p1:BulkList>\n" +

            "<d2p1:Credentials>\n" +

            "<d2p1:credentials>\n" +

            "<knownTypes>\n" +

            "<ArrayOfstring xmlns=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\">\n" +

            "<string>SolarWinds.Orion.Core.Models.Credentials.SnmpCredentialsV2,SolarWinds.Orion.Core.Models</string>\n" +

            "</ArrayOfstring>\n" +

            "</knownTypes>\n" +

            "<pluginItem>\n" +

            "<d2p1:ArrayOfCredential>\n" +

            "<d2p1:Credential i:type=\"d2p1:SnmpCredentialsV2\">\n" +

            "<d2p1:Description i:nil=\"true\"/>\n" +

            "<d2p1:ID i:nil=\"true\"/>\n" +

            "<d2p1:IsBroken>false</d2p1:IsBroken>\n" +

            "<d2p1:Name>"+community+"</d2p1:Name>\n" +

            "<d2p1:Owner i:nil=\"true\"/>\n" +

            "<d2p1:Community>"+community+"</d2p1:Community>\n" +

            "</d2p1:Credential>\n" +

            "</d2p1:ArrayOfCredential>\n" +

            "</pluginItem>\n" +

            "</d2p1:credentials>\n" +

            "</d2p1:Credentials>\n" +

            "<d2p1:DiscoverAgentNodes>false</d2p1:DiscoverAgentNodes>\n" +

            "<d2p1:SharedCredentials xmlns:d3p1=\"http://schemas.microsoft.com/2003/10/Serialization/Arrays\"/>\n" +

            "<d2p1:SubnetList/>\n" +

            "<d2p1:WmiRetries>1</d2p1:WmiRetries>\n" +

            "<d2p1:WmiRetryInterval>PT10S</d2p1:WmiRetryInterval>\n" +

            "</DiscoveryPluginConfigurationBase>\n" +

            "</ArrayOfDiscoveryPluginConfigurationBase>\n" +

            "</pluginItem>\n" +

            "</PluginItems>\n";

 

 

            return discoveryProfileXML;

        }

Problem with CreateCorePluginConfiguration

$
0
0

I'm trying to start automating the process of node autodiscovery.  Looks like the 1st part is to generate a config with CreateCorePluginConfiguration.  When invoke this, I get the following error message:

 

{'Message': 'Verb Orion.Discovery.CreateCorePluginConfiguration cannot unpackage parameter 0'}

 

This is my python code:

def main():

    swis = SwisClient('localhost', 'admin', '')

    config = swis.invoke('Orion.Discovery', 'CreateCorePluginConfiguration',

    {

      'BulkList': [{'Address':'10.199.10.12'}],

      #'IpRanges': [], # Optional

      #'Subnets': None, # Optional

      'Credentials': [

        {'CredentialID':1, 'Order':1},

        {'CredentialID':2, 'Order':2},

      ],

      'WmiRetriesCount': 1,

      'WmiRetryIntervalMiliseconds': 1000

    })

 

I'm running the following:

Orion 2013.2.0, NPM 10.6

 

Thanks,

Larry

 

SWQL Studio Error (Unknown dataprovider type 'ntext')

$
0
0

EDIT:My question in bold underline below still stands, even though I know some of the answer now (see my Edits further below), but if you look at my final edit (Edit 3:) you can see my workaround that will hopefully help anyone else that wants to make an events report or needs a SWQL query for a script they may be working on for Events.

 

When joining the Orion.Events table (or entity, or whatever it's called in SWQL.) to the Orion.NetObjectTypes table ON Events.NetObjectType = NetObjectTypes.Prefix I get the error Unknown dataprovider type 'ntext'.  Both objects are of type "System.String" in their table.  When I query the Orion.NetObjectTypes table on its own the Prefix field comes back just fine, but joining on it seems to cause this problem.  The only thing I can think of is that the NetObjectTypes table isn't data that is in the SQL database and (I assume) must be generated by the application and fed into SWIS as an entiy.  Maybe for some reason this causes a problem. I don't know.

 

Anyone (tdanner especially) know why I can't join Event NetObjectTypes to NetObjectTypes Prefix?

 

Here is the actual code:

SELECT TOP 1000
e.EventID,
et.Name AS EventTypeName,
e.Message AS EventMessage,
e.NetObjectType,
nt.Name AS ObjectType,
e.NetObjectValue,
e.NetworkNode,
e.InstanceType,
e.EventTime
FROM Orion.Events e
JOIN Orion.EventTypes et ON e.EventType = et.EventType
JOIN Orion.NetObjectTypes nt ON e.NetObjectType = nt.Prefix

 

I've tried putting the NetObjectTypes table in a subselect in the FROM statement and joining to the results of that but that doesn't seem to trick the query plan and I get the same error.  Besides doing a billion CASE statements for the Orion.Events "NetObjectType" field, what can I do here?

 

EDIT 1: Also noticed that the NetObjectTypes table has some blank Prefixes that still have a type associated with them.  What's this all about:

 

 

EDIT 2:  Also just noticed that there are many duplicate prefixes with different Name matches.  I'm sure that will cause a problem, but I wouldn't think it would be an "Unknown dataprovider type" error.  Why are there either duplicate prefix/name combos, or duplicate prefixes mapping to different names?  How does the program use these items and know how to map duplicate prefixes to the different Name fields?

 

Orion.NetObjectTypes

PREFIXNAME
AAApplication
AAAPM: Application
FCPFibre Channel Port
FCPFibre Channel Port
FCRFibre Channel Revision
FCRFibre Channel Revision
FCSFibre Channel Sensor
FCSFibre Channel Sensor
GMGroup Member
GMGroup Member
GMGroup Member
IPAMNIPAM Nodes
IPAMNIPAM IPAddress Conflict
NVLANVLAN
NVLANVLAN
UE-DNSRogue DNSName
UE-DNSUDT: Hostname
UE-IPRogue EmptyDNSName
UE-IPRogue IPAddress
UE-MACNew MAC Vendor
UE-MACMoved MAC
UE-MACNew MACAddress
UE-MACRogue MACAddress
UNDPTCustom Node Table Poller
UNDPTCustom Node Table Poller

 

 

EDIT 3: My question above still stands, but I went ahead and used Excel to create all of the CASE statements necessary to map the object type codes (Orion.Events.NetObjectType) to the object type names (based on the Orion.NetObjectTypes.Name field, but modified a bit to fix the duplicates and NULL values):

 

SELECT TOP 10000  e.EventID,  et.Name AS EventTypeName,  e.Message AS EventMessage,  CASE  WHEN e.NetObjectType = 'AA' THEN 'Application'  WHEN e.NetObjectType = 'ABIA' THEN 'AppInsight for IIS: Application'  WHEN e.NetObjectType = 'ABIP' THEN 'AppInsight for IIS: Application Pool'  WHEN e.NetObjectType = 'ABIR' THEN 'AppInsight for IIS: Request'  WHEN e.NetObjectType = 'ABIRD' THEN 'AppInsight for IIS: Request Details'  WHEN e.NetObjectType = 'ABIS' THEN 'AppInsight for IIS: Site'  WHEN e.NetObjectType = 'ABISB' THEN 'AppInsight for IIS: Site Binding'  WHEN e.NetObjectType = 'ABSA' THEN 'AppInsight for SQL: Application'  WHEN e.NetObjectType = 'ABSD' THEN 'AppInsight for SQL: Database'  WHEN e.NetObjectType = 'ABSF' THEN 'AppInsight for SQL: Database File'  WHEN e.NetObjectType = 'ABSJ' THEN 'AppInsight for SQL: Job Info'  WHEN e.NetObjectType = 'ABSQ' THEN 'AppInsight for SQL: Expensive Queries Info'  WHEN e.NetObjectType = 'ABTT' THEN 'APM: Windows Scheduled Tasks'  WHEN e.NetObjectType = 'ABXA' THEN 'AppInsight for Exchange: Application'  WHEN e.NetObjectType = 'ABXD' THEN 'AppInsight for Exchange: Database'  WHEN e.NetObjectType = 'ABXDC' THEN 'AppInsight for Exchange: Database Copy'  WHEN e.NetObjectType = 'ABXF' THEN 'AppInsight for Exchange: Database File'  WHEN e.NetObjectType = 'ABXMB' THEN 'AppInsight for Exchange: Mailboxes'  WHEN e.NetObjectType = 'ABXR' THEN 'AppInsight for Exchange: Replication Status'  WHEN e.NetObjectType = 'AM' THEN 'APM: Component'  WHEN e.NetObjectType = 'C' THEN 'Group'  WHEN e.NetObjectType = 'CCM' THEN 'NTA: CBQoS Class Map'  WHEN e.NetObjectType = 'DBI' THEN 'Database Instance'  WHEN e.NetObjectType = 'EWE' THEN 'EnergyWise Entity'  WHEN e.NetObjectType = 'F5' THEN 'F5 Devices'  WHEN e.NetObjectType = 'FCP' THEN 'Fibre Channel Port'  WHEN e.NetObjectType = 'FCR' THEN 'Fibre Channel Revision'  WHEN e.NetObjectType = 'FCS' THEN 'Fibre Channel Sensor'  WHEN e.NetObjectType = 'FCU' THEN 'Fibre Channel Unit'  WHEN e.NetObjectType = 'FN' THEN 'F5 Nodes'  WHEN e.NetObjectType = 'FP' THEN 'F5 Pools'  WHEN e.NetObjectType = 'FVS' THEN 'F5 Virtual Servers'  WHEN e.NetObjectType = 'GM' THEN 'Group Member'  WHEN e.NetObjectType = 'HWH' THEN 'Hardware'  WHEN e.NetObjectType = 'HWHS' THEN 'Hardware Sensor'  WHEN e.NetObjectType = 'HWHT' THEN 'Hardware Type'  WHEN e.NetObjectType = 'I' THEN 'Interface'  WHEN e.NetObjectType = 'IPAM-DSO' THEN 'IPAM DHCPScopes Overlapping'  WHEN e.NetObjectType = 'IPAMG' THEN 'IPAM Networks'  WHEN e.NetObjectType = 'IPAMN' THEN 'IPAM Node or IPAddress Conflict'  WHEN e.NetObjectType = 'ISOP' THEN 'IP SLA QoS'  WHEN e.NetObjectType = 'L' THEN 'Location'  WHEN e.NetObjectType = 'MCG' THEN 'Multicast Routing Group'  WHEN e.NetObjectType = 'MCGN' THEN 'Multicast Routing'  WHEN e.NetObjectType = 'N' THEN 'Node'  WHEN e.NetObjectType = 'NBR' THEN 'Routing Neighbors'  WHEN e.NetObjectType = 'NCH' THEN 'UCS Chassis'  WHEN e.NetObjectType = 'NVLAN' THEN 'VLAN'  WHEN e.NetObjectType = 'NVS' THEN 'VSAN'  WHEN e.NetObjectType = 'NWA' THEN 'Node Warranty'  WHEN e.NetObjectType = 'P' THEN 'VoIP Infrastructure'  WHEN e.NetObjectType = 'T' THEN 'Transaction'  WHEN e.NetObjectType = 'TS' THEN 'Step'  WHEN e.NetObjectType = 'TSR' THEN 'Step Request'  WHEN e.NetObjectType = 'UCSB' THEN 'UCS Blade'  WHEN e.NetObjectType = 'UCSF' THEN 'UCS Fabric'  WHEN e.NetObjectType = 'UCSFAN' THEN 'UCS Fan'  WHEN e.NetObjectType = 'UCSM' THEN 'UCS Manager'  WHEN e.NetObjectType = 'UCSPSU' THEN 'UCS Psu'  WHEN e.NetObjectType = 'UE-DNS' THEN 'UDT: Rogue DNSName or Hostname'  WHEN e.NetObjectType = 'UE-IP' THEN 'UDT: Rogue EmptyDNSName or IPAddress'  WHEN e.NetObjectType = 'UE-MAC' THEN 'New MAC Vendor or Moved, New, Rogue MAC Address'  WHEN e.NetObjectType = 'UNDPI' THEN 'Custom Interface Poller'  WHEN e.NetObjectType = 'UNDPN' THEN 'Custom Node Poller'  WHEN e.NetObjectType = 'UNDPT' THEN 'Custom Node Table Poller'  WHEN e.NetObjectType = 'UP' THEN 'AccessPort'  WHEN e.NetObjectType = 'UW' THEN 'Watch List'  WHEN e.NetObjectType = 'V' THEN 'Volume'  WHEN e.NetObjectType = 'VCCM' THEN 'VoIP CallManager'  WHEN e.NetObjectType = 'VCCMP' THEN 'VoIP Phone'  WHEN e.NetObjectType = 'VCDS' THEN 'VoIP Call Details'  WHEN e.NetObjectType = 'VG' THEN 'VoIP Gateway'  WHEN e.NetObjectType = 'VH' THEN 'Virtual Host'  WHEN e.NetObjectType = 'VMC' THEN 'Virtual Cluster'  WHEN e.NetObjectType = 'VMD' THEN 'Virtual DataCenter'  WHEN e.NetObjectType = 'VMS' THEN 'Virtual Datastore'  WHEN e.NetObjectType = 'VR' THEN 'VoIP Region'  WHEN e.NetObjectType = 'VRF' THEN 'VRF'  WHEN e.NetObjectType = 'VVC' THEN 'Virtual Center'  WHEN e.NetObjectType = 'VVG' THEN 'VoIP PRI Gateway'  WHEN e.NetObjectType = 'VVGT' THEN 'VoIP PRI Trunk'  WHEN e.NetObjectType = 'VVM' THEN 'Virtual Machine'  WHEN e.NetObjectType = 'WLAP' THEN 'Wireless Access Point'  WHEN e.NetObjectType = 'WLC' THEN 'Wireless Controller'  WHEN e.NetObjectType = 'WLHM' THEN 'Wireless Heatmap'  WHEN e.NetObjectType IS NULL AND e.EventMessage LIKE 'IPAM Service%' THEN 'Orion Engine'  WHEN e.NetObjectType IS NULL AND e.EventMessage LIKE '%trap packet%' THEN 'SNMP Trap'  WHEN e.NetObjectType IS NULL AND (e.EventMessage LIKE '%Nightly Maintenance%' OR e.EventMessage LIKE '%database maintenance%') THEN 'Orion Engine'  ELSE 'N/A'  END AS ObjectType,  e.NetObjectValue,  e.NetworkNode,  e.InstanceType,  e.EventTime
FROM  Orion.Events e
JOIN  Orion.EventTypes et ON e.EventType = et.EventType

Python Module Httplib GET request issue

$
0
0

Hi all,

I found a related topic here and provided my 2 cents Rest Api Connection Failed, but I'm in need of an answer or advice so I thought I'd post my own question. I'm new to SolarWinds, and have found REST library for python/ mySQL queries. This can be found at :Plexxi/SolarWindsOrionREST · GitHub

 

In a nutshell, I'm attempting to query my organizations SolarWinds DB using this library but I'm running into some issues with my GET request. In swClassLib.py, the method sendRequest() is defined on line #88, and my request errors on line #115 after a failed HTTPConnection.Request() with an interestingly useless error message provided by the original developer.

I modified the Try/Except and discovered that the error is actually : [Errno 10054] An existing connection was forcibly closed by the remote host


Now I'm generally aware of what this error means, and I tried to catch it and re-establish my connection after waiting exponentially but to no avail.

I guess my question is, What is going wrong with this connection? If I try the same GET request from my browser, I'm greeted with the correct JSON object.

As a newbie, I'm quicker to put the blame on my implementation rather than blame a connection error on the server so any insight you could provide would be much appreciated!

 

Thanks

SWQL queries not working in Custom Query and Custom Reports since NPM v12 but still working in SWQL studio

$
0
0

Hello World

 

before the upgrade to NPM v12 we were using some custom queries in order to extract IOPs per process from the database and create charts and tables with that. Everything was working beautifully until the upgrade to NPM v12, since then the query is not working (error message) on any web resources, however it still works in SWQL studio.

 

I've been troubleshooting the query and the issue is in the 'in (Select...)' statement. It works fine if you add values inside the in (example pec.componentid in ('10','20','30'...) but it doesn't with another WHERE clause.

 

 

It would be nice if we could get a response from the development team and if they could confirm that SWQL queries that are working in SWQL studio will also be working on the web interface? Otherwise, what's the point of SWQL studio? (yes, i know that there are lots of different things you can do with it, but this is one of the main ones, at least for a lot of SW users).

 

 

Query:

 

SELECT pec.componentid, ( pec.avgioreadoperationspersec + pec.avgiowriteoperationspersec )
AS avgiops, pec.timestamp, cst.componentprocessname, cst.componentprocessname + ' from ' + cst.componentname + ' on ' + n.caption
AS fullname
FROM orion.apm.processevidencechart pec inner join orion.apm.currentstatistics cst
ON cst.componentid = pec.componentid inner join orion.apm.component comp
ON comp.componentid = pec.componentid inner join orion.apm.applicationalert appl
ON appl.id = comp.applicationid inner join orion.nodes n
ON n.nodeid = appl.nodeid

WHERE pec.timestamp> ${FromTime} AND pec.timestamp< ${ToTime}
AND pec.componentid IN

 

(

SELECT top 10 componentid
FROM orion.apm.processevidencechart pec inner join orion.apm.component comp
ON comp.componentid = pec.componentid WHERE pec.timestamp> ${FromTime}
AND pec.timestamp< ${ToTime} AND avgioreadoperationspersec IS NOT NULL
AND avgiowriteoperationspersec IS NOT NULL AND comp.applicationid = ${applicationid}
GROUP BY componentid
ORDER BY avg ( avgioreadoperationspersec + avgiowriteoperationspersec )

DESC

)

 

The problem also is that we use this structure in order to extract other type of information....

 

Regards

 

Raul

 


Orion WSQL Short-Comings

$
0
0

Where I see a major problem with WSQL is returning properties for a node, where you don't know what is available. You can use a query like:

 

 

SELECT Name FROM Metadata.Property where EntityName = 'Orion.Nodes'

 

to return all possible properties for nodes, but the problem is that the list that is returned appears to contain properties for all nodes type, where any given property may be valid for some nodes and invalid for others. Is there a way to return property names for a specific type like a Windows server node?

 

If I want to return all valid properties for a node, is there a way to do it concisely instead of:

 

 

SELECT NodeID,ObjectSubType,IPAddress,IPAddressType,DynamicIP,Caption,NodeDescription,Description,DNS,SysName,Vendor,SysObjectID,

Location,Contact,VendorIcon,Icon,IOSImage,IOSVersion,GroupStatus,StatusIcon,LastBoot,SystemUpTime,ResponseTime,PercentLoss,AvgResponseTime,

MinResponseTime,MaxResponseTime,CPULoad,MemoryUsed,MemoryAvailable,PercentMemoryUsed,PercentMemoryAvailable,LastSync,LastSystemUpTimePollUtc,

MachineType,Severity,ChildStatus,Allow64BitCounters,AgentPort,TotalMemory,CMTS,CustomPollerLastStatisticsPoll,CustomPollerLastStatisticsPollSuccess,SNMPVersion,

PollInterval,EngineID,RediscoveryInterval,NextPoll,NextRediscovery,StatCollection,External,Community,RWCommunity,IP,IP_Address,IPAddressGUID,NodeName,

BlockUntil,BufferNoMemThisHour,BufferNoMemToday,BufferSmMissThisHour,BufferSmMissToday,BufferMdMissThisHour,BufferMdMissToday,BufferBgMissThisHour,

BufferBgMissToday,BufferLgMissThisHour,BufferLgMissToday,BufferHgMissThisHour,BufferHgMissToday,OrionIdPrefix,OrionIdColumn,MinutesSinceLastSync,

EntityType,DetailsUrl FROM Orion.Nodes order by nodeid"

 

By the way I did not type that in manually, LOL. I'm trying to use this in Powershell and what I'm trying to get at are things like the assigned application monitors, event list, and/or active alerts for a given node, in addition to current configuration information.

 

 


Req SWQL Query Advice - NTA Check If SourceIP Exists

$
0
0

Hey I'm currently running this SWQL (SWIS) Query

 

SELECT SourceIP, Sum(EgressBytes) as TotalEgressBytes
FROM Orion.Netflow.FlowsByIP
WHERE TimeStamp>GetDate()-2 AND TimeStamp<GetDate()-1  and SourceIP >= '10.0.0.1' and SourceIP < '10.0.0.254'
Group By SourceIP

 

I'm using this query to check if a SourceIP is in use. (I probably don't need to sum the EgressBytes but just doing it for now)

 

My main goal is to feed the range of IP addresses and for each address return True or False for each IP if the SourceIP column exists.

 

I had a play around with "Case \ If exists" but have been having issues. Also this query is very slow if I increase the date range. I'd love some assistance

 

Thanks!

Node Discovery Error

$
0
0

I am currently running into an issue while running a Node Discovery via RestAPI.  I am seeing the following error in Status Description within SWQL Studio.   I have noticed is when I login into Orion and edit the Discovery Profile and click through it without modifying any settings the profile will run correctly and then the next attempted API call will work correctly without an error until the next day.  

 

I have also included my JSON for failed discovery in the attachment. 

 

ERROR - 

A Network Discovery job has failed to complete.\r\nState: Failed\r\nProfile id: 59.\r\nThe Job Scheduler is reporting the following error:\r\nSolarWinds.JobEngine.WorkerProcess.JobExecutionException: System.Exception: Unable to deserialize job description. ---> System.Runtime.Serialization.SerializationException: Error in line 0 position 0. Element 'http://schemas.datacontract.org/2004/07/SolarWinds.Orion.Core.Models.Discovery:DiscoveryPluginJobDescriptionBase' contains data from a type that maps to the name 'http://schemas.solarwinds.com/2008/DeviceStudio:DeviceStudioDiscoveryPluginJobDescription'. The deserializer has no knowledge of any type that maps to this name. Consider using a DataContractResolver or add the type corresponding to 'DeviceStudioDiscoveryPluginJobDescription' to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding it to the list of known types passed to DataContractSerializer.

   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)

   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 id, RuntimeTypeHandle declaredTypeHandle, String name, String ns)

   at ReadArrayOfDiscoveryPluginJobDescriptionBaseFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString , XmlDictionaryString , CollectionDataContract )

   at System.Runtime.Serialization.CollectionDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)

   at System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)

   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)

   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 id, RuntimeTypeHandle declaredTypeHandle, String name, String ns)

   at ReadDiscoveryJobDescriptionFromXml(XmlReaderDelegator , XmlObjectSerializerReadContext , XmlDictionaryString[] , XmlDictionaryString[] )

   at System.Runtime.Serialization.ClassDataContract.ReadXmlValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context)

   at System.Runtime.Serialization.XmlObjectSerializerReadContext.ReadDataContractValue(DataContract dataContract, XmlReaderDelegator reader)

   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, DataContract& dataContract)

   at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns)

   at System.Runtime.Serialization.DataContractSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName, DataContractResolver dataContractResolver)

   at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)

   at System.Runtime.Serialization.DataContractSerializer.ReadObject(XmlReader reader, Boolean verifyObjectName)

   at SolarWinds.Orion.Common.SerializationHelper.FromXmlReader[T](XmlReader reader, Boolean verifyObjectName, IEnumerable`1 knownTypes)

   at SolarWinds.Orion.Common.SerializationHelper.FromXmlReader[T](XmlReader reader, IEnumerable`1 knownTypes)

   at SolarWinds.Orion.Discovery.Job.OrionDiscoveryJob.GetDiscoveryJobContext(String jobDetailConfiguration, IDiscoveryPluginFactory pluginFactory, List`1& plugins)

   --- End of inner exception stack trace ---

   at SolarWinds.Orion.Discovery.Job.OrionDiscoveryJob.GetDiscoveryJobContext(String jobDetailConfiguration, IDiscoveryPluginFactory pluginFactory, List`1& plugins)

   at SolarWinds.Orion.Discovery.Job.OrionDiscoveryJob.ConfigureJobContext()

   at SolarWinds.Orion.Discovery.Job.OrionDiscoveryJob.Execute(IJobExecutionHost host)

   at SolarWinds.JobEngine.WorkerProcess.Job2Adapter.Execute(IInternalJobExecutionHost host)

   at SolarWinds.JobEngine.WorkerProcess.Job2Adapter.Execute(IInternalJobExecutionHost host)

   at SolarWinds.JobEngine.WorkerProcess.JobDecorator.Execute(IInternalJobExecutionHost host)

   at SolarWinds.JobEngine.WorkerProcess.AgentDispatcher.ExecuteJobSynchronously(ActiveJob activeJob)

   at SolarWinds.JobEngine.WorkerProcess.AgentDispatcher.ExecuteJob(ActiveJob activeJob)

   at SolarWinds.JobEngine.WorkerProcess.AgentDispatcher.WorkItemDispatched(Object state)

   at SolarWinds.JobEngine.WorkerProcess.Job2Adapter.Execute(IInternalJobExecutionHost host)

   at SolarWinds.JobEngine.WorkerProcess.JobDecorator.Execute(IInternalJobExecutionHost host)

   at SolarWinds.JobEngine.WorkerProcess.AgentDispatcher.ExecuteJobSynchronously(ActiveJob activeJob)

   at SolarWinds.JobEngine.WorkerProcess.AgentDispatcher.ExecuteJob(ActiveJob activeJob)

   at SolarWinds.JobEngine.WorkerProcess.AgentDispatcher.WorkItemDispatched(Object state)

Adding Hardware Health Details

$
0
0

I'm able to successfully create nodes with the SDK (via PowerShell). However, a new node I create that way doesn't have any Hardware Health status (fans, power supplies, etc.). At first I thought it might be a missing poller, but a GUI-created device with Hardware Health status doesn't have any additional pollers compared to my SDK-created device.

 

-Eric

Enabling SSL Certificate Verification for the SDK

$
0
0

So the hard coding of SSL Certificate Verification to False within orionsdk-python (and the associated run time warnings) was getting to me, so I did a GitHub Pull request (here) to enable passing down a value for verify. With this patch applied you can now do:

 

import orionsdk
swis = orionsdk.SwisClient("SolarWinds-Orion", "username", "password", verify="server.pem")
swis.query("SELECT NodeID from Orion.Nodes")

 

And have it reject invalid SSL Cert,

 

However it turns out it's not that much use as the server (tested against NPM 12.0RC1) has a very long (until 2040) self-signed cert with a CN of SolarWinds-Orion. It looks very much like each poller in a Orion platform has same cert.

 

So has anyone tried to secure Orion when using the SDK? There is a number of issues to over come above the inability to enable verification. And I'm thinking the response via support will be not possible/supported...?

How do we programmatically discover the non-interface properties [in Orion] and enable them

$
0
0

We are automating the hydration of assets in Orion, and after adding a node, we know how to discover the interfaces, but how do we programmatically discover the non-interface properties and enable them like the sample below?Orion interface discovery ss.png


Thanks,

Scott F.


Aggregate Functions on NTA entities

$
0
0

Hi community

 

wondering whether we have any updates on SWQL NTA Entities and aggregated functions.

 

i've been asked for a report where the sum of the bytes transferred for a specific IP address is more than 1GB over the last 24 Hours, see below as an example:

 

 

SELECT NodeID, SourceIP, DestinationIP, SUM(TotalBytes) AS SumA
FROM Orion.Netflow.Flows
WHERE TimeStamp>GetDate()-2
AND TimeStamp<GetDate()-1
GROUP BY NodeID, SourceIP, DestinationIP
HAVING SUM(TotalBytes)>1073741824

 

Results include all rows, ignoring the HAVING clause completely. i've opened a similar thread here, where no correct answers were given.

has anyone experienced any similar issues over SWQL and NetFlow ?

 

the actual requirement is more complex where multiple select statements are likely to cause performance issues (in case its actually doable) so that's out of the question sadly

 

 

 

Antonis Athanasiou

Prosperon - UK SolarWinds Partners

Installation | Consultancy | Training | Licenses

facebook_icon.jpglinkedin.pngblogger.pngtwitter-icon.jpg 

Backtracking NetObjectID with query

$
0
0

What table I should search for getting NodeID when I only have NetObjectID number?

As I have understood, NetObjectID can bee application, volume, Interface, Node, etc...

 

Background information:

I have built custom connection to our Helpdesk for opening and closing tickets.

Now tickets will be opened and closed based on alert triggers and resets.

I have only logged NetobjectID during opening and closing tickets.

This first version does not recognize if node is removed or changed to unmanage status.

I would like to make query which check if Node status has been changed in Orion and close ticket if needed.

I have linked some information to Node custom properties relating to ticket system and I need to change that information when I only have NetobjectID.


Deleting Nodes (Can't get it to work with Perl LWP or Curl)

$
0
0

Hello All,

I'm working on a project that requires us to change the IP address of every server in our infrastructure. There are a number of operations that happen on different servers as part of this process. I'm using Perl for the controlling process, and it executes all these different operations on different servers. Some REST, some curl, a kerberos init, some SSH remote commands and so on. It talks to Windows and Linux as part of the process. In the case of SolarWinds, I have to perform several operations via REST; look up node ID (working), look up available IP addresses from the pool (working), delete the node (NOT working), and re-add the node when the other operations are completed at the end (untested).

 

The issue with deleting nodes seems to be related to how the request is being sent.  I get the same results whether I send the request with LWP::Simple or a or plain old command line curl. To reiterate, the SQL queries sent via either LWP, Net::SolarWinds::REST, or Curl all work as expected, only the DELETE does not work.

 

I can get the delete to work using WizTools RESTClient 3.5 (a freeware REST tool), using the same URL Perl and Curl are using, so I suspect there is some bit of syntax I'm missing.

 

Here's the Perl source in question (I don't see a way to mark up source, I hope it displays well):

The get works, the DELETE does not (error at the bottom)

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

## NAME: deleteSWNode

## PURPOSE: Deletes node from Solar Winds in prep for re-ip

## ex: my $rawDeleteOutput = deleteSWNode(drreconfigt1-1.secnet.domain.com);

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

sub deleteSWNode

{

  my $subName = "deleteSWNode";

    my ($targetNode) = @_;

    my ($browser, $request, $connString, $deleteString, $response, $req);

 

    ## set up the connection

    my $authString = "https://orion:17778/SolarWinds/InformationService/v3/Json/swis://MOSOLAR01.WINNT.secnet.domain.com/Orion/Orion.Nodes/NodeID=2512";

    $connString = "https://orion:17778/SolarWinds/InformationService/v3/Json/Query?query=SELECT+IPAddress+FROM+IPAM.IPNode+WHERE+IPAddress+LIKE+'172.27.13%'+AND+STATUS+=2";

 

  $browser = LWP::UserAgent->new;

  $browser->ssl_opts(verify_hostname => 0);

  ##$req =  HTTP::Request->new( GET => "$connString");

  $req =  HTTP::Request->new( DELETE => "$authString");

  $req->authorization_basic( "$aduser", "$adauth" );

 

    $response = $browser->request($req);

     if ($response->is_success)

     {

      print $response->decoded_content;

      return('DELETED');

  }

  else

  {

  my $stat1 = $response->decoded_content;

  my $stat2 = $response->status_line;

 

  print Dumper($stat1);

  print "\n\n";

  print Dumper($stat2);

  }

}

 

 

 

Delete from the command line with curl (works as expected for sending SQL):

[jdc@vsfileq2 ~]$ curl -k -i -H "Accept: application/json" --user jdc:'PASSHOLDER' -X DELETE 'https://orion:17778/SolarWinds/InformationService/v3/Json/swis://MOSOLAR01.WINNT.secnet.domain.com/Orion/Orion.Nodes/NodeID=2512'

HTTP/1.1 400 Bad Request

Content-Length: 580

Content-Type: application/json

Server: Microsoft-HTTPAPI/2.0

Date: Thu, 28 Jul 2016 21:52:37 GMT

 

 

 

Both attempts produce the same error:

{"Message":"No such entity instance.\u000d\u000aParameter name: uri","ExceptionType":"System.ArgumentException","FullException":"System.ArgumentException: No such entity instance.\u000d\u000aParameter name: uri\u000d\u000a   at SolarWinds.InformationService.Core.CrudProcessor.DeleteInternal(Boolean bulkMode, SwisUriResolver uriResolver, IQueryExecutionContext context)\u000d\u000a   at SolarWinds.InformationService.Core.CrudProcessor.Delete(SwisUri uri, IQueryExecutionContext context)\u000d\u000a   at SolarWinds.InformationService.Core.InformationService.Delete(String uri)"}

 

Any thoughts?

PowerShell Node Creation - Missing Volumes

$
0
0

Greetings Thwack community,

 

We have a script in place that currently runs a query on our kiosk database for new systems, and then creates nodes for them in SolarWinds.  We have 2 different types of kiosks in the db, with the main difference being the local storage on it.  Kiosk type 1 only has a C drive.  Kiosk type 2 has a C drive and an M drive.  Looking at our nodes, we are seeing C drive utilization on all of our nodes, but we do not see any of the M drive data.  I don't know if it makes much of a difference but the Kiosk type 2 could either be Windows Embedded 2009 or a Server 2008 system.  I've included what I believe to be the pertinent part of the script for our node creation.

 

$newNodeProps = @{
    EntityType="Orion.Nodes";
    IPAddress=$ip;
    IPAddressGUID=$ipGuid;
    Caption="";
    DynamicIP=$False;
    EngineID=3;
    Status=1;
    UnManaged=$False;
    Allow64BitCounters=$False;
    SysObjectID="";
    MachineType="";
    VendorIcon="";
    ObjectSubType="WMI";
    SNMPVersion=0;
    Community="";
    Location = "";
    Contact = "";
    NodeDescription="";
    Vendor="";
    IOSImage="";
    IOSVersion="";
}

 

 

            #Creating the node

            $newNodeUri = New-SwisObject $swis –EntityType "Orion.Nodes" –Properties $newNodeProps

            #Write-Host "newNodeURI is: "$newNodeUri

            $nodeProps = Get-SwisObject $swis -Uri $newNodeUri

 

 

            $poller = @{

                NetObject="N:"+$nodeProps["NodeID"];

                NetObjectType="N";

                NetObjectID=$nodeProps["NodeID"]}

 

 

            #Status

            AddPoller("N.Status.ICMP.Native");

            #ResponseTime

            AddPoller("N.ResponseTime.ICMP.Native");

            #Details

            AddPoller("N.Details.WMI.XP");

            #Uptime

            AddPoller("N.Uptime.WMI.XP");

            #CPU

            AddPoller("N.Cpu.WMI.Windows");

            #Memory

            AddPoller("N.Memory.WMI.Windows");

            #IP Address

            AddPoller("N.IPAddress.WMI.Generic");

            #Volumes

            AddPoller("V.Details.WMI.Windows");

            #Statistics

            AddPoller("V.Statistics.WMI.Windows");

            #Memory Utilization

            AddPoller("N.Memory.WMI.Windows");

 

Thank you for any input

Manage/Unmanage nodes via powershell

$
0
0

Hi,

 

I have tried to follow the below and I am stuck

Silence Group of Nodes

Powershell scripts to automatically unmanage\remanage a node using the Orion SDK

 

This is the script im using

 

# 2014-07-21 Node Unmanage script for SolarWinds SDK Powershell

# by Joe Dissmeyer | Thwack - @JoeDissmeyer | Twitter - @JoeDissmeyer | www.joedissmeyer.com

# This script will unmanage a single node in the Orion database. First, it finds the node number in the Orion database, then it will unmanage it for 99 years.

# This script assumes you are running it LOCALLY from an already managed node AND that the machine has the Orion SDK v1.9 installed on it.

# If the machine is not already managed in SolarWinds this script will fail without warning.

# Replace ORIONSERVERNAME with the appropriate values.

# ORIONSERVERNAME = Your Orion poller instance. (Ex. 'SOLARWINDS01.DOMAIN.LOCAL'). Single quotes are important.

 

# Load the SolarWinds Powershell snapin. Needed in order to execute the script. Requires the Orion SDK 1.9 installed on the machine this script is running from.

Add-PSSnapin SwisSnapin

 

 

# SolarWinds user name and password section. Create an Orion local account that only has node management rights. Enter the user name and password here.

$username = "test"

$password = "test123"

 

# This section allows the password to be embedded in this script. Without it the script will not work.

$secstr = New-Object -TypeName System.Security.SecureString

$password.ToCharArray() | ForEach-Object {$secstr.AppendChar($_)}

$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username,$secstr

 

# The actual job

$ORIONSERVERNAME = 'slt-sol-app-99'
$nodename = $env:COMPUTERNAME

 

$swis = Connect-Swis -Credential $cred -host $orionservername

$nodeid = Get-SwisData $swis "SELECT NodeID FROM Orion.Nodes WHERE SysName LIKE 'slt-jim-esx-562'"

$now =[DateTime]::UtcNow

$later =$now.{AddMinutes(20)}

Invoke-SwisVerb $swis Orion.Nodes Unmanage @("N: $nodeid ",$now,$later, "false")

 

But I get the error

 

Invoke-SwisVerb : no viable alternative at input '<EOF>' in Where clause

At H:\My Documents\Monitoring And Alerting\Solarwinds\Scripts\unmanage.ps1:58 char:16

+ Invoke-SwisVerb <<<<  $swis Orion.Nodes Unmanage @("N: $nodeid ",$now,$later, "false")

    + CategoryInfo          : InvalidOperation: (:) [Invoke-SwisVerb], FaultException`1

    + FullyQualifiedErrorId : SwisError,SwisPowerShell.InvokeSwisVerb

 

On the first link above bluefunelemental says

 

"Try for each $node in $nodeid. As it is this is only pulling the one group ID on the loop"

 

And then theroberts says it worked without showing what he had done.  Can someone point me in the wright direction?

Powershell Adding SNMP nodes, List resources?

$
0
0

I'v been able to Create scripts to add multiple SNMP Nodes but after i add them into the system the resources are never monitored.

The only way to complete the process is to list the resources for each individual node which takes way to much time.

Does anyone have a solution????

Updating multiple custom properties from a list

$
0
0

I am using NPM 11.5.3 and trying to update multiple custom properties on a node through the use of SWIS Update and Python 2.7

 

custompropertylist = ['prop1', 'prop2', 'prop3']

 

for property in custompropertylist:

     value = raw_input("%s:" % prop)

     swis.update(uri + '/CustomProperties', property=value)

 

I have this successfully working if I don't use a list and manually define each property and execute, but I am trying to make my code more modular. I have tried tinkering with this for a bit without success and the only return value of SWIS Update I get is 'None'

Viewing all 2677 articles
Browse latest View live


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