NNM Web interface on headless / unattended server

The NNM web interfaces
both still require a running copy of NNM on the server. To avoid other hoops this is best open on the map called "default". On a headless server, or one that doesn't always have an operator at the console, this can be annoying.

The solution given here uses an X server that doesn't require graphics hardware, because it doesn't actually present anything to any user, and also doesn't provide for user input. "ovw" doesn't need user input any more, and reacts correctly to kill signals, ovpause and shutdown and the like. This means it can be run attended.

The X server used in the below is Xvfb and was available in the HP-UX installation in /usr/bin/X11
There are precompiled versions available from Jeff Hunter http://www.idevelopment.info/data/Unix/General_UNIX/UNIX_General_UNIX_home.shtml

This is also available in source form from ftp.x.org and ftp.xfree86.org

The script below is intended to be run as a user level process from a cron job. It detects running ovw and X servers, and only restarts if needed. It depend on the service level required for your NNM web access, but here it is run hourly.

A potential issue arises with map updating given the map is opened read-only, and hence won't reflect topology changes. If this is an issue, then depending on your SLA for tolopogy changes, pull the PID from the output of the "ps" line and as required by time or by some flag file created by an autoaction to a OV_Node_Added

#! /usr/bin/ksh
#
# Script to run an instance of ovw for the purpose of providing
# access to web NNM (Network Presenter).
#
# Expected to be run each hour or so from a cron job.
# If there is an "ovw -ro" process running, then that is assumed to be
# sufficient.
# Otherwise, check if there is a headless X server available.
# If not start one.
# Run an instance of ovw.
#
# David Horton 16-Jan-2006
#
#
PATH=$PATH:/usr/bin/X11:/opt/OV/bin:/usr/contrib/bin/X11
# Create a directory out of the way to allow nohup.out files to
# be created without overwriting some other project.
cd /tmp
[ ! -d headless_ovw ] && mkdir headless_ovw
cd headless_ovw
umask 0
chmod +w * .
touch cron_was_here
if ps -ef | grep -v grep | grep "ovw -ro -map default" > /dev/null
then
true
else
DISPLAY=:0
export DISPLAY
if xdpyinfo > /dev/null
then
true
else
nohup Xvfb -screen 0 1280x1024x8 &
sleep 30
mv nohup.out nohup.out.Xvfb
fi
nohup ovw -ro -map default -pollXServer&
sleep 30
mv nohup.out nohup.out.ovw
chmod +w * .
fi
exit 0
#
# Probably should restart the ovw to cause the maps to be re-loaded.