SunJavaSystemWebServer
Subscribe

From OpenNMS

Jump to: navigation, search


Contents

Summary

This document is intended to provide an example of how to configure OpenNMS to collect data from a Sun Java System Web Server.

There are two parts to the process, configuring both the Web Server SNMP and Net-SNMP, and configuring OpenNMS to collect Web Server specific data.

Prerequisites

This document is based on a configuration that uses both the Web Server built in SNMP feature, and Net-SNMP to proxy the SNMP calls.

I am using this configuration with Net-SNMP v5.5, OpenNMS version 1.8.5, Sun Web Server version 7, and JVM version 1.6.0_23. You may need to adapt part of the configuration in case you are using different versions.

Enabling SNMP

Web Server

You must configure the agent for a particular Web Server instance, and then enable both the SNMP master agent and SNNP sub-agent.

Please use the Web Server documentation in case you need more information on how to do this part.

Net-SNMP

Net-SNMP will serve as a proxy:

view systemview included .1.3.6.1.4.1.42.2.190.1

proxy -v 1 -c public localhost:161 .1.3.6.1.4.1.42.2.190.1

It would be a good idea to try to access SNMP data from the Web Server through Net-SNMP at this point.

OpenNMS

Copy the SUN-WEBSERVER-MIB file to your contrib/mibparser/mibs/ OpenNMS directory.

Configure data collection

