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

Anyone have time to convert the SQL for the Availability Report in Report Writer to SWQL?

$
0
0

I've been trying to convert the SQL for the availability report in report writer to SWQL for close to week.  I'm not having much luck, beyond my current skill level.  Anyone have time to help?

I've pretty much determined that DECLARE and SET startements are out.

The "WITH (NOLOCK)" also causes SWQL to choke.

 

From what I can tell, I think I should be able to just use the Orion.NPM.Interfaces table is it's auto-magical links to rewrite in SWQL,

Using the auto-magical links the statements:

SUM(IA.Availability.Availability * IA.Availability.Weight) as Sum1

Sum(IA.Availability.Weight) as Sum2

both cause an error.  I can select those fields, just can use them in a SUM statement.

 

Here's the SQL from Report Writer:

 

DECLARE @StartDate DateTime

DECLARE @EndDate DateTime

SET @StartDate = FLOOR(CAST(DATEADD(WEEK, -1, GETDATE()) AS FLOAT));

SET @EndDate = CAST(GETDATE() AS FLOAT);

WITH T1 AS{

   SELECT

      IA.NodeID,

   IA.InterfaceID,

   SUM(IA.Availability * IA.Weight) AS Sum1,

   SUM(IA.Weight) AS Sum2

  FROM InterfaceAvailability IA WITH(NOLOCK)

  WHERE

  IA.DateTime between @StartDate and @EndDate

  GROUP BY

  IA.NodeID,

  IA.InterfaceID

}

 

SELECT

  IA.nodeid, IA.interfaceid, IA.NodesVendorIcon, IA.NodeName,

  IA.InterfaceICon, IA.InterfaceCaption,

  IA.Availability

