ELECTRONIC SEISMOLOGIST

November/December 2007

The Antelope Interface to PHP and Applications: Web-based Real-time Monitoring

K.G. Lindquist, R.L. Newman, and F.L. Vernon

INTRODUCTION

[Figure 1]

Figure 1. Schematic of the underlying software layers. Data are retrieved from Datascope databases and Antelope orbservers by the Antelope libds.so and liborb.so shared-object libraries, respectively. These native Antelope libraries are linked to the PHP inter-preter by the new Datascope.so and Orb.so PHP extension libraries, allowing data to be displayed on Web pages using PHP code embedded in HTML. A parallel sysinfo.so extension library provides access to a number of Antelope system-information utilities.

The World Wide Web has become a de facto standard for the distribution of wide varieties of data, including monitoring information from real-time systems. The Antelope Environmental Monitoring System (AEMS) is one such system widely used in seismology (Boulder Real Time Technologies 2007). The open architecture of the Antelope system has made it possible to write numerous open-source extensions. The current work describes one such open-source extension specifically designed for the Web.

The PHP Hypertext Processor language (referred to by the recursive acronym PHP) is a popular server-side processing language embedded within hypertext markup language (HTML) (PHP 2007; Lerdorf and Tatroe 2002). As an open-source middle layer between Web server and Web client, PHP provides a platform for integrating third-party extensions as dynamically loaded shared objects. The underlying Zend engine (Zend 2007) provides an architecture for easily implementing such extensions (Golemon 2006). Extensions have been developed for a wide variety of purposes, including database connectivity (e.g., MySQL and PostgreSQL) and access to services (e.g., Mail, FTP, LDAP, and SNMP). These extensions include the many PHP utilities under the PECL online repository (PECL 2007) and reusable applications and components under the PEAR repository (PEAR 2007).

We have combined these two technologies (AEMS and Zend) to produce an Antelope interface in the PHP language (figure 1). Initial versions of the interface were written in PHP 4; we switched to PHP 5 for its extensive object-oriented programming support. This allowed object ring buffer (ORB) packets to be properly handled and their contents explored. The Antelope PHP tools allow developers to quickly and easily write dynamic Web pages that access data resources in Antelope orbservers and Datascope relational databases, the latter possibly created by an Antelope real-time system. The Antelope PHP interfaces are dynamically loaded by PHP called from within a Web server, such as the Apache HTTP server (PHP 2007).

The Antelope toolbox for PHP fully supports Antelope’s parameter-file mechanisms, which allows parameter-file-driven generalization of Web page configuration. It has also implemented the Datascope trace object structure to allow interaction with, and extraction of, seismic waveforms.

We have attempted to generalize the toolkits as much as possible to allow them to be run at all Antelope installations, with the caveat that some standardization of the server-side software is required to allow the full use of the respective extension functions.

[Figure 2]

Figure 2. The compile structure of the Antelope contributed-code repository (left, “SOURCE”) and the built structure after make install (right, “BUILT”). An example application, weborbstat, is shown in all its component parts, in the initial compile and the resultant built structure. Weborbstat is a simple application that connects to an ORB, displaying a table of station names and respective data-latencies (Figure 4). Each application is required to have a) a Unix manual page, b) a user-defined parameter file, c) the application itself (.php), and d) a css file. Client-side interaction is provided by a optional js file. Applications are often provided optional image files as well. Note how each component part is distributed into a different directory. Further detail on this and other applications in the text. css: Cascading Style Sheet, js: Javascript.

THE INTERFACE

The Antelope interface to PHP is implemented in three distinct parts (figure 1). These are expressed as PHP-linkable shared-object libraries called Datascope, Orb, and Sysinfo, for database operations, real-time ORB stream operations, and system interaction, respectively. In addition to database interaction, the Datascope library also supports a variety of specialized functions for seismology. All three of these libraries are thoroughly implemented such that they approximately match the established Antelope Perl interface. We were able to implement the Datascope and Sysinfo libraries in both PHP 4 and PHP 5. The Orb library required a migration to PHP 5 so the improved object-handling capabilities could be used to write functions that unstuff data packets and manage their contents.

LIBRARY TOOLS AND APPLICATIONS

The new Web site applications are designed to fit within the compile structure of the Antelope contributed-code repository (figure 2). This simplifies the environment for building an application to a common framework. This is achieved with the standard Unix make utility (Oram and Talbott 1991).