Edit the datacollection-config.xml file and add:

    <resourceType name="wsInstance" label="Sun One Web Server Instances" resourceLabel="${wsInsId}">
      <persistenceSelectorStrategy class="org.opennms.netmgt.collectd.PersistAllSelectorStrategy"/>
      <storageStrategy class="org.opennms.netmgt.dao.support.IndexStorageStrategy"/>
    </resourceType>

    <resourceType name="wsProcess" label="Sun One Web Server Processes" resourceLabel="Web Server Process (index ${index})">
      <persistenceSelectorStrategy class="org.opennms.netmgt.collectd.PersistAllSelectorStrategy"/>
      <storageStrategy class="org.opennms.netmgt.dao.support.IndexStorageStrategy"/>
    </resourceType>

    <resourceType name="wsVs" label="Sun One Web Server Virtual Servers" resourceLabel="${wsPrId}">
      <persistenceSelectorStrategy class="org.opennms.netmgt.collectd.PersistAllSelectorStrategy"/>
      <storageStrategy class="org.opennms.netmgt.dao.support.IndexStorageStrategy"/>
    </resourceType>




      <!-- Sun One Web Server 7 Instance -->
      <group name="sun-web-server-instance" ifType="ignore">
        <mibObj oid=".1.3.6.1.4.1.42.2.190.1.1.1.2"  instance="wsInstance" alias="wsInsId" type="string" />
        <mibObj oid=".1.3.6.1.4.1.42.2.190.1.1.1.9"  instance="wsInstance" alias="wsInsUptime" type="TimeTicks" />
        <mibObj oid=".1.3.6.1.4.1.42.2.190.1.1.1.10" instance="wsInstance" alias="wsInsDeathCount" type="Counter32" />
        <mibObj oid=".1.3.6.1.4.1.42.2.190.1.1.1.11" instance="wsInstance" alias="wsInsRequests" type="Counter64" />
        <mibObj oid=".1.3.6.1.4.1.42.2.190.1.1.1.12" instance="wsInstance" alias="wsInsInOctets" type="Counter64" />
        <mibObj oid=".1.3.6.1.4.1.42.2.190.1.1.1.13" instance="wsInstance" alias="wsInsOutOctets" type="Counter64" />
        <mibObj oid=".1.3.6.1.4.1.42.2.190.1.1.1.14" instance="wsInstance" alias="wsInsCount2xx" type="Counter64" />
        <mibObj oid=".1.3.6.1.4.1.42.2.190.1.1.1.15" instance="wsInstance" alias="wsInsCount3xx" type="Counter64" />
        <mibObj oid=".1.3.6.1.4.1.42.2.190.1.1.1.16" instance="wsInstance" alias="wsInsCount4xx" type="Counter64" />
        <mibObj oid=".1.3.6.1.4.1.42.2.190.1.1.1.17" instance="wsInstance" alias="wsInsCount5xx" type="Counter64" />
        <mibObj oid=".1.3.6.1.4.1.42.2.190.1.1.1.18" instance="wsInstance" alias="wsInsCountOther" type="Counter64" />
        <mibObj oid=".1.3.6.1.4.1.42.2.190.1.1.1.19" instance="wsInstance" alias="wsInsCount302" type="Counter64" />
        <mibObj oid=".1.3.6.1.4.1.42.2.190.1.1.1.20" instance="wsInstance" alias="wsInsCount304" type="Counter64" />
        <mibObj oid=".1.3.6.1.4.1.42.2.190.1.1.1.21" instance="wsInstance" alias="wsInsCount400" type="Counter64" />
        <mibObj oid=".1.3.6.1.4.1.42.2.190.1.1.1.22" instance="wsInstance" alias="wsInsCount401" type="Counter64" />
        <mibObj oid=".1.3.6.1.4.1.42.2.190.1.1.1.23" instance="wsInstance" alias="wsInsCount403" type="Counter64" />
        <mibObj oid=".1.3.6.1.4.1.42.2.190.1.1.1.24" instance="wsInstance" alias="wsInsCount404" type="Counter64" />
        <mibObj oid=".1.3.6.1.4.1.42.2.190.1.1.1.30" instance="wsInstance" alias="wsInsNwInOctets" type="Gauge64" />
        <mibObj oid=".1.3.6.1.4.1.42.2.190.1.1.1.31" instance="wsInstance" alias="wsInsNwOutOctets" type="Gauge64" />
      </group>

      <!-- Sun One Web Server 7 Process -->
      <group name="sun-web-server-process" ifType="ignore">
        <mibObj oid=".1.3.6.1.4.1.42.2.190.1.2.1.2.1"  instance="wsProcess" alias="wsPrId" type="integer" />
        <mibObj oid=".1.3.6.1.4.1.42.2.190.1.2.1.3.1"  instance="wsProcess" alias="wsPrThreadCount" type="Gauge32" />
        <mibObj oid=".1.3.6.1.4.1.42.2.190.1.2.1.4.1"  instance="wsProcess" alias="wsPrThreadIdle" type="Gauge32" />
        <mibObj oid=".1.3.6.1.4.1.42.2.190.1.2.1.5.1"  instance="wsProcess" alias="wsPrConQuCount" type="Gauge32" />
        <mibObj oid=".1.3.6.1.4.1.42.2.190.1.2.1.6.1"  instance="wsProcess" alias="wsPrConQuPeak" type="Counter32" />
        <mibObj oid=".1.3.6.1.4.1.42.2.190.1.2.1.7.1"  instance="wsProcess" alias="wsPrConQuMax" type="Gauge32" />
        <mibObj oid=".1.3.6.1.4.1.42.2.190.1.2.1.8.1"  instance="wsProcess" alias="wsPrConQuTotal" type="Counter64" />
        <mibObj oid=".1.3.6.1.4.1.42.2.190.1.2.1.9.1"  instance="wsProcess" alias="wsPrConQuOverflows" type="Counter32" />
        <mibObj oid=".1.3.6.1.4.1.42.2.190.1.2.1.10.1" instance="wsProcess" alias="wsPrKeepaliveCount" type="Gauge32" />
        <mibObj oid=".1.3.6.1.4.1.42.2.190.1.2.1.11.1" instance="wsProcess" alias="wsPrKeepaliveMax" type="Gauge32" />
        <mibObj oid=".1.3.6.1.4.1.42.2.190.1.2.1.12.1" instance="wsProcess" alias="wsPrSizeVirtual" type="Counter64" />
        <mibObj oid=".1.3.6.1.4.1.42.2.190.1.2.1.13.1" instance="wsProcess" alias="wsPrSizeResident" type="Counter64" />
      </group>

      <!-- Sun One Web Server 7 Virtual Servers -->
      <group name="sun-web-server-virtualservers" ifType="ignore">
        <mibObj oid=".1.3.6.1.4.1.42.2.190.1.7.1.2"  instance="wsVs" alias="wsPrId" type="string" />
        <mibObj oid=".1.3.6.1.4.1.42.2.190.1.7.1.3"  instance="wsVs" alias="wsVsRequests" type="Counter64" />
      </group>

