Technical Blog Post
Abstract
How to define a Threshold to run a custom script on the managed resource.
Body
Let's say you want to use a custom script /tmp/scripts/clean_logs.sh to clean up your logs when the Disk space exceeds a certain threshold limit. These are the general steps on how to do this.
Login to your APM Console, open the Threshold Manager from the left navigation bar, and go to System Configuration > Threshold Manager. In here, you will select a Data Source Type, for example Linux OS. The predefined thresholds for the Linux OS agent are displayed in the table. So let's say you want to add a new Threshold to call your external script, /tmp/scripts/clean_logs.sh. To do that, click on New to open the Threshold Editor for defining the application.
Define your Threshold and conditions by specifying values for the various parameters, such as Name, Severity, and Conditions. Select KLZ_Disk from the Data set field and enter your command in the Execute Command field. Use the following syntax: &{data_set.attribute} where, data_set is the data set name. If the data set or attribute name contains a space, replace with an underscore. For example,
KLZ_Disk.Disk_name is passed into the command script as $1.
/tmp/scripts/clean_logs.sh ${KLZ_Disk.Disk_Name}
You can pass in one or more parameters from the attribute group, like $1, $2 and so on to your clean_logs.sh script. So, now when your Threshold is triggered, the /tmp/scripts/clean_logs.sh script is run, and the parameters $1, $2 are passed to it. The commands are run on the monitored system where the events are triggered.
Good luck.
Noel Lewis
ITCAM / APM / ICAM L2 Support team
Subscribe and follow us for all the latest information directly on your social feeds:
|
|
|
Check out all our other posts and updates: | |
Academy Blogs: | https://goo.gl/U7cYYY |
Academy Videos: | https://goo.gl/FE7F59 |
Academy Google+: | https://goo.gl/Kj2mvZ |
Academy Twitter : | https://goo.gl/GsVecH |
UID
ibm11084443