Share This:

The Script is designed to Monitor Grid Manager, Repository Manager, CDP's and Peers for critical attributes like for Peer it keeps a tab on Available Memory, Used Memory, Total Heap Memory, JVM Uptime, Management Grid Status, Main Grid Status, CDP/Peers Components Status (Health, Library Manager, Configuration, Context, Scheduler, Metrics, Job Manager, Adapter Manager, Activity Processor) and All Adapter status active on any Peers in the Grid. In case script find any issue in the adapters, grid or peer components it sends an email notification to the eMail address mentioned in the "Config.xml"

 

The script/tool has been written in python 3.6.6 version and can be run Windows or Linux machine irrespective of your BAO environment, Script leverages BAO REST API and Python web scraping techniques to collect data from REPO, Grid Manager and Peers.

 

To run the Script/Tool in Windows you can either directly run the executable file without the need of installing python 3.6.6 and its supporting library or you can install the python 3.6.6 and add required modules. (required module : requests)

 

To run script in Linux you would have to download and install python 3.6.6 or above and add "requests" module via pip or manually.

 

There are two version of the script attached, version v1.0 has been designed and tested primarily for BAO version 7.9.x and version v2.0 has been designed for BAO/TSO 8.x and above. All configurable parameter of the script/tool are controlled by "Config.xml" which should be kept in the same folder as script.

 

Version v1.0 features :

  • Monitors Grid Status, Active Threads,  Available Memory, Uptime etc

  • Peer Components Status

  • Adapter Status on all peers

  • Send Email Notification

  • Silent mode where all the result of the script get logged in log file.

 

Version v2.0 features: (version 2 has optimized code as from BAO/TSO 8.x peer components status are available through API and web scraping in not required to collect the same)

  • Monitor Repository

  • Monitors Grid Status, Active Threads,  Available Memory, Uptime etc

  • Peer Components Status

  • Adapter Status on all peers

  • Send Email Notification

  • Silent mode where all the result of the script get logged in log file.

Version v2.1

  • Password Encryption in Config.xml file
  • Password encryption tool

 

Version v2.1.1 (Fixes and Enhancement)

  • Reacquire authentication token when session expires.
  • Deduplication of Email Notification: Email notification are now only sent once to report unique issue unless there is a change in status of the issue email notification will not be sent in each iteration.

 

Enhancement in development:

  • Create Incident ticket in ITSM tool (Remedy or ServiceNow) to report the issue. (Beta testing in progress)
  • Create Event in Truesight Infrastructure Management aka TISM via REST API (In development)
  • Run Script/tool as Windows Service (In development)
  • Basic Remediation to fix identified problem (In development)

 

Steps to configure the script. (Note: Ensure script or executable and Config.xml file are kept in same folder)

1. Getting the Grid ID for your Grid Manager, login to the Grid Manager and go to Manage>Grids>Select your Grid Name and click on pencil sign for edit. copy the ID  and Grid Name as show below and past it in "Config.xml"

2. Provide your CDP server IP/FQDN and port details along with BAO/TSO admin account in the "Config.xml", also in "schedule-interval" provide the time interval in secs for script to check Grid Status, default is set to 90 sec however I would recommend to use at least 300+ sec (i.e. 5 mins + ) as "schedule-interval".

3. If you have only one Peer (i.e CDP) set "monitor-peers" to "False", else to monitor additional peers like HACDP, AP's and LAP's set it to "True" and provide peer details as show below in the respective peer tag.

4. SMTP server details are crucial for this script and you can customize email notification subject or body text, script support both "secure" and "unsecure" connection, for my local mail server I have set the field "Secure" as "False" however most mail servers required secure connections so set it to true.

 

5. If you are using self signed or CA signed certificates in your grid and peers set the "AllowInsecureRequest" as "True", else for manage MPKI signed certificate this can be set as "False", If you are running the script for initial test and wants to print the status/result on screen, set "print-onscreen" as "True". However I would suggest to set this on "False" once the configuration is completed properly so that script can be run in background and you can review things from "BAOMonitioring.log" (Note: Set the logging-level to "DEBUG" when 'print-onscreen' is set to "False" and if 'print-onscreen' is set to "True" set the logging-level to "INFO" )

 

6. Set the threshold limit for "Available Memory" is set via memory tag, its basically the memory limit after which script will start sending email notification to inform that available free memory of Java heap has dropped below set limit (default has been set as 200 MB) and Active Threads is set via threads tag, it basically is a trigger if BAO/TSO is consuming more thread than set limit as shown below

7. Repository URL, needs to be set only for version v2 script as show below.

Sample Config.xml