The compile structure includes templates for the automatic insertion of PHP headers into scripts with proper Antelope environment variables. Applications are version-controlled with Concurrent Versions System (CVS), allowing for rebuilding and “rollbacks” if developers accidentally modify source code. The sample applications outlined below currently exist in the Antelope contributed-source-code repository (AUG 2007) and are designed to be installed and configured by a competent administrator with relative ease and without the need for extensive Web-development programming knowledge. They were chosen to illustrate the breadth of development that these interfaces allow. All that is required to start these applications working on a local host is a running Web server application, such as Apache, that has been configured to process PHP files, and copies of the libraries described herein placed in the PHP extensions directory (PHP 2007).

[Figure 3]

Figure 3. Weborbstat is a Web-based display of station data latencies in an ORB. (A) The configurable simple parameter file allows full customization, including images and a CSS file. (B) Screen dump of the running application in a Web browser. Note how different data-latency levels are color-coded to allow easy diagnostics. This installation is displaying data from the Transportable Array (TA) data of the Earthscope USArray project. More information in the text.

Weborbstat

Weborbstat is a simple application to display data latencies from an Antelope ORB. The parameter file has configurable options that include an ORB name, a regular expression subset to define the packets to retrieve and display, a page refresh time, and a series of data-latency levels with corresponding hexadecimal color codes (figure 3A). A screen shot of the running application in a Web browser illustrates how stations with high data latencies can be easily highlighted using this structure (figure 3B). An expanded version of this application is used on the Array Network Facility (ANF) Web site to display data latencies of both the Transportable Array and contributed network stations (http://anf.ucsd.edu/stations.php; Newman et al. 2004).

[Figure 4]

Figure 4. Examples of Web-based applications driven by the Antelope interface to PHP. (A) Pfexplorer—an interactive tool to open and explore the node tree of any Antelope parameter file. (B) Webdbe—a tool to interact with Datascope databases designed to replicate the behavior of the standard Tcl/Tk dbe application that ships with Antelope. Both these applications are in the contributed code for Antelope.

Pfexplorer

Pfexplorer is a cascading style sheet- (CSS) and JavaScriptpowered tiered display of Antelope parameter file structures (figure 4A). It allows a user to interactively explore the parameter file node tree from within a browser.

Webdbe

This is a simplified Web-based, schema-independent database explorer similar to the native TCL/Tk Antelope dbe application (figure 4B shows an example using the Center for Seismic Studies 3.0 schema). All tables in a database can be opened and closed, views can be subsetted to create new views, and columns can be forward or reverse sorted.

[Figure 5]

Figure 5. Screen dumps of the ROADNet Realtime Imagebank. (A) A list of cameras that provide images are listed in the “Camera Selector” drop-down menu in the top-left. If available for the selected camera, a time-lapse movie of the last day is displayed in the “Pre-made movies” panel. The main panel (”Requested Image”) displays the latest image from the selected camera, with associated metadata including the camera description and time that the photograph was taken. In addition, a link at the top of the panel provides a search function for photographs taken by the camera and a link at the bottom of the panel provides access to the highest resolution version of the selected photograph. Beneath this is a table (“Database Table Entries”) displaying the most recent 20 photographs taken at the site. Many of the display options (color scheme, number of recent photographs, if movies are created) are customizable via a parameter file. The application has been running continuously since August 2003. (B) Really Simple Syndication (RSS 2.0) feed of the latest photographs taken by the cameras in the ROADNet Realtime Imagebank project. The feed is updated with the latest images every five minutes and has been in operation since September 2006.

ROADNet Real Time Image Bank (Web site and RSS feed)

The ROADNet project (Hansen et al. 2006; ROADNet 2007) acquires and stores real-time data streams from multiple sources of sensor data. One such set of streams is from cameras distributed throughout southern California and also deployed as shipboard cameras on two research vessels, the R/V Melville and R/V Revelle (Lindquist et al. 2004; Naramore 2006). These images are streamed in near-real-time via Antelope orbservers into a Datascope database. The images are then served through a Web interface that also provides a historical view and a search function (figure 5A; RTIMBANK 2007). A real simple syndication (RSS) feed (Hammersley 2005) of these images has also been created to allow RSS readers to display the latest photographs (figure 5B).

Array Network Facility (ANF) Web Site

Data from the USArray component of the EarthScope experiment is collected and disseminated by the Array Network Facility (ANF) located at the University of California, San Diego (http://anf.ucsd.edu). The ANF Web site provides multiple tools for assessing Transportable Array (TA) station metadata and state-ofhealth including data return rates, instrument response functions, event distribution maps, and datalogger status (Newman et al. 2004, 2005, 2006, 2007). All these applications have been developed with the PHP extensions discussed in this paper, many of which utilize all three extensions together to display real-time status information to ANF and Incorporated Research Institutions for Seismology Data Management Center staff and analysts, TA station engineers, research seismologists, and the general public.

Dbwebproject

The applications described above consist of many distinct files of various types, all of which must be installed in the correct places under the Web server’s control and with the correct relationships in order for the tools to work as intended. This installation process can be tedious, confusing, and exacting. We have written a program called dbwebproject, which automates much of this installation process. The dbwebproject follows an Antelope parameter-file “template” for a Web site to install all necessary components. Several additional features support Web sites that include dynamic content.

[Figure 6]

Figure 6. Screen dumps of two versions of the application webdbshow. (A) The default layout that is in the contributed software reposi-tory and (B) a modified local version. The differences in layout and formatting are achieved through modifications to the Cascading Style-Sheet (.css) file only.

SEPARATION OF CONTENT AND LAYOUT: THE CASCADING STYLE SHEETS MODEL

In developing the various applications described we have taken care to separate the application query and process code (PHP) and document structure (HTML) from the code that defines layout and formatting for the end user (viz. the Web browser). This device-independent method of document presentation is achieved through the use of cascading style sheets, or CSS (W3C 2007). This separation allows application source code to be concise and uncluttered with formatting code, yet still provides a means to add formatting and layout rules based on database or ORB query results. Equally important, it allows complete customization of the application without prior knowledge of PHP or HTML, only CSS. The ability to modify an application like this allows developers to structure their CSS in accordance with an institution’s or research group’s current online identity (e.g., institution logos, color schemes, and text formatting), retaining a uniform online presence. A sample comparison is shown in figure 6, where two different styles of webdbshow, a Web-based view of Datascope database tables, are achieved through modification of a single CSS file. Webdbshow is part of the Antelope contributed code repository.

CHALLENGES AND CURRENT LIMITATIONS

One of the clear challenges in writing Web applications for database interaction has been the stateless nature of hypertext transfer protocol (HTTP) communications. While persistent connections can be simulated with sessions, cookies, and other workarounds, fundamentally the interactions have been limited since the Antelope PHP interface does not interact with the Datascope databases through any kind of server model. The database operations must start afresh with each invocation of an Antelope-PHP Web page. We are addressing these issues in our work with the storage resource broker as mentioned below. Furthermore, the tools described here do not obviate the need for standard secure Web-coding practices when interacting with data, metadata, Web servers and databases. For such issues the reader is referred to other resources (e.g., PHPSEC 2007).

ONGOING WORK

We are developing additional applications, including a Webbased equivalent of the Antelope dlmon application, called webdlmon, for monitoring the state-of-health of networks of dataloggers (http://anf.ucsd.edu/tools/dlmon/webdlmon.php); Newman et al. 2007). David Slater and his colleagues at the University of Nevada, Reno, have applied these tools to mobile devices (Slater et al. 2007). Notable parts of the Antelope PHP libraries have been cloned to the Antelope interface to the Storage Resource Broker (SRB), such that Web code developed for the native Antelope library can be run virtually without change on databases and orbservers virtualized through the SRB server (Lindquist et al. 2006). This work and the work in Lindquist et al. (2006) take great care in this work to make the interfaces completely parallel for seamless compatibility between applications written on native Antelope entities and those written on Antelope entities virtualized through the SRB. This work introduces a server model to the Datascope database operations that promises to resolve many of the limitations from stateless interaction described earlier.

AVAILABILITY

Source code for the Antelope interface to PHP is available through the Antelope contributed-code repository at http://www.indiana.edu/~aug.

ACKNOWLEDGMENTS

The authors wish to thank Steve Foley and Geoff Davis of the Institute of Geophysics and Planetary Physics, UCSD, for extensive system administration work during the development of this interface. Preliminary versions of this work were presented in poster form as Lindquist et al. 2003, 2005. This work was supported by NSF Grant OCE-0121726 and IRIS grant 472 under NSF Grants EAR-0350030 and EAR-0323309.

REFERENCES

AUG (2007). The Antelope Users Group. http://www.indiana.edu/~aug (accessed 4/9/07).

Boulder Real Time Technologies (2007). http://www.brtt.com (accessed 1/27/07).

Golemon, S. (2006). Extending and Embedding PHP. Indianapolis: Sams, 456 pps.

Hammersley, B. (2005). Developing Feeds with RSS and Atom. Beijing and Cambridge: O’Reilly Media, Inc., 270 pps.

Hansen, T., S. Foley, K. Lindquist, N. Cotofana, L. Ding, L. Hazard, M. Otero, E. Terrill, F. Vernon, and J. Orcutt (2006). ROADNet: A network of sensor nets. In Proceedings of the First IEEE International Workshop on Practical Issues in Building Sensor Network Applications (SenseApp 2006), in conjunction with Local Computer Networks 2006.

Lerdorf, R., and K. Tatroe (2002). Programming PHP. Beijing and Sebastopol, CA: O’Reilly, 524 pps.

Lindquist, K. G., R. L. Newman, A. Nayak, F. L. Vernon, C. Nelson, T. S. Hansen, and R. Yuen-Wong (2003). Dynamic Web expression for near-real-time sensor networks. EOS—Transactions of the American Geophysical Union 84 (46), Fall meeting supplement, Abstract ED32C-1205.

Lindquist, K. G., T. S. Hansen, R. L. Newman, F. L. Vernon, A. Nayak, S. Foley, T. T. Fricke, J. Orcutt, and A. Rajasekar (2004). Digital image support in the ROADNet real-time monitoring platform. EOS— Transactions of the American Geophysical Union 85 (47), Fall meeting supplement, Abstract SF41A-0755.

Lindquist, K. G., R. L. Newman, F. L. Vernon, T. S. Hansen, and J. Orcutt (2005). Improvements to Web toolkits for Antelope-based real-time monitoring systems. EOS—Transactions of the American Geophysical Union 86 (52), Fall meeting supplement, Abstract IN13A-1081.

Lindquist, K. G., A. Rajasekar, F. L. Vernon, and J. Orcutt (2006). SRB interfaces to the Antelope environmental monitoring system: The Antelope ORBServer, Datascope database system, and deployable ROADNet point-of-presence. In San Diego Supercomputing Center Technical Report SDSC TR-2006-1, ed. R. W. Moore, San Diego: San Diego Supercomputer Center, 79 pps.

Naramore, E. (2006). PHP from the shop floor: Bringing environmental monitoring to the Internet. PHP International Magazine. http://www-php.net (accessed 3/15/07).

Newman, R. L., K. G. Lindquist, T. S. Hansen, F. L. Vernon, J. A. Eakins, and S. Foley (2004). Web-based data mining to systematically determine data quality from the EarthScope USArray seismic observatory project. EOS—Transactions of the American Geophysical Union 85 (47), Fall meeting supplement, Abstract NG43A-0435.

Newman, R. L., K. G. Lindquist, T. S. Hansen, F. L. Vernon, J. A. Eakins, S. Foley, and J. Orcutt (2005). Applying a toolkit for dissemination and analysis of near-real-time data through the World Wide Web: Integration of the Antelope real time system, ROADNet, and PHP. EOS—Transactions of the American Geophysical Union 86 (52), Fall meeting supplement, Abstract IN13A-1078.

Newman, R. L., K. G. Lindquist, S. Foley, G. A. Davis, F. L. Vernon, J. Eakins, and L. Astiz (2006). “Monitoring the monitors: Assessing and visualizing the state-of-health of Earthscope’s Transportable Array. EOS—Transactions of the American Geophysical Union 87 (52), Fall meeting supplement, Abstract IN23A-1213. Newman, R. L., K. G. Lindquist, F. L. Vernon, G. A. Davis, J. Eakins, and L. Astiz (2007). Advances in Web-based visualization of the state of health of Earthscope’s Transportable Array: webdlmon. Poster presented at the 2007 EarthScope meeting, Monterey, CA.

Oram, A., and S. Talbot (1991). Managing Projects with Make. Sebastopol, CA: O’Reilly & Associates, 148 pps.

PEAR (2007). PEAR: The PHP Extension and Application Library. http://pear.php.net/ (accessed 3/15/07).

PECL (2007). PECL: The PHP Extension Community Library. http://pecl.php.net/ (accessed 3/15/07).

PHP (2007). PHP: Hypertext Preprocessor. http://www.php.net (accessed 3/15/07).

PHPSEC (2007). PHP Security Consortium. http://phpsec.org (accessed 7/20/07).

ROADNet (2007). ROADNet: The Real-time Observatories, Applications, and Data management Network. http://roadnet.ucsd.edu (accessed 3/15/07).

RTIMBANK (2007). Real-Time Imagebank. http://mercali.ucsd.edu/ rtapps/rtimbank.php (accessed 3/15/07).

Slater, D., K. G. Lindquist, K. Smith, R. L. Newman, and I. Tibuleac (2007). Use of mobile devices for seismic network applications, diagnostics, and responses. Seismological Research Letters 78 (2), 248.

W3C (2007). World Wide Web Consortium. http://www.w3.org (accessed 4/10/07).

Zend (2007). Zend: The PHP Company. http://www.zend.com (accessed 3/15/07).


Lindquist Consulting, Inc.
59 College Road Suite 7
Fairbanks, Alaska 99701 USA
kent [at] lindquistconsulting.com
(K.L.)


Scripps Institution of Oceanography
University of California, San Diego
9500 Gilman Drive
La Jolla, California 92093 USA
rlnewman [at] ucsd.edu
(R. N.)


flvernon [at] ucsd.edu
(F. V.)


 

HOME

Posted: 01 November 2007