Topics: HP Output Server

Epod Web Monitor for HP Output Server

What it does, is very simple: it creates a web page that shows an overview of the jobs which passed through HP Output Server.

What do you need to accomplish this?

  • The Event Monitor (EM) of HP Output Server, which is usually running anyway in any HP Output Server environment.
  • A subscription file, in which you register what events to react to.
  • A Description file, which formats the incoming events into HTML output and writes it to a file.
  • An HTML header file, used as an header for the webpage; this one is created automatically by the following:
  • An original HTML header file, which is used to create the HTML header file.
  • An HTML header update script, which updates the HTML header file, from the original HTML header file. It updates the date and number of succesfull jobs.
  • An EPOD update script, which updates the webpage.
  • Perl script, which is included in the HP Output Server distribution. This perl script is the (small) webserver (You can also use the Apache webserver, in case you have the WebGUI installed).
  • An EPOD clear log script, to empty the EPOD log once a week.
  • Start and stop scripts for this EPOD web monitor.
Put all of these items in a separate directory, e.g.: /appl/hpos/epod

The Subscription file

It is called epod.subs:
The Description file

Filename: epod.desc:
# epod.desc
# support file for HPOS Epod logging
# see also EPOD.SUBS for event subscriptions
# This file generates HTML coded logging and can be viewed with
# the script

# Initialize HP Output Server environment
# Change to wherever your file is.
. /appl/hpos/etc/

set itext $instance

does $instance

# all abort messages (blue)
match ..1.0.10175.*
set itext <font color=Blue>
# all error messages (red)
match ..1.0.10175.*
set itext <font color=Red>
# all warning messages (black)
match ..1.0.10175.*
set itext <font color=Black>
# all report messages (green = good)
match ..1.0.10175.
set itext <font color=Green>


does $class
match ids_alljobs
fields subjob owner msg jobid destination jobname proctime completed count rdevice profmsg
exec echo "</table> <table cellspacing=0 cellpadding=0 width=100% border=0> <TR><TD valign=top width=200> <font color=Black size=1>" `date`"</font> </td><TD valign=top align=left> <font size=1> $itext $subjob $owner $msg $jobid $destination $proctime $completed $count $rdevice $profmsg $jobname" >> /appl/hpos/epod/epod.log
Okay, so now we have a file, which listens to certain events (epod.subs), and a script (epod.desc) that formats it into HTML output and writes is to file epod.log. Now on to the header of the webpage:

The original HTML header file

It is called htmlheader:
<!-- this html header is used by HPOS epod event logging -->
<meta http-equiv="Refresh" content="30">
<title>HPOS Epod Event Monitoring</title>
<table border=0 cellpadding=3 cellspacing=0 width="100%">
<tr bgcolor=#dcdcdc>
<table border=0 cellpadding=0 cellspacing=0 width="100%">
<table border=0 cellpadding=5 cellspacing=0 width="100%">
<tr bgcolor="#dcdcdc">
<td align=left>
<b><font face=Arial color="#800080" size="+.3">
HPOS Epod Event Monitor</font>
<font face=Arial color="#800080" size=-3>
<td align=right>
<font face=Arial color="#800080" size=-3>
<font face=Arial size=-3>
This HTML header file is a fancy header. It shows information about the number of jobs succesfully processed, the current date and the creator of the page. It refreshes every 3 seconds.

You need a script to update this HTML header file with the current date and number of jobs:

HTML header update script

This is called
# replace string <!--kkkk--> in file htmlheader for the number of jobs
nrjobs=`grep -i green /appl/hpos/epod/epod.log* | wc -l | awk '{print $1}'`
totjobs2=`cat /appl/hpos/totjobs | awk '{print $1}'`
let nrjobs="$nrjobs+$totjobs2"
cat /appl/hpos/epod/ | sed "s/<!--kkkk-->/$nrjobs jobs since 28-07-03. ($now)/g" > /appl/hpos/epod/htmlheader
This script above uses a file named totjobs which is nothing more than a plain file containing the total number of jobs since last week. This file is created once a week by the Clear EPOD log script (see further down below).