Don't forget to add the group names inside Net-SNMP group definition:


      <systemDef name="Net-SNMP">
        <sysoidMask>.1.3.6.1.4.1.8072.3.</sysoidMask>
        <collect>
          <!-- more lines here -->
          <includeGroup>sun-web-server-instance</includeGroup>
          <includeGroup>sun-web-server-process</includeGroup>
          <includeGroup>sun-web-server-virtualservers</includeGroup>
          <!-- more lines here -->
        </collect>
      </systemDef>

Configure Graphs

A guide to snmp-graph.properties is outside of the scope of this document, and is covered adequately elsewhere. If you’ve kept with me this far, however, here are my additions to support the new RRDs:

######
###### Sun Web Server
######

report.sunwebserver.instance.traffic.name=Bytes In/Out
report.sunwebserver.instance.traffic.columns=wsInsInOctets,wsInsOutOctets
report.sunwebserver.instance.traffic.type=wsInstance
report.sunwebserver.instance.traffic.command=--title="Octets In/Out" \
 --vertical-label="Octets per second" \
 DEF:octIn={rrd1}:wsInsInOctets:AVERAGE \
 DEF:minOctIn={rrd1}:wsInsInOctets:MIN \
 DEF:maxOctIn={rrd1}:wsInsInOctets:MAX \
 DEF:octOut={rrd2}:wsInsOutOctets:AVERAGE \
 DEF:minOctOut={rrd2}:wsInsOutOctets:MIN \
 DEF:maxOctOut={rrd2}:wsInsOutOctets:MAX \
 CDEF:octOutNeg=0,octOut,- \
 AREA:octIn#00ff00:"In " \
 GPRINT:octIn:AVERAGE:"Avg  \\: %8.2lf %s" \
 GPRINT:octIn:MIN:"Min  \\: %8.2lf %s" \
 GPRINT:octIn:MAX:"Max  \\: %8.2lf %s\\n" \
 AREA:octOutNeg#0000ff:"Out" \
 GPRINT:octOut:AVERAGE:"Avg  \\: %8.2lf %s" \
 GPRINT:octOut:MIN:"Min  \\: %8.2lf %s" \
 GPRINT:octOut:MAX:"Max  \\: %8.2lf %s\\n"