FROM {

  SELECT

  Nodes.NodeID,

  Interfaces.InterfaceID,

  SUM(Sum1) / SUM(Sum2) AS Availability,

  Interfaces.InterfaceIcon, Interfaces,Caption as InterfaceCaption,

  Nodes.Caption as NodeName,

  Nodes.VendorIcon as NodesVendorIcon

  FROM T1

  INNER JOIN Nodes WITH(NOLOCK)

  ON

  T1.NodeID = Nodes.NodeID

  INNER JOIN Interfaces WITH(NOLOCK)

  ON

  T1.InterfaceID = Interfaces.InterfaceID

  GROUP BY

  Nodes.NodeID, Interfaces.InterfaceID, Interfaces.InterfaceIcon, Interfaces.Caption, Nodes.Caption. Nodes.VendorIcon

  AS IA

  ORDER BY

  NodeID, InterfaceID


Need Help Converting SQL Report Writer Code to SWQL - Down Time Duration

$
0
0

Here is Report Writer SQL code that produces the duration of down time for a node.  I need to be able to convert this to SWQL and populate the 'hours down' time into a custom property field.  I want to use the 'hours down' time custom property field in conjunction with changing Google map Icon colors once time frame meets specified thresholds.   I'm not very savvy with SQL or coding so all suggestions are welcome.  Thanks everyone.  

 

SELECT     DATEDIFF(hh, T1.DownTime, CURRENT_TIMESTAMP) AS HoursDown, Nodes.Caption, Nodes.IP_Address,

T1.DownTime, Nodes.NodeID

FROM         (SELECT     MAX(EventTime) AS DownTime, NetObjectID, NetworkNode

                       FROM          Events

                       WHERE      (EventType = 1) AND (NetObjectType = 'N')

                       GROUP BY NetObjectID, NetworkNode) AS T1 INNER JOIN

                      Nodes ON T1.NetworkNode = Nodes.NodeID

WHERE     (Nodes.Status = '2') AND (Nodes.Owner = 'RHD')

ORDER BY HoursDown DESC, Nodes.Caption, T1.DownTime DESC, Nodes.NodeID

 

Output from this Query:

HoursDownNodeIP AddressDownTimeNode ID
139rtr.316864.ph.us.tgr.net10.165.4.111/2/2012 14:1818188
131rt2.023675.ph.us.tgr.net10.180.119.211/2/2012 22:1316384
120rt2.013146.ph.us.tgr.net10.81.4.211/3/2012 9:5615487
63rt2.013426.ph.us.tgr.net10.250.112.211/5/2012 18:1315560
42rtr.023040.ph.us.tgr.net10.80.164.111/6/2012 15:4816194
41rt2.012626.ph.us.tgr.net10.81.76.211/6/2012 16:5515348
39rt2.013236.ph.us.tgr.net10.7.34.211/6/2012 18:2215534
39rtr.023016.ph.us.tgr.net10.80.141.111/6/2012 18:0116174
36rt2.008384.ph.us.tgr.net10.74.64.211/6/2012 21:1314776
24rt2.026530.ph.us.tgr.net10.76.43.211/7/2012 9:4617140
17rt2.013122.ph.us.tgr.net10.81.94.211/7/2012 16:1115475
17rt2.013139.ph.us.tgr.net10.81.103.211/7/2012 16:1815484
16rtr.012934.ph.us.tgr.net10.82.80.111/7/2012 17:4815429
15rt2.006231.ph.us.tgr.net10.13.12.211/7/2012 18:2814567

Using sample.pl to create simple nodes

$
0
0

All,

I’m new to SolarWinds and Orion and using your API with Perl.  I can query the CMDB for existing node information using the sample.pl program so I know I have connectivity. Now I’m trying to add a node and am a little confused.  As directed, I checked the “Orion SDK.pdf” document for details on adding a node, and that pointed me to a table titled “Required Properties by Protocol”.  I’m trying to simply add a device for ICMP monitoring and according to the table, the minimum information I need to supply is the following;

 

EntityType – “Orion.Nodes”

IPAddress - <Simple IPv4 address>

IPAddressGUID - <?????????>

Caption - <Node/device name>

DynamicIP – “False”

EngineID – “1” (I assume)

Status – “1”

UnManaged – “False”

Allow64BitCounter – “False”

ObjectSubType – “ICMP”

 

Can someone tell me where I get an IPAddressGUID?  Is it necessary?

Thanks.

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

$
0
0

First, I'll share the script. Then, I'll explain why we need it and how it helps us in our environment.

To use the script you must have the Orion SDK installed on the monitored node.

 

Take the text below, paste in Powershell ISE and save it as a PS1.

------------------------------------ Start PS1 -----------------------------------------------------------------

 

# 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 = "SWnodemanagement"

$password = "MyP@44w0$d"

 

# 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 = 'SWServer1.domain.local'

$nodename = $env:COMPUTERNAME

 

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

$nodeid = Get-SwisData $swis "SELECT NodeID FROM Orion.Nodes WHERE SysName LIKE '$nodename%'"

$now =[DateTime ]:: Now

$later =$now.AddYears(99)

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

 

------------------------------------ End PS1 -----------------------------------------------------------------

 

 

 

And now the Remanage script. Again, save as a .PS1 file.

------------------------------------ Start PS1 -----------------------------------------------------------------

 

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

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

# This script will remanage a single node in the Orion database.

# 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 = "SWnodemanagement"

$password = "MyP@44w0%d"

 

 

# 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 = 'SWServer1.domain.local'

$nodename = $env:COMPUTERNAME

 

 

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

$nodeid = Get-SwisData $swis "SELECT NodeID FROM Orion.Nodes WHERE SysName LIKE '$nodename%'"

$now =[DateTime ]:: Now

$later =$now.AddYears(99)

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

 

------------------------------------ End PS1 -----------------------------------------------------------------

 

Explanation:

My company had a very unique need to monitor our enterprise Windows application that runs not only on standard desktop PCs, but also runs on mobile tablets connected to WiFi access points. These tablets run the standard Windows 7 Professional OS so it makes it easy to set up application monitoring in SolarWinds SAM for these machines. However, the problem comes at the end of the day when these tablets are turned off and placed in their charging docks for the night. As you can imagine, this creates an administrative nightmare (not to mention an email alert flood) in SolarWinds when this happens.

 

SolarWinds Orion NPM and SAM is designed to always keep an eye on a node or application that is entered in it's database. It is not designed to monitor an application or node only "part of the time" --- well, at least it isn't designed for this purpose out of the box. So instead, we have to create a workaround that will suit our needs. What we needed to do was figure out how to automatically "unmanage" these Windows tablet PCs in SolarWinds when they are shut down for the night, but also automatically "re-manage" them once they boot up. This is where the script comes into play.

 

The idea is to take the Unmanage script and apply it as a shut down script in Group Policy, then take the Remanage script and apply it as a boot up script in Group Policy.

Here is why this works for us:

The business is supposed to gracefully shut down the tablet by clicking Start > Shut down. If not, then an email alert triggers that informs us that the application is down on the machine.

If the tablet goes offline in the middle of the day for any reason, we will receive an email alert about that node.

When the machine is shut down properly, the node is automatically unmanaged in SolarWinds.

When the machine boots up and someone logs into the machine, the node is automatically remanaged in SolarWinds.

 

But here is an even better use for these scripts --- Scheduled Server Maintenance! How many times have we, server administrators, had to patch Windows Servers during scheduled maintenance hours? Normally you would have to go into SolarWinds and unmanage the node first BEFORE rebooting as not to trigger an email alert. Well with these scripts you wouldn't have to worry about that as much since this would be automatic.

 

Final notes:

Of course, this is just one way to go about auto-managing nodes in SolarWinds. There are some alternatives to doing this using the Orion SDK and Powershell which is to, instead, use the built-in .NET properties in Powershell 2.0 to access the Orion SQL database directly, find the node ID, and unmanage it in that manner. For those that are interested in how do to this without the Orion SDK, let me know and I'd be happy to elaborate.

add node to container powershell

$
0
0

Hello Guys,

 

I can't find how to add a node to group/container with powershell,

 

i have the uri of the node and for the group but i don't know how to merge them,

 

Please help with simple powershell code

Thanks

Adding a node to APM/SAM using powershell with WMI credentials

$
0
0

I have figured out how to add a node to APM/SAM using powershell, but it only works with ICMP (or snmp) as the ObjectSubType, not with WMI (well, it adds it, but web interface errors after doing so and I can't even go back and update the credentials)

I can add it as ICMP, and then change to WMI, but I would prefer to do this programmatically.

 

I assume I subsequently have to add a set of WMI credentials (in my example, I need to correlate credential '6' to that node) after the initial node creation, but can't figure out how.

 

Can anyone shed some light on what else I need to do to automatically provision a node using WMI and a set of credentials (which might already exist at which point I can search the credential ID, or might not, and have to add them as well)?

(v5.5)

 

Thanks!

How to set topology data polling interval ?

$
0
0

Dear Sir or Madam -


In SAM version 5.2, a node property was introduced called  "Poll for Topology Data Every [  ] minutes"  (on the GUI).

 

I assume this property is only used if there is an associated poller for Layer 3 topology, correct ?

 

When adding a node via the SWIS interface from Powershell, how do we set the value of this property ?

 

I used SWQL and SQL Server Management Studio to look for the property in the Orion.Nodes, but I cannot find it.

 

Thank you.

 

James Troy

Is it possible to acknowledge alerts programmically from a linux server?

$
0
0

We are using OpsGenie to aggregate all the alerts for our alerting. We'd like to integrate Solarwinds too. I was wondering if there is a way to programmically acknowledge alerts from a linux server? I was hoping there would be some sort of API for Solarwinds but it doesn’t look like that is the case. I contacted Solarwinds tech support and they pointed me here.


Custom SWQL Query for Nodes Down Showing Every Time Node Went Down

$
0
0

I'm trying to tweak our nodes down resource to add the date/time the system went down.  I'm trying to figure out why it is listing all the times the nodes have went down and not just the most recent. 

 

Here is the query:

SELECT

NodeName AS [Node Name],

        '/Orion/images/StatusIcons/Small-' + StatusIcon AS [_IconFor_Node Name],

        DetailsUrl AS [_LinkFor_Node Name],

        DOWNEVENT.EVENTTIME AS [DOWN TIME],

  Nodes.CustomProperties.Alert_Team as [ALERT TEAM]

FROM ORION.NODES NODES

INNER JOIN ORION.EVENTS DOWNEVENT

ON NODES.NODEID = DOWNEVENT.NETWORKNODE

WHERE STATUS = 2

ORDER BY NodeName

 

I am getting the following:

Capture-nodesdown.JPG

 

For the P server I'd like to just have the most recent time it has been down and not came back up, 9/2/2014 in this case.  For S server, 8/27/2014. 

 

Is this possible to filter those others out?

swql query using orion.* and ncm.*

$
0
0

I'm trying to use data from orion.nodes and ncm.nodes at the same time (list of devices not in ncm)

 

I can't figure out how to get it working. Is it because I'm digging into two different databases at the same time?

Using Powershell to add nodes with Custom Properties for Device Type

$
0
0

Hello,
Running Orion NPM 10.6.0 and SDK 1.7 on Win2k8R2

 

Can anyone help with adding devices into Orion using Powershell?

 

To complete via NPM Web console, select Management, Edit Node.
Select groups, break down the group to a specific node.
Choose node properties, then edit node.
Custom properties show Device_Type:

12-4-2013 3-35-46 PM.png

 

Sample script adding a server fails for the custom properties:
---------------

Add-PSSnapin SwisSnapin

# initialize SWIS connection
$swis = Connect-Swis -Certificate

# add a node
$newNodeProps = @
{
EntityType="Orion.NodesCustomProperties";
DisplayName="servername_here";
Device_Type="Server_Windows";
}

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

$nodeProps = Get-SwisObject $swis -Uri $newNodeUri Orion.Nodes

Output:
PS C:\> $newNodeUri = New-SwisObject $swis -EntityType "Orion.NodesCustomProperties" -Properties $newNodeProps
New-SwisObject : Cannot bind argument to parameter 'Properties' because it is null.
At line:1 char:89
+ $newNodeUri = New-SwisObject $swis -EntityType "Orion.NodesCustomProperties" -Properties <<<<  $newNodeProps
    + CategoryInfo          : InvalidData: (:) [New-SwisObject], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,SwisPowerShell.NewSwisObject

PS C:\>


Similar blog = http://thwack.solarwinds.com/message/163190#163190

What permissions does a user need to ack alerts via https?

$
0
0

This is a follow up question to Is it possible to acknowledge alerts programmically from a linux server?

 

I tried to make another user "apiuser" at https://solarwinds.mydomain.com so that I could use his in my script to ack alerts:

 

curl -k -u apiuser:password -X POST -H "Content-Type:application/json" -d "[[{\"DefinitionId\":\"88914a68-0d12-40c5-aca5-009a8284ad09\",\"ObjectId\":\"168\",\"ObjectType\":\"Node\"}]]"  https://solarwinds.brandeis.edu:17778/SolarWinds/InformationService/v3/Json/Invoke/Orion.AlertStatus/Acknowledge

 

When I try to execute this, it just returns with no information. When I use my creds, it returns "true" and it acks the alert. What permissions does apiuser need? I believe I need to grant his some more permissions in https://solarwinds.mydomain.com/Orion/Admin/Accounts/EditAccount.aspx

Is it possible to acknowledge alerts programmically from a linux server?

$
0
0

We are using OpsGenie to aggregate all the alerts for our alerting. We'd like to integrate Solarwinds too. I was wondering if there is a way to programmically acknowledge alerts from a linux server? I was hoping there would be some sort of API for Solarwinds but it doesn’t look like that is the case. I contacted Solarwinds tech support and they pointed me here.

Adding a node to APM/SAM using powershell with WMI credentials

$
0
0

I have figured out how to add a node to APM/SAM using powershell, but it only works with ICMP (or snmp) as the ObjectSubType, not with WMI (well, it adds it, but web interface errors after doing so and I can't even go back and update the credentials)

I can add it as ICMP, and then change to WMI, but I would prefer to do this programmatically.

 

I assume I subsequently have to add a set of WMI credentials (in my example, I need to correlate credential '6' to that node) after the initial node creation, but can't figure out how.

 

Can anyone shed some light on what else I need to do to automatically provision a node using WMI and a set of credentials (which might already exist at which point I can search the credential ID, or might not, and have to add them as well)?

(v5.5)

 

Thanks!

Orion SDK with PowerShell - manage/unmanage multiple nodes

$
0
0

I've been able to script unmanaging and managing nodes in powershell. However, for 400+ nodes, this ends up taking quite a while. Via script, it takes about 7 minutes to unmanage the nodes and over 10 minutes to remanage them. Doing this from the website takes about 25 seconds and no more than a minute, respectively. My guess is that the website somehow group updates the database instead of doing it one at a time. Anyone else seen this or have any idea how to do more than one node at a time? Below is sample code for how I am unmanaging a single node:

 

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

 

Thanks for any advice you have!


Is there a unique ID for alerts?

$
0
0

I am acknowledging alerts using the method described in this questions: Is it possible to acknowledge alerts programmically from a linux server?

 

I am looking for a unique ID that is attached to an alert so that I can place it into the subject of emails sent out via Trigger Actions. I noticed that AlertDefID is not unique. Is there something that I can place into the subject using the ${ } syntax?

Invalid username or password when connecting to Orion SDK via Powershell

$
0
0

I keep receiving invalid Username/password. My Orion account is linked with AD. Anyway I can connect using my AD credentials?

Modern Examples for .NET 4.5

$
0
0

Curious if anyone has gotten the VB.NET or C# examples in the SDK running in Visual Studio 2013?  Solarwinds, when do you plan to provide updated .NET examples in the SDK?

add node to container powershell

$
0
0

Hello Guys,

 

I can't find how to add a node to group/container with powershell,

 

i have the uri of the node and for the group but i don't know how to merge them,

 

Please help with simple powershell code

Thanks

SolarWinds to Service-Now Integration

$
0
0

SolarWinds & Service-Now

=====================

We’re trying to do the following (option 1 is our preferred while option 2 is a fallback):

1)

A) SolarWinds generates alert

B) SolarWinds uses a “webservice/api/sdk/other tool” to “communicate with/connect to” with the appropriate information so ServiceNow can open a ticket with the appropriate categorization, priority, whether it is internally or externally managed (ticket assignment changes depending), etc.