<ConnectionDetail>
   <server>192.168.32.123</server>
   <port>38080</port>
   <schedule-interval>90</schedule-interval>
   <user>aoadmin</user>
   <password>admin123</password>
   <GridID>urn:jxta:uuid-44D91B15DA074253825D94A184EE308802</GridID>
   <GridName>MyGrid</GridName>
   <AllowInsecureRequest>True</AllowInsecureRequest>
   <print-onscreen>True</print-onscreen>
   <EmailSetting>
   <SMTPServer>127.0.0.1</SMTPServer>
   <SMTPPort>587</SMTPPort>
   <Secure>False</Secure>
   <EmailUsername>support@test.local</EmailUsername>
   <EmailPassword>admin123</EmailPassword>
   <NotificationEmailAddress>admin@test.local</NotificationEmailAddress>
   <Subject>BAO Monitoring script found some error in the Grid</Subject>
   <Message>BAO Monitoring script reported concerns for below components</Message>
   </EmailSetting>
   <monitor-peers>True</monitor-peers>
   <peers peerType="HACDP">
   <peer>https://hacdp.test.local:38080</peer>
   </peers>
   <peers peerType="AP">
   <peer>https://ap1.test.local:58080</peer>
   <peer>https://ap2.test.local:68080</peer>
   </peers>
   <peers peerType="LAP">
   <peer>http://lap.test.local:48080</peer>
   </peers>
   <Threshold-limit>
   <memory>200</memory>
   <threads>400</threads>
   </Threshold-limit>
   <repoUrl>https://bao.test.com:28080/baorepo</repoUrl>
   <logging-level>INFO</logging-level>
</ConnectionDetail>

 

Note: If you don't have HACDP or AP or LAP, comment the particular tag in Config.xml using <!-- <tag>--> or remove the tag.

 

Sample Config.xml for 2.1 version.

<ConnectionDetail>
   <server>bao.test.local</server>
   <port>38080</port>
   <schedule-interval>90</schedule-interval>
   <enable-encryption>True</enable-encryption>
   <user>aoadmin</user>
   <encrypted-password>V1ZkU2lhOSGhOYWswOQ==</encrypted-password>
   <GridID>urn:jxta:uuid-E5D1AB3B3CB94AA48A93A7E2BE2814A702</GridID>
   <GridName>MyGrid</GridName>
   <AllowInsecureRequest>True</AllowInsecureRequest>
   <print-onscreen>True</print-onscreen>
   <EmailSetting>
   <SMTPServer>smtp.test.local</SMTPServer>
   <SMTPPort>465</SMTPPort>
   <Secure>True</Secure>
   <EmailUsername>admin@test.local</EmailUsername>
   <Email-encrypted-password>V1ZkU2RHRlhOSGhOYWswOQ==</Email-encrypted-password>
   <NotificationEmailAddress>support@test.local</NotificationEmailAddress>
   <Subject>BAO Monitoring script found some error in the Grid</Subject>
   <Message>BAO Monitoring script reported concerns for below components</Message>
   </EmailSetting>
   <monitor-peers>True</monitor-peers>
<!-- <peers peerType="HACDP">
  <peer></peer>
  </peers> -->
   <peers peerType="AP">
   <peer>https://ap1.test.local</peer>
   </peers>
<!-- <peers peerType="LAP">
  <peer></peer>
  </peers> -->
   <Threshold-limit>
   <memory>200</memory>
   <threads>400</threads>
   </Threshold-limit>
   <repoUrl>https://bao.test.local:28080/baorepo</repoUrl>
   <logging-level>INFO</logging-level>
</ConnectionDetail>

 

Note: For password encryption to work set "enable-encryption" to true and provide BAO password and SMTP password as encrypted through encryption tool.

 

Steps to Run or Deploy the script or executable.

  • In Windows with .exe file.

        After Configuring the "Config.xml" file double click on executable to run directly or run it from command prompt.

  • In Windows from .py file

        After Configuring the "Config.xml" file, Open command prompt and Type "python" then space followed by the script file name or to run in background type pythonw then space followed by the script file name.

  • In Linux from .py file

        After Configuring the "Config.xml" file, from terminal type python3 then space followed by the script file name and to run in background type python3 then space followed by script file name space followed by "&"

       example for running in background

               python3 BAOMonitoring_v2.py &

 

 

Encrypting Password for version 2.1

  • To encrypt password run the passwordtool.exe in windows and provide the password string as show below along with operation as "encrypt" and copy the encrypted output to the config.xml file for respective encrypted password tag.

        passwordtool.exe -p P@ssw0rd -o encrypt

PLEASE NOTE: THIS IS NOT AN BMC OFFICIAL SCRIPT OR TOOL FOR MONITORING BAO/TSO, BMC SUPPORT WILL NOT BE ABLE TO PROVIDE YOU ANY ASSISTANCE FOR THE SAME.

The Script/Tool has been designed only as a proof of concept by me, so kindly use it at your own discretion.

 

If anyone would like to contribute to the script below is the GitHub link for source.

GitHub - sandeep239/BAOMonitoringScript