# This is the most interesting graph
report.sunwebserver.instance.httpcodes.name=HTTP status codes
report.sunwebserver.instance.httpcodes.columns=wsInsCount2xx,wsInsCount3xx,wsInsCount4xx,wsInsCount5xx
report.sunwebserver.instance.httpcodes.type=wsInstance
report.sunwebserver.instance.httpcodes.width=565
report.sunwebserver.instance.httpcodes.height=200
report.sunwebserver.instance.httpcodes.command=--title="HTTP status codes" \
 --width 565 \
 --height 200 \
 --vertical-label="Requests" \
 DEF:wsInsCount2xx={rrd1}:wsInsCount2xx:AVERAGE \
 DEF:minWsInsCount2xx={rrd1}:wsInsCount2xx:MIN \
 DEF:maxWsInsCount2xx={rrd1}:wsInsCount2xx:MAX \
 DEF:wsInsCount3xx={rrd2}:wsInsCount3xx:AVERAGE \
 DEF:minWsInsCount3xx={rrd2}:wsInsCount3xx:MIN \
 DEF:maxWsInsCount3xx={rrd2}:wsInsCount3xx:MAX \
 DEF:wsInsCount4xx={rrd3}:wsInsCount4xx:AVERAGE \
 DEF:minWsInsCount4xx={rrd3}:wsInsCount4xx:MIN \
 DEF:maxWsInsCount4xx={rrd3}:wsInsCount4xx:MAX \
 DEF:wsInsCount5xx={rrd4}:wsInsCount5xx:AVERAGE \
 DEF:minWsInsCount5xx={rrd4}:wsInsCount5xx:MIN \
 DEF:maxWsInsCount5xx={rrd4}:wsInsCount5xx:MAX \
 AREA:wsInsCount2xx#00ff00:"Success (2xx)" \
 GPRINT:wsInsCount2xx:AVERAGE:" Avg  \\: %8.2lf %s" \
 GPRINT:wsInsCount2xx:MIN:"Min  \\: %8.2lf %s" \
 GPRINT:wsInsCount2xx:MAX:"Max  \\: %8.2lf %s\\n" \
 STACK:wsInsCount3xx#0000ff:"Redirection (3xx)" \
 GPRINT:wsInsCount3xx:AVERAGE:" Avg  \\: %8.2lf %s" \
 GPRINT:wsInsCount3xx:MIN:"Min  \\: %8.2lf %s" \
 GPRINT:wsInsCount3xx:MAX:"Max  \\: %8.2lf %s\\n" \
 STACK:wsInsCount4xx#ff7f00:"Client error (4xx)" \
 GPRINT:wsInsCount4xx:AVERAGE:" Avg  \\: %8.2lf %s" \
 GPRINT:wsInsCount4xx:MIN:"Min  \\: %8.2lf %s" \
 GPRINT:wsInsCount4xx:MAX:"Max  \\: %8.2lf %s\\n" \
 STACK:wsInsCount5xx#ff0000:"Server error (5xx)" \
 GPRINT:wsInsCount5xx:AVERAGE:" Avg  \\: %8.2lf %s" \
 GPRINT:wsInsCount5xx:MIN:"Min  \\: %8.2lf %s" \
 GPRINT:wsInsCount5xx:MAX:"Max  \\: %8.2lf %s\\n"

report.sunwebserver.instance.4xx.name=404 HTTP Errors
report.sunwebserver.instance.4xx.columns=wsInsCount404
report.sunwebserver.instance.4xx.type=wsInstance
report.sunwebserver.instance.4xx.command=--title="404 HTTP Errors" \
 --vertical-label Errors \
 --lower-limit 0 --upper-limit 100 --rigid \
 DEF:404errors={rrd1}:wsInsCount404:AVERAGE \
 DEF:min404errors={rrd1}:wsInsCount404:MIN \
 DEF:max404errors={rrd1}:wsInsCount404:MAX \
 LINE2:404errors#ff7f00:"Number of 404 errors" \
 GPRINT:404errors:AVERAGE:" Avg  \\: %8.2lf %s" \
 GPRINT:404errors:MIN:"Min  \\: %8.2lf %s" \
 GPRINT:404errors:MAX:"Max  \\: %8.2lf %s\\n"

