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

No snap-ins have been registered for Windows PS v. 5.0

$
0
0

Hi Thwack,

 

As I was trying to unmanage whole groups at a time I stumbled upon OrionSDK and with that, PowerOrion.

I have installed OrionSDK and copied the PowerOrion directory to C:\Windows\System32\WindowsPowerShell\v1.0\Modules\.

Whenever I try to either Import-Module PowerOrion or Add-PSSnapin SwisSnapin I get this:

 

PS C:\Company> Add-PSSnapin SwisSnapin 

Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 5.

At line:1 char:1

+ Add-PSSnapin SwisSnapin

+ ~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidArgument: (SwisSnapin:String) [Add-PSSnapin], PSArgumentException

    + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

 

 

 

PS C:\Company> Import-Module PowerOrion

Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 5.

At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PowerOrion\PowerOrion.psm1:5 char:1

+ Add-PSSnapin SwisSnapin

+ ~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidArgument: (SwisSnapin:String) [Add-PSSnapin], PSArgumentException

    + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

 

I've tried running the following without success: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe 'C:\Program Files (x86)\SolarWinds\Orion SDK\SWQL Studio\SwisPowerShell.dll'

 

Any help is greatly appreciated.

 

Glad Regards,

Frederik Bruun


How can i create a hyperlink to nodetails page using SWQL?

$
0
0

I am using Custom Query resource with custom SWQL query and
search SWQL query.

 

custom
SWQL query

Select t1.Caption as NODENAME,t1.customproperties.NodeDetailsLink,t1.PercentLoss,
t1.AvgResponseTime, t1.lastsync,t1.nextpoll  from Orion.Nodes as t1 where
t1.customproperties.service like 'Videoconference' and t1.contact like
'test'

order by t1.caption

 

search
SWQL query

Select t1.Caption as
NODENAME,t1.customproperties.NodeDetailsLink,t1.PercentLoss,
t1.AvgResponseTime, t1.lastsync,t1.nextpoll  from Orion.Nodes as t1 where
t1.customproperties.service like 'Videoconference' and t1.contact like
'test' and t1.caption LIKE '%${SEARCH_STRING}%'

order by t1.caption

 

t1.customproperties.NodeDetailsLink is the custom
property with input : <a href="https://abc/Orion/NetPerfMon/NodeDetails.aspx?NetObject=N:4169">
Details </a>

 

When I am adding above custom field in my query it shows up
the input text not the hyperlink “Details” in the customized view.

SQWL: List of F5 Virtual Server

$
0
0

Hi, I am trying to replicate the List of Virtual Servers via a SWQL query, since I am unable to export this data directly.

 

Does anyone knows the correct joining table for this?  I found these links, but no answer as well...F5 Virtual Server Report for all F5s  , F5 Report 

 

If this can be displayed on the browser, can it be replicated via SWQL?

 

SWQL: CPU Core Count

$
0
0

Hi, I'm having trouble creating a report to show the core count via SWQL... it's showing me just 1 and 0...

 

Is there a way to do this via SWQL?

_____

SELECT distinct n.caption, n.IPAddress, count (DISTINCT n.CPUMultiLoadHistory.CPUIndex) as [CPU Core]

from orion.nodes n

left  join orion.NodesCustomProperties cp on n.NodeID = cp.NodeID

 

 

group by n.Caption, n.IPAddress, n.CPUMultiLoadHistory.CPUIndex

ResponseTime ErrorMessage query causes error

$
0
0

The ErrorMessage column does not come through for SWQL queries on the ResponseTime view, and attempting to access it causes an error.  The query below works while the rt.errormessage column is commented out.  Add it back in and you'll get an error.  We would like to test for text present / absent in the error message as a way of filtering / highlighting certain issues.

 

select rt.transactionid as t_id, rt.datetimeutc, AddDate('minute', -300, rt.datetimeutc) as LocalBusinessTime

, rt.minduration

, rt.status

, rt.percentavailability

, rt.screenshot

, rt.rawhtml

