Sw4   >   Web   >   SW Web App Monitoring
The web monitor created by the Omnis Studio
is a visual web monitor. The problem with the visual web monitor is that you must be at the web server to watch it and if you close the web monitor window you will lose all of the history.A non-visual web monitor is available in StudioWorks. The non-visual web monitor object, oWebMonitor, inserts a record for each web app request into a Webappstat table in the database. Summary reports can be generated and emails with the summary web app stats can be sent using a timer object.
This section explains how to set up the oWebMonitor object class for your StudioWorks web app.We instantiate the oWebMonitor object class with a task variable of the main library Startup_Task.
; Get the email address of the person to receive web app stats emails.
Calculate EmailAddr as cn.$:WebAppStatsEmailAddr
; Get the interval the web stats are to be sent. (kDay, kWeek, kMonth, kYear)
Calculate kInterval as cn.$:WebAppStatsInterval
; Initialize the oWebMonitor object.
Do webmon.$initialize(EmailAddr,kInterval) Returns FlagOK
Quit method FlagOK
If FlagOK
Do method initializeWebAppMonitor Returns FlagOK
End If
If not(FlagOK)
Do errhndlr.$promptonceLastError()
End If
Quit method FlagOK
If you want web stats to be emailed to yourself or someone else will need to add constants values to the startupsettings.txt file.
constants {
webappstatsemailaddr = youremail@yourdomain ;
webappstatsinterval = kDay ;
}
When an HTTP request is received by the Omnis Web App Server the specified remote task is instantiated. After the request is completed the following sequence occurs:
A similar thing happens with the $event method of the remote task which sends a $eventMethod message to oRemoteTask methods. If the event code is evBusy or evRejected an $addConnection($ctask,pEventCode) message is sent to oWebMonitor. The event code is included in the Webappstat record that is inserted into the database.
Reports can then be generated from records in the Webappstat table.
If you provided a webappstatsemailaddr in the startupsettings.txt file, then the oWebStatsEmailTimer object will automatically send an email with the web stats shortly after the last day of the specified webappstatsinterval. The web stats report is generated by sending a $retWebStatsList message to oWebMonitor and then a $convertWebStatsListToText message. The text is then put into the body of an email and sent to the the specified webappstatsemailaddr.
You can generate web stats reports from your code as follows:
Do webmon.$retWebStatsList() Returns List
If List.$linecount
Do webmon.$convertWebStatsListToText(List) Returns Text
End If