report.sunwebserver.instance.httperrorcodes.name=HTTP error codes
report.sunwebserver.instance.httperrorcodes.columns=wsInsCount400,wsInsCount401,wsInsCount403,wsInsCount404
report.sunwebserver.instance.httperrorcodes.type=wsInstance
report.sunwebserver.instance.httperrorcodes.width=565
report.sunwebserver.instance.httperrorcodes.height=200
report.sunwebserver.instance.httperrorcodes.command=--title="HTTP 4xx error codes" \
 --width 565 \
 --height 200 \
 --vertical-label="Requests" \
 DEF:wsInsCount2xx={rrd1}:wsInsCount400:AVERAGE \
 DEF:minWsInsCount2xx={rrd1}:wsInsCount400:MIN \
 DEF:maxWsInsCount2xx={rrd1}:wsInsCount400:MAX \
 DEF:wsInsCount3xx={rrd2}:wsInsCount401:AVERAGE \
 DEF:minWsInsCount3xx={rrd2}:wsInsCount401:MIN \
 DEF:maxWsInsCount3xx={rrd2}:wsInsCount401:MAX \
 DEF:wsInsCount4xx={rrd3}:wsInsCount403:AVERAGE \
 DEF:minWsInsCount4xx={rrd3}:wsInsCount403:MIN \
 DEF:maxWsInsCount4xx={rrd3}:wsInsCount403:MAX \
 DEF:wsInsCount5xx={rrd4}:wsInsCount404:AVERAGE \
 DEF:minWsInsCount5xx={rrd4}:wsInsCount404:MIN \
 DEF:maxWsInsCount5xx={rrd4}:wsInsCount404:MAX \
 AREA:wsInsCount2xx#800080:"Bad request (400)" \
 GPRINT:wsInsCount2xx:AVERAGE:" Avg  \\: %8.2lf %s" \
 GPRINT:wsInsCount2xx:MIN:"Min  \\: %8.2lf %s" \
 GPRINT:wsInsCount2xx:MAX:"Max  \\: %8.2lf %s\\n" \
 STACK:wsInsCount3xx#ff00ff:"Unauthorized (401)" \
 GPRINT:wsInsCount3xx:AVERAGE:" Avg  \\: %8.2lf %s" \
 GPRINT:wsInsCount3xx:MIN:"Min  \\: %8.2lf %s" \
 GPRINT:wsInsCount3xx:MAX:"Max  \\: %8.2lf %s\\n" \
 STACK:wsInsCount4xx#ff0000:"Forbidden (403)" \
 GPRINT:wsInsCount4xx:AVERAGE:" Avg  \\: %8.2lf %s" \
 GPRINT:wsInsCount4xx:MIN:"Min  \\: %8.2lf %s" \
 GPRINT:wsInsCount4xx:MAX:"Max  \\: %8.2lf %s\\n" \
 STACK:wsInsCount5xx#ff7f00:"Not Found (404)" \
 GPRINT:wsInsCount5xx:AVERAGE:" Avg  \\: %8.2lf %s" \
 GPRINT:wsInsCount5xx:MIN:"Min  \\: %8.2lf %s" \
 GPRINT:wsInsCount5xx:MAX:"Max  \\: %8.2lf %s\\n"

report.sunwebserver.process.keepalive.name=Keep Alive
report.sunwebserver.process.keepalive.columns=wsPrKeepaliveCount,wsPrKeepaliveMax
report.sunwebserver.process.keepalive.type=wsProcess
report.sunwebserver.process.keepalive.command=--title="Keep Alive" \
 DEF:kacount={rrd1}:wsPrKeepaliveCount:AVERAGE \
 DEF:minkacount={rrd1}:wsPrKeepaliveCount:MIN \
 DEF:maxkacount={rrd1}:wsPrKeepaliveCount:MAX \
 DEF:kamax={rrd2}:wsPrKeepaliveMax:AVERAGE \
 DEF:minkamax={rrd2}:wsPrKeepaliveMax:MIN \
 DEF:maxkamax={rrd2}:wsPrKeepaliveMax:MAX \
 LINE2:kacount#ff0000:"Count\\:" \
 GPRINT:kacount:AVERAGE:"Avg  \\: %8.2lf %s" \
 GPRINT:kacount:MIN:"Min  \\: %8.2lf %s" \
 GPRINT:kacount:MAX:"Max  \\: %8.2lf %s\n" \
 LINE2:kamax#00ff00:"Max\\:" \
 GPRINT:kamax:AVERAGE:"Avg  \\: %8.2lf %s" \
 GPRINT:kamax:MIN:"Min  \\: %8.2lf %s" \
 GPRINT:kamax:MAX:"Max  \\: %8.2lf %s\n" \


report.sunwebserver.process.threads.name=Threads
report.sunwebserver.process.threads.columns=wsPrThreadCount,wsPrThreadIdle
report.sunwebserver.process.threads.type=wsProcess
report.sunwebserver.process.threads.command=--title="Threads" \
 --lower-limit 0 \
 DEF:trcount={rrd1}:wsPrThreadCount:AVERAGE \
 DEF:mintrcount={rrd1}:wsPrThreadCount:MIN \
 DEF:maxtrcount={rrd1}:wsPrThreadCount:MAX \
 DEF:tridle={rrd2}:wsPrThreadIdle:AVERAGE \
 DEF:mintridle={rrd2}:wsPrThreadIdle:MIN \
 DEF:maxtridle={rrd2}:wsPrThreadIdle:MAX \
 LINE2:trcount#ff0000:"Count\\:" \
 GPRINT:trcount:AVERAGE:"Avg  \\: %8.2lf %s" \
 GPRINT:trcount:MIN:"Min  \\: %8.2lf %s" \
 GPRINT:trcount:MAX:"Max  \\: %8.2lf %s\n" \
 LINE2:tridle#00ff00:"Idle\\:" \
 GPRINT:tridle:AVERAGE:"Avg  \\: %8.2lf %s" \
 GPRINT:tridle:MIN:"Min  \\: %8.2lf %s" \
 GPRINT:tridle:MAX:"Max  \\: %8.2lf %s\n" \

report.sunwebserver.process.connqueue.name=Connection Queue
report.sunwebserver.process.connqueue.columns=wsPrConQuCount,wsPrConQuMax
report.sunwebserver.process.connqueue.type=wsProcess
report.sunwebserver.process.connqueue.command=--title="Connection Queue" \
 --lower-limit 0 \
 DEF:count={rrd1}:wsPrConQuCount:AVERAGE \
 DEF:mincount={rrd1}:wsPrConQuCount:MIN \
 DEF:maxcount={rrd1}:wsPrConQuCount:MAX \
 DEF:size={rrd2}:wsPrConQuMax:AVERAGE \
 DEF:minsize={rrd2}:wsPrConQuMax:MIN \
 DEF:maxsize={rrd2}:wsPrConQuMax:MAX \
 LINE2:count#ff0000:"Count\\:" \
 GPRINT:count:AVERAGE:"Avg  \\: %8.2lf %s" \
 GPRINT:count:MIN:"Min  \\: %8.2lf %s" \
 GPRINT:count:MAX:"Max  \\: %8.2lf %s\n" \
 LINE2:size#00ff00:"Size\\:" \
 GPRINT:size:AVERAGE:"Avg  \\: %8.2lf %s" \
 GPRINT:size:MIN:"Min  \\: %8.2lf %s" \
 GPRINT:size:MAX:"Max  \\: %8.2lf %s\n" \

report.sunwebserver.virtualservers.name=Requests
report.sunwebserver.virtualservers.columns=wsVsRequests
report.sunwebserver.virtualservers.type=wsVs
report.sunwebserver.virtualservers.command=--title="Requests" \
 --upper-limit 200 --rigid \
 DEF:requests={rrd1}:wsVsRequests:AVERAGE \
 DEF:minrequests={rrd1}:wsVsRequests:MIN \
 DEF:maxrequests={rrd1}:wsVsRequests:MAX \
 AREA:requests#0000ff:"Used\\:" \
 GPRINT:requests:AVERAGE:"Avg  \\: %8.2lf %s" \
 GPRINT:requests:MIN:"Min  \\: %8.2lf %s" \
 GPRINT:requests:MAX:"Max  \\: %8.2lf %s\n" \

Add reports to the list of reports at the top of the file

Add the list bellow to your "reports=" variable at the beginning of snmp-graph.properties:

sunwebserver.instance.nwtraffic, \
sunwebserver.instance.httpcodes, \
sunwebserver.instance.4xx, \
sunwebserver.instance.5xx, \
sunwebserver.instance.httperrorcodes, \
sunwebserver.process.keepalive, \
sunwebserver.process.connqueue, \
sunwebserver.process.threads, \
sunwebserver.virtualservers, \

Gallery

Since I am using OpenNMS in Solaris 10, the fonts inside the graph don't look as good as the ones generated by OpenNMS running under linux, but the graph looks pretty nice and it's been very useful.

SunOneWebServer7HTTPcodes.png