Monitor almost anything with the generic AppManager Unix ExecUtil Knowledge Script

Monitor almost anything with the generic AppManager Unix ExecUtil Knowledge Script

This article explains how the Unix ExecUtil knowledge script AppManager can be can be leveraged to monitor almost anything on a Unix system with little knowledge on regular expressions / Perl / AWK.

Introduction

The UNIX_ExecUtil Knowledge Script (KS) is part of AppManager's Unix OS Module since version 7.4, which integrates external (third-party / open source etc) scripts / executable with AppManager. With this feature, user can execute these scripts / executable and gather important data. This data can be used for generating specific events OR creating chart. This feature can be used by running ExecUtil knowledge script.

Support Matrix

ExecUtil KS can be executed for the following:

  • Any script / executable / binary

  • All supported Unix agent platform

  • Unix agent version 7.1 and later.


Assumptions

ExecUtil KS does following assumption during its execution:

  • The script / executable / binary is present on the Unix agent machine

  • The script / executable / binary is executable.

  • Any dependency / prerequisites for the script / executable / binary is resolved.

  • The script / executable / binary should NOT be interactive.

  • The script / executable / binary should complete in a finite time.

  • The script / executable / binary will be running with the same privileges of Unix agent.


ExecUtil KS UI

ExecUtil KS UI along with its default settings is shown below. The KS settings can be categorized in following parts:

1 ) Inputs: KS UI prompts user to enter following:

  • Unix Executable OR script name. Absolute path of the file should be given if the file is NOT present in $PATH environment variable. (Mandatory)

  • Arguments to the script / executable (Optional)

  • Option to modify the environment settings (Optional)

    • Any environment variable can be set. The value put here will be exported as it is. No appending will happen. Ex: PATH=/usr/bin:$PATH

    • Any environment variable can be unset



  • Application Name: A string , which is used for prefixing events and collected data points.

  • Mode Type: User can select / remove Trial Mode.



1

2) Configurable parameters:

  • Event Settings

    • Option to raise event with STDOUT (not enabled by default)

      • Option to specify the event priority (Default Priority – 25)






 

  • Option to raise event with no output or failure (enabled by default)

    • Option to specify the event priority (Default priority – 5)




 

  • Option to raise event with the numeric data extracted through the data extraction command (applicable only in trial mode and not enabled by default)

    • Option to specify the event priority (Default Priority – 25)




 

  • Option to raise event in case of threshold exceeding for numeric data (applicable only in non-trial mode and not enabled by default)

    • Option to specify the event priority (Default priority – 5)




 

  • Option to raise event if a set of strings are matched in the standard output (applicable only in non-trial mode and not enabled by default)

    • Option to specify the event priority (Default priority – 5)

    • Multiple strings can be specified comma separated. Each string will be matched against the standard output and if found, a separate event will be raised for each match

    • Also, there will be an option to specify if this is a case sensitive (or insensitive) search.




 

  • Option to raise event if a set of strings are NOT matched in the standard output (applicable only in non-trial mode and not enabled by default)

    • Option to specify the event priority (Default priority – 5)

    • Multiple strings can be specified comma separated. Each string will be matched against the standard output and if NOT found, a separate event will be raised for each non-match

    • Also, there will be an option to specify if this is a case sensitive (or insensitive) search.



  • Data Collection and Graphing

    • Option to specify the metric names

      • These metric names will be used in graphs.






 

  • Option to specify the threshold values

    • These (min and max) thresholds will be compared against the respective numeric data collected for generating threshold events.




Mode Concept

ExecUtil KS can be executed in two Mode: Trail & Non-Trail

  • Trial Mode

    • This is a trial mode where user can try running the script with data extraction options

    • No threshold events or graphing takes place

    • Standard output, failure and standard error can be received as events

    • In case of data extraction, the user will be able to see the extracted numeric data through the data extraction command/expression as a separate event.



  • Non Trial Mod

    • Threshold events and graphs will be generated




 

Sample execution of the knowledge script

In this section we will take a task: Monitor Unix agent file for File size.

Solution: There are various way to find size of a file. we will use "wc" utility to find the size of the file.

wc <file name> returns following o/p

<number of lines> <number of characters> <number of bytes> <file name>

from this o/p we can extract the "number of bytes" values using any of the data extraction methods available in the KS UI. in this example we will use "awk" as the data extraction method.

1) Update the KS UI with the inputs as shown in the screen shot below:

2

In above screenshot, we have provided required inputs to the KS. Along with this, we have only selected events for standard o/p and error. Since the command will succeed and o/p will be generated, we will NOT get any event for "no output".

The standard o/p event will be displayed in the events tab of OC. The same is shown below.

3

The event's Message tab will have the "wc" command output.

4

So far looks good. 🙂

Now let's try extracting the file size value from this output. For this, we need to update the job properties as shown below.

5

Here, we have

  • checked "Collect Numeric Data" option

  • selected "awk command" as the "Data extraction method"

  • Data extraction argument field was updated as "'{print $3}'". This the awk syntax which will help us to extract the 3rd column (File size) from the output.

  • Metrics Name was updated with "File Size" . This string will be used to associate the extracted data.


Start the job again. In this run we should get two events. One is the standard output event and other one is titled with String "Trail Mode Data Collection". The same is shown below.

6

The "Trial Mode Data Collection" event Message Tab contains a summary of what happen with data extraction inputs.

7

Note: The above event is generated only when User has selected Trail Mode & Data collection check boxes.

Now that we are able to extract the right information in Trail mode, we are ready to deploy this script on this machine. For this, modify the KS properties, as shown below.

8

As shown in above snapshot, we have unchecked "Trail Mode" and "Raise event with standard output".

Update the Schedule Tab with Schedule tasks set to "Regular intervals" instead of "run once".

PS: Run once is the default setting for this KS.

9

Start the job with these properties. After some time, OC will show collected data under "Graph Data" tab.

10

This Tab provides option to create graphs from the collected data. The graph of this collected data might look like (as shown below)

11

 
Labels (1)

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
8 of 8
Last update:
‎2020-01-09 18:35
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.