, rt.recordcount

, rt.archive

--, rt.errormessage

from orion.seum.responsetime rt

where rt.transactionid=50

and rt.archive=0

and rt.status not in (1)

 

Is it easier to add 62 nodes to be monitored by an agent to Orion via SDK or via the web UI?

$
0
0

Hi folks,

 

I'm trying to add 62 Windows server nodes from our DT1 test environment that will be monitored via agent.  We'll be monitoring the usual metrics, CPU, Mem, C: and D: volumes.  I bet there's an easy way to do this via SDK as opposed to the web UI... but I'm not sure how to go about it.  Powershell?  Straight import?  I have the information in an Excel spreadsheet which I can easily create a Servers.csv file and import it, perhaps...  SW support suggested I add the nodes' IPs as ICMP only, then group switch to agents, but I'd like to find a way to use the SDK and impress my boss and save time.  My apologies for asking such a general question, but I couldn't find anything in the forum on this.  Perhaps I have the wrong forum.  Any help is appreciated.

 

Thanks!

SWQL: Query a node based on 'Alerts Active Time' down

$
0
0

Hi,

 

I am trying to create a custom query window, that when an alert is triggered, it will only be displayed inside the query window for '5 Minutes', after the 5 minutes mark, the alert should disappear from the (5 min) Windows, then move up to the (10 Minute) query window with different escalation (alert name). 

 

I have created a sample query of the Alerts View below, but I'm not sure how I can put a filter by 'where 'active time' > 5 minute'.

 

Please help.  Thank you in advance!

 

 

SELECT  DISTINCT  

  o.AlertConfigurations.Name AS [ALERT NAME]  

    ,'/Orion/NetPerfMon/ActiveAlertDetails.aspx?NetObject=AAT:' + ToString(o.AlertObjectID) AS [_LinkFor_ALERT NAME] 

,Case 

WHEN o.AlertConfigurations.Severity = '0' THEN ('/Orion/images/ActiveAlerts/Serious.png') 

WHEN o.AlertConfigurations.Severity = '1' THEN ('/Orion/images/ActiveAlerts/Warning.png') 

WHEN o.AlertConfigurations.Severity = '2' THEN ('/Orion/images/ActiveAlerts/Critical.png') 

WHEN o.AlertConfigurations.Severity = '3' THEN ('/Orion/images/ActiveAlerts/InformationalAlert.png') 

WHEN o.AlertConfigurations.Severity = '4' THEN ('/Orion/images/ActiveAlerts/Notice.png') 

End as [_IconFor_ALERT NAME] 

 

  ,o.AlertActive.TriggeredMessage AS [ALERT MESSAGE]  

  ,o.EntityCaption AS [ALERT OBJECT]  

  ,o.EntityDetailsURL AS [_LinkFor_ALERT OBJECT] 

 

,CASE WHEN o.AlertActive.TriggeredDateTime IS NULL THEN NULL ELSE ( 

    TOSTRING(FLOOR(MINUTEDIFF(o.AlertActive.TriggeredDateTime,GETUTCDATE())/60.0)) + 'h ' + 

    TOSTRING(MINUTEDIFF(o.AlertActive.TriggeredDateTime,GETUTCDATE())%60) + 'm' 

) END AS [ACTIVE TIME] 

 

    ,o.RelatedNodeCaption AS [RELATED NODE]  

,o.RelatedNodeDetailsURL AS [_LinkFor_RELATED NODE]  

 

FROM Orion.AlertObjects o  

left join orion.nodes n on n.caption = o.EntityCaption 

 

 

LEFT JOIN Orion.AlertSuppression Supp ON n.Uri = Supp.EntityUri 

 

WHERE   o.AlertActive.TriggeredMessage <> '' and o.AlertConfigurations.Name = 'TEST-Critical' AND (Supp.ID IS NULL OR (Supp.SuppressFrom > GETUTCDATE() AND (Supp.SuppressUntil IS NULL OR Supp.SuppressUntil > GETUTCDATE())))

 

