Unmanage nodes Perl script for Linux

Version 4

    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 either a single node or all nodes in a group. If you run the script against a group, any sub-groups will also be affected.

     

    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.

     

    Be aware that the -n / --notification option is unique to my installation. It modifies a Node custom property ("Alerting") that we use to control whether or not Solarwinds will evaluate a node for alerts. If you use this script, you can either ignore this option or revise it so that it modifies some other custom property that you find useful.

     

    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