C) ServiceNow will communicate to the “response team” that there is a new ticket that must be addressed

D) ServiceNow will “communicate with/connect to” SolarWinds to acknowledge the alert and to record the ServiceNow ticket in to the acknowledgement notes

E) SolarWinds will register alert and set alert to acknowledged status and will include the ServiceNow ticket number

*END*

 

2)

A) SolarWinds generates alert

B) SolarWinds sends email notification to ServiceNow – email will need to be in appropriate form to be “absorbed”

C) ServiceNow “absorbs” email and generates a ticket with the appropriate categorization, priority, whether it is internally or externally managed (ticket assignment changes depending), etc.

D) ServiceNow “responds” to email with acknowledgement and ticket number

E) SolarWinds registers the response and sets the alert to acknowledged status and will include the ServiceNow ticket number

*END*

 

At this time, we’re looking for foundational materials to help us get started and determine the easiest/best way to perform one of these options and we’re hoping SolarWinds support can give us some pointers on where to researching documentation and what documentation may exist. Our hope is this is a relatively straight forward activity since it seems like it would be fairly standard that companies would want their monitoring and ticketing systems to interact. We have been rather ineffectually researching SolarWinds documentation and Thwack for roughly a week and have been unable to find the “start here” materials. We understand that the referenced SDK is not supported and we will have to use Thwack as support, however, at this point, we don’t have enough information to understand whether the SDK is our best/only option. We see in the release notes that there is the VBClient, etc. however it is unclear if this is the proscribed technique or just *A* technique.

 

Thanks in advance for your feedback and guidance!

Viewing all 3719 articles
Browse latest View live