#!/bin/bash
source /etc/noc.conf
if [ -z "$TITLE" ]; then
TITLE="All"
fi
LAST=-1
LINES=0
C=1
cat << EOF
Content Type: text/html
OpenNMS Comments/Forced Unmanaged for $TITLE
OpenNMS Comments/Forced Unmanaged for $TITLE
| LABEL | COMMENT | FORCED UNMANAGED |
EOF
for N in `getNodesByIPs`; do
if [ $LAST != $N ]; then
COMMENT=`sql "select comment from assets where assets.nodeid='${N}'" | \
sed -e 's/$/
/g'`
FUIP=`sql "select ipinterface.ipaddr from ipinterface \
where ipinterface.isManaged='F' and nodeid='${N}';" `
FUSRV=`sql "select ifservices.ipaddr,service.servicename from ifservices,service \
where service.serviceid=ifservices.serviceid and ifservices.status='F' \
and ifservices.nodeid='${N}';" `
if [ "$COMMENT" != '
' -o "$FUIP" != "" -o "$FUSRV" != "" ]; then
echo "| `getLabel $N` | $COMMENT | ${FUIP}$FUSRV |
"
fi
fi
LAST=$N
done
echo "
"
date
echo ""