Now, to put this together, we need a script that creates the webpage by putting in the header and adding a tail of the epod.log file. The next script updates it a 100 times, with pauses of 3 seconds in between and then exits:

EPOD Update script


unset result
result=`ps -ef | grep epodupd | grep -v grep | grep -v $$ | wc -l | awk '{print $1}'`
# check if i am running
if [ $result -gt 0 ]
let teller=0
while [ $teller -lt 100 ]
cat /appl/hpos/epod/htmlheader > /appl/hpos/epod/epodhtml2.log
tail -r -35 /appl/hpos/epod/epod.log >> /appl/hpos/epod/epodhtml2.log
mv /appl/hpos/epod/epodhtml2.log /appl/hpos/epod/epodhtml.log
sleep 3
let teller="$teller+1"
Now, the web page is created. We need to make sure the file epod.log doesn't fill up the complete file system, by clearing its contents and writing the number of succesful jobs to file totjobs once a week.

Clear EPOD log script


# Little script to clear the epod.log file
# base directory for this script
# number of succesfully completed files this week
complete=`grep -ci green $base/epod/epod.log | awk '{print $1}'`
# number of succesfully completed files before this week
compl=`cat $base/totjobs | head -1 | awk '{print $1}'`
# add those two
let total=0
let total="$total+$compl"
let total="$total+$complete"
# save the previous total
cp $base/totjobs $base/totjobs.old
# clear the log file
cp /dev/null $base/epod/epod.log
# write the new total to totjobs
echo $total > $base/totjobs
Put this script into your root crontab:
# Clear the epod log once a week on Sunday
0 0 * * 0 /appl/hpos/epod/ 2>/dev/null
Start & Stop scripts

To start this, run script
# script to start epod eventmonitoring
# source environment
. /appl/hpos/etc/
# kill any previous instance of epod
kill -9 $(ps -ef | grep dzl_epod | \
awk ' { print $2 } ' - ) >/dev/null 2>&1
kill -9 $(ps -ef | grep epod | \
grep | awk ' { print $2 } ' - ) >/dev/null 2>&1
# restart epod
/appl/hpos/lib/dzl_epod -s /appl/hpos/epod/epod.subs -d /appl/hpos/epod/epod.desc -Q -B > /appl/hpos/epod/epod.err 2>&1 &
cd /appl/hpos/epod
# start the webserver
perl ./ -f /appl/hpos/epod/epodhtml.log &
Make sure is also somewhere in the startup script of your HPOS environment, so it gets started as soon HPOS is started. The same goes for your stop script.

To stop the EPOD web monitor, run
# script to stop epod eventmonitoring
# source environment
. /appl/hpos/etc/
# kill any instance of epod
kill -9 $(ps -ef | grep dzl_epod | awk ' { print $2 } ' - ) >/dev/null 2>&1
kill -9 $(ps -ef | grep epod | grep | awk ' { print $2 } ' - ) >/dev/null 2>&1
The PERL is a modified file, from the Snapshot2 feature of HPOS. It listens to port 8089. You can download this PERL web server here .

Once the EPOD Web Monitor has started via, you can browse the page: http://[hostname-of-your-hpos-server]:8089

The web page should look like this:


Now, you have a GREAT way of monitoring your system! Green entries are jobs succesfully ended. Any other colors show problems occured, or queues cleaned or whatever.

For any further description of the HPOS EPOD, check out the HPOS System Administration Guide, Appendix D.

If you found this useful, here's more on the same topic(s) in our blog:

UNIX Health Check delivers software to scan Linux and AIX systems for potential issues. Run our software on your system, and receive a report in just a few minutes. UNIX Health Check is an automated check list. It will report on perfomance, capacity, stability and security issues. It will alert on configurations that can be improved per best practices, or items that should be improved per audit guidelines. A report will be generated in the format you wish, and the report includes the issues discovered and information on how to solve the issues as well.

Interested in learning more?