AppMon: Monitoring non-OpenEdge Resources
The application monitor is a generic interface allowing ProTop to monitor pretty much anything. Essentially, ProTop runs any scripts defined in e.g. etc/appmon.myApp.cfg and generates alerts based on the output. The only requirement is that the first data output by the script must be an integer. Anything after the first word is appended to the body of the alert message.
For example, imagine a script erpcheck.sh that verifies if a 4gl process erpbatch.p is running:
#!/bin/bash # Script to check if erpbatch.p is running # PSLine=$(ps -ef | grep _progres | grep erpbatch);RetCode=$? if [ $RetCode = 0 ] then echo 0; echo $PSLine else echo 1; echo “erpbatch process not found” ### <-- NOTE: This message is reported by the zAppNote alert enhancer when the return code from the application script is "1", the second item in the statusList) meaning "Down" fi
The corresponding entry in etc/appmon.myApp.cfg would be:
# id "app name" "script" "statusList" 1 "ERP Check" ./bin/erpcheck.sh "Running,Down"
StatusList is a comma-separated list of statuses, with the first entry corresponding to the 0 returned by erpcheck.sh, the 2nd entry corresponding to a 1 returned by the script, etc...The script can return as many different statuses as required by the user.
The pt3agent will assign the integer value returned by the script to the alertable metric name statCode and the corresponding entry from the StatusList to alertable metric name appStatus. This means that in etc/alert.myApp.cfg, you could enter lines similar to:
appStatus char <> "Running" "3:3" "hourly" "myApp &2 &3 (&1)" page appStatus char <> "Running" "" "hourly" "myApp &2 &3 (&1)" alarm
- Create a resource on the portal or in etc/dblist.cfg named myApp (or any other meaningful name) with full db path = “-1” and monitored = yes.
- Copy [PROTOPDIR]/etc/appmon.cfg to [PROTOPDIR]/etc/appmon.myApp.cfg
- We have only one script in our example but you can add a line for each monitoring script you wish to run. The first column, ID, is simply a unique identifier
- Copy [PROTOPDIR]/etc/pt3agent.cfg to [PROTOPDIR]/etc/pt3agent.myApp.cfg
- Comment out the existing ptInitDC line
Add the following line:
Start ProTop RT and use the “e” command to display the Application Specific Activity Monitor
Create a blank /etc/alert.myApp.cfg and insert alerts on metrics statCode and/or appStatus
appStatus char <> "Running" "" "hourly" "Appmon &2 &3 (&1)" alert statCode num <> 0 "" "hourly" "Appmon &2 &3 (&1)" alert
Since the nag frequency is hourly, you may need to restart the agent to test any changes. Simply remove tmp/pt3agent.appmon.flg and the agent will gracefully exit. Within a minute or two, the DB Monitor will respawn a new agent.