cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post

Unmanage or mute nodes Perl script for Linux

Revised 2018-04-09

Users here requested a Perl script that they could use to unmanage/remanage nodes from a cron job on Linux. This Perl script can unmanage, remanage, mute, or unmute a single node or all objects* in a group. If you run the script against a group, any sub-groups will also be affected.

*Unmanage/remanage will only work against Orion entities that are unmanageable. Some entities, such as Transaction Steps, are inherently un-unmanageable. Mute/unmute works with any Orion entity type.

The script, as provided, does not support wildcards or pattern matching. However, you can easily modify the queries in the script to support wildcards. It's up to you - I wanted to force users to be exact when modifying nodes and groups.

The -n / --notification option uses the recently-added Orion "mute alerts" capability. It no longer relies on a custom property, so it will work with any Orion object type.

Usage:

  setsolarwindsunmanaged_for_thwack.pl -S <webserver -H <hostname> [-m [-t <duration>]|[-D]] [-n [-D]] [-d]

  setsolarwindsunmanaged_for_thwack.pl -h

Solarwinds Unmanagement Script

Uses RESTful API to unmanage/remanage Solarwinds nodes

Parameters:

-S, --server         Solarwinds web server address (IP or DNS)

-H, --hostname       Name of the node (VM or server) that should be (un)managed or (un)notified.

-G, --group          Name of the group that should be (un)managed or (un)notified.

-t, --time           Duration of the unmanaged period in minutes (applies only to management)

-n, --notication     Enable or disable NOTIFICATIONS for the specified nodes

-m, --management     Enable or disable MANAGEMENT for the specified nodes

-D, --disable        DISABLE management/notifications for the specified nodes

-d, --debug          Enable debug mode

-h, --help           Show this message

Examples:

Turn off notification for a single node

  setsolarwindsunmanaged_for_thwack.pl -H 10.10.10.1 -S solarwinds-server.your-domain.com -n -D

Remanage a single node

  setsolarwindsunmanaged_for_thwack.pl -H some-server.your-domain.com -S solarwinds-server.your-domain.com -m

Unmanage a single node for the next hour

  setsolarwindsunmanaged_for_thwack.pl -H SOMESERVER -S solarwinds-server.your-domain.com -m -D 60

Unmanage every item (nodes, apps, subgroups, etc.) in a group for the next 5 minutes

  setsolarwindsunmanaged_for_thwack.pl -G SomeSolarwindsGroup -S solarwinds-server.your-domain.com -m -D -t 5

Turn on notifications for every item in a group

  setsolarwindsunmanaged_for_thwack.pl -G SomeSolarwindsGroup -S solarwinds-server.your-domain.com -n

Attachments
Comments

I'm having issues with the Data::Encrypted stuff.

I used CPAN to get it installed. However, once I run the script I'm getting stuck with this error:

Bad key file format at /usr/local/share/perl5/Data/Encrypted.pm line 79

(in cleanup) Bad key file format at /usr/local/share/perl5/Data/Encrypted.pm line 183

I tried doing a basic ssh-keygen with no passphrase, but I get the same error.

I looked at the code in Encrypted.pm. This error is thrown when the key file doesn't begin with the string "SSH PRIVATE KEY FILE FORMAT 1.1". Does your key file contain this string? Is it a different format?

It does not. Is it possible to use something more current?

For testing, is it possible to remove the encryption code and hard code values in? I've been toying around with the script, but I seem to get compile errors with everything I try.

dlepi, were you ever able to get this to work? For testing, there's no reason you shouldn't be able to hard code the values you need.

Thanks for following up. I did not get it working, and then was distracted with other work. Since then I've had a job change and no longer have a need for this.

Did anyone here tried this and got it working? 

Version history
Revision #:
1 of 1
Last update:
‎12-30-2015 03:22 PM
Updated by: