I've had this question a number of times recently and decided to put a short post together on it.  Many of our customers want to be able to setup alerting for a number of performance metrics and enable alert notifications consistently across a number of Unisphere instances.   Even if you have only one instance of Unisphere for VMAX this post will be of interest (Hopefully).

 

One way to do this is to login to a system and go through the alerts individually setting the alerts in question and enabling. Once complete you can export the settings via the GUI and import to other systems.   That's a **** of a lot of clicking around, configuring even one instance with a base set of values and alert settings can take a lot of time before you import and export. Surely there is a better way to do this

 

REST to the rescue!!

 

Imagine you could just pull the settings into a CSV file, edit them to what you want and upload again or to as many systems as you want.. With a few REST calls and a bit of python we can do just that. 


I've rolled all the necessary REST calls up into a five functions that call on each other and enable you to do all of this with just a couple of lines of code in a python script. 


For these functions to work you need to use the latest version of PyU4V and Unipshere for VMAX must be at version 8.4.

 

GitHub - ciarams87/PyU4V: A library showing some of the functionality possible using the ReST API of UniSphere for VMAX

 

Once you have PyU4V downloaded and installed as per the instructions on the readme.  Then create a script as follows.  Be sure to point your PyU4V.conf file to the instance of Unisphere that is the source for your performance thresholds and alert settings, or instantiate RestFunctions class with the correct IP address and settings.   In the example below I am using config file.

 

generateCSV.png

That's it!! the script will generate your CSV file in the directory you have executed from.

 

Below is a generated file, you could easily filter on the kpi column to reduce the number of metrics to show only metrics that are Key Performance Indicators, and make modifications to these values as you see fit.  More advanced users may have other metrics they want to alert on so all are listed here by default.

csvvalues.png

 

You can modify the Notify Boolean in the file as well as the first threshold and second threshold values which will change when a metric value is triggered and if an alert is sent to SNMP, EMAIL or Syslog. Don't modify the kpi Boolean value as it will have no effect on the outcome.

 

It's worth noting that any change to threshold values will also be reflective in Dashboard views in Unisphere, for example if you decide to lower the first threshold value for FE Balance to 1% you will see yellow in your dashboard if the difference between percentage busy between your busiest front end director and your least busy is 1% or more.  Also it's probably advisable to only alert on a subset of metrics, so use with caution and consult with your local Dell EMC performance team if you are unsure.


Setting alerts for 1000's of metrics will not be useful to anyone, the scripts here are intended to show you a way to standardise performance metric alerts across systems.


Uploading your changes.

 

Once you have saved your changes, you can use the saved file as a gold copy of your preferred metrics thresholds and notification settings and upload to Unisphere to make the changes.

 

uploadcsv.png

 

Running the script will update your performance settings for the instance of Unisphere your script is pointing at, you could easily loop over this if there are multiple  instances of Unisphere you want to update, but note this script will generate 1000's of REST calls so may take up to 15 minutes to run per Unisphere instance, this is infinitely faster than doing this by hand though

 

For more detail on implementation of the scripts and what's happening on the background read on, otherwise check out the updated GiTHub and feel free to make comments.

 

While all of this is done on one line, there are a few functions in rest_univmax2.py that make the magic happen.  In addition they use the utility function read_csv_values to parse the csv files read back to generate the JSON for the REST calls.

 

restalertfunctions.png

 

The main function that does the heavy lifting on your behalf is set_perf_threshold_and_alert.  When called with the correct parameters will make a PUT call to Unisphere to update the values for the given metric, Note there are some default values specified here that you may wish to tweak for your environment.

 

I've noted these in the comments for the function.

 

set_perf_and_alert.png

I've created a utility function that will read values from a CSV file and pass them to set_perf_threshold_and_alert function, this makes things much easier, as you can just call this function passing the name of the file generated and edited.  You may want to filter the settings more than I have here, I've left the function so it will update all metrics even if there are not changes.  To reduce runtime, you can remove metrics you are not interested in setting e.g. if you are not runnning SRDF you may just remove these from the file.

restmetrics.png

Inspect the code and feel free to make a Pull request if you see any improvements on how I am doing things.  I'm not a developer but I do like to script, maybe there are better ways I'm happy to learn.

 

NOTE: While REST can be used to update the notification settings for the Thresholds and Alerting you still need to manually configure your SMTP settings and recipients per Unisphere server, Hopefully we will have a REST call for that someday soon,  In the meantime, I hope this saves you some pain.

 

Feel free to leave comments.

 

UPDATE  Unipshere 9.1 has the ability to natively export and import all of this without any programming, you can still do things this way but you may not have to if you have a reference system you can simply export and import.