ORDER by o.AlertActive.TriggeredDateTime 

No snap-ins have been registered for Windows PS v. 5.0

$
0
0

Hi Thwack,

 

As I was trying to unmanage whole groups at a time I stumbled upon OrionSDK and with that, PowerOrion.

I have installed OrionSDK and copied the PowerOrion directory to C:\Windows\System32\WindowsPowerShell\v1.0\Modules\.

Whenever I try to either Import-Module PowerOrion or Add-PSSnapin SwisSnapin I get this:

 

PS C:\Company> Add-PSSnapin SwisSnapin 

Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 5.

At line:1 char:1

+ Add-PSSnapin SwisSnapin

+ ~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidArgument: (SwisSnapin:String) [Add-PSSnapin], PSArgumentException

    + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

 

 

 

PS C:\Company> Import-Module PowerOrion

Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 5.

At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PowerOrion\PowerOrion.psm1:5 char:1

+ Add-PSSnapin SwisSnapin

+ ~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidArgument: (SwisSnapin:String) [Add-PSSnapin], PSArgumentException

    + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

 

I've tried running the following without success: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe 'C:\Program Files (x86)\SolarWinds\Orion SDK\SWQL Studio\SwisPowerShell.dll'

 

Any help is greatly appreciated.

 

Glad Regards,

Frederik Bruun


SWQL Examples

$
0
0

I'm new to SWQL and have no prior knowledge of SQL queries so was looking for some  examples to learn the language and do some experimenting with but been unable to find anything.

 

I've looked on GitHub and downloaded the studio but there's no documentation of examples on their.

 

I was wondering if there was any documentation with examples in that I can use to learn from so I can develop my own queries?

 

Thanks

 

Jon

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.

SWQL Examples

$
0
0

I'm new to SWQL and have no prior knowledge of SQL queries so was looking for some  examples to learn the language and do some experimenting with but been unable to find anything.

 

I've looked on GitHub and downloaded the studio but there's no documentation of examples on their.

 

I was wondering if there was any documentation with examples in that I can use to learn from so I can develop my own queries?

 

Thanks

 

Jon

No snap-ins have been registered for Windows PS v. 5.0

$
0
0

Hi Thwack,

 

As I was trying to unmanage whole groups at a time I stumbled upon OrionSDK and with that, PowerOrion.

I have installed OrionSDK and copied the PowerOrion directory to C:\Windows\System32\WindowsPowerShell\v1.0\Modules\.

Whenever I try to either Import-Module PowerOrion or Add-PSSnapin SwisSnapin I get this:

 

PS C:\Company> Add-PSSnapin SwisSnapin 

Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 5.

At line:1 char:1

+ Add-PSSnapin SwisSnapin

+ ~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidArgument: (SwisSnapin:String) [Add-PSSnapin], PSArgumentException

    + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

 

 

 

PS C:\Company> Import-Module PowerOrion

Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 5.

At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PowerOrion\PowerOrion.psm1:5 char:1

+ Add-PSSnapin SwisSnapin

+ ~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidArgument: (SwisSnapin:String) [Add-PSSnapin], PSArgumentException

    + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

 

I've tried running the following without success: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe 'C:\Program Files (x86)\SolarWinds\Orion SDK\SWQL Studio\SwisPowerShell.dll'

 

Any help is greatly appreciated.

 

Glad Regards,

Frederik Bruun

SWQL: Triggering an email notification when someone mutes a node, after it's down.

$
0
0

Hi, please bear with me here..

I'm trying to create an alert, that when a node goes down, it triggers a custom property 'Node_Down_Trigger' = 'Node Down'.  Now, when someone 'MUTES' a node, IF, the custom property 'Node_Down_Trigger' = 'Node Down', THEN the trigger action would change 'Node Down_Trigger' = 'Acknowledge' AND sends and email, with text saying that someone is working on the down server.

 

To add, when a server goes DOWN, I have a trigger setting the 'Node_Down_Trigger' = ''Node Down', and when it resets, it changes to 'Node Online'.  This helps me identify if a server is muted while 'online' for maintenance, or 'down' for support escalation, or a node went down, then came back online without support looking into it.

 

Now, I've created this SWQL Alert and Trigger Action below, which is the only way I know how to include a custom property field.

 

However, I think there's an issue, that IF someone MUTES the alert, the trigger action is suppressed and does not take place.  Only when I have, 'resumed' alerts is when I get the trigger.

 

Q: IS there a way to have this type of alert+trigger?

 

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.

Solarwind API

$
0
0

We required API which can be integrate into the .net framework system.

 

If possible could you please provide us a Example for the same with asp.net integration.

 


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.

Some fields are not being populated or have an incorrect results using Python - API

$
0
0

Hi,

 

I've noticed that the CPU and Memory fields have NULL values when I tried adding nodes using API - Python.
I already tried to declare these fields in the code but the still have an issue

 

props = {

            'IPAddress': ip_address,

            'Caption': node_name,

            'EngineID': 1,

            'ObjectSubType': 'SNMP',

            'SNMPVersion': 2,

            'Community': 'CWTRead',

            'Allow64BitCounters': True,

            'DynamicIP': False,

            'SysObjectID': '',

            'DNS': '',

            'MachineType': '',

            'Vendor': '',

            'RediscoveryInterval': 30,

            'PollInterval': 120,

            'ChildStatus':  1,

            'StatCollection': 10,

            'NodeDescription': '',

            'MemoryUsed': -2, --> after a couple for polling/ rediscover the value is still -2

            'TotalMemory': -2,  --> after a couple for polling/ rediscover the value is still -2

            'External': '',

            'CPULoad': 1,  --> after a couple for polling/ rediscover the value is still 1. Note: the sample device I used is also monitored in our Prod and the CPULoad is not 1

            'Location': ''

}

Automation of adding nodes into Solarwinds

$
0
0

Hi All

 

We are looking at using Chef to automate server deployment and part of this work would be:

 

1. Lookup in IPAM the next available address in a subnet, reserve it and add the hostname to the reservation

2. Chef passes a name/IP and node creation (and possible node type or template name) request to Solarwinds for monitoring

3. Solarwinds adds the above node and enables a predefined set of base monitors.

 

The next parts are to do with Chef running scripts to talk to Solarwind

  1. 1.       Chef sends a script to disable monitoring of an existing node
  2. 2.       Chef sends a script to enable monitoring of an existing node
  3. 3.       Chef sends a script to delete an existing node

 

If anyone has any automation style scripts they can share, or any pitfalls to avoid when doing this work I would appreciate any input

 

 

Thanks

 

Simon

 

How to Acknowledge Alerts via REST API

$
0
0

We are trying to send an Acknowledge REST API call to our Orion server from another system, however we can't seem to figure out how to format the JSON properly.  I have found many posts on Thwack with examples but they all seem to be for the old alerting schema and don't seem to apply to what we are seeing as the arguments for the Acknowledge verb in SWQL Studio.

 

tdanner shows in this post here to send it with 4 different arguments: DefinitionId, ObjectType, ObjectId, and Notes.  However, if you expand the Acknowledge verb under the "AlertsActive" entity in SWQL Studio you will see that the only two arguments needed is the AlertObjectIDs (which is an array of one or more ID's you can send) and the Notes argument. 

 

Here is what we are trying to send in the body now and it's not working:

 

POST https://PrimaryOrionServer:17778/SolarWinds/InformationService/v3/Json/Invoke/Orion.AlertActive/Acknowledge
[{"alertObjectIds":[{"ids":146735}], "notes":"Incident undefined created on undefined by ServiceNow System. I like Batman. He is kewl."}]

 

We think the problem is how we are formatting the alertObjectIds since, even though we are only wanting to acknowledge one Alert at a time, the argument is an array and thus should be formatted as one, correct?

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.

Viewing all 3719 articles
Browse latest View live


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