1/30/2018 - 10:23 AM

OpenNMS - Notes

OpenNMS - Notes

Configuration Tester

bin/config-tester -av 

Testing poller-configuration.xml ... 14:15:43.819 [Main] WARN  org.opennms.netmgt.config.PollerConfigManager - Unable to load monitor for service: WSMAN, class-name: org.opennms.protocols.dhcp.monitor.WsmanMonitor: org.opennms.protocols.dhcp.monitor.WsmanMonitor

It still doesn't support all config files, but should be a great help. Just run it (even when OpenNMS is running) before restarting OpenNMS.

Karaf Shell commands are made available to help administer and diagnose issues related to performance data collection.

ssh -p 8101 admin@localhost

List all of the available collectors:

Invoke the SnmpCollector against interface on NODES:n1.
collection:collect -n NODES:n1 org.opennms.netmgt.collectd.SnmpCollector

OpenNMS 101 - Module 2: Getting Started

OpenNMS will two type of files.
1. XML files
2. Properties files

/opt/opennms/bin = OpenNMS binary files
/opt/opennms/etc = Configiration files
/opt/opennms/jetty-webapps = Web Server
/opt/opennms/lib = Compiled libraries
/opt/opennms/share = Reports and RRD data
/opt/opennms/logs = Log filles

OpenNMS101 - Module 2: Events
- OpenNMS is event driven
- Key process is called "eventd (pub-sub bus)"
- Listens on port 5817
- deemon config file : enentd-configuration.xml
- events config: enentconf.xml
- send-event.pl to send events 

Event substitutions

opennms]# bin/send-event.pl -h
Usage: bin/send-event.pl <UEI> [host] [options]

         --severity, -x    the severity of the event (numeric or name)
                           1 = Indeterminate
                           2 = Cleared (unimplemented at this time)
                           3 = Normal
                           4 = Warning
                           5 = Minor
                           6 = Major
                           7 = Critical

[root@opennms29 opennms]# bin/send-event.pl uei.foobar
[root@opennms29 opennms]# bin/send-event.pl -x 7 uei.foobar
bin/send-event.pl  uei.opennms.org/class/happiness
$OPENNMS_HOME/bin/send-event.pl -p 'daemonName Eventd' uei.opennms.org/internal/reloadDaemonConfig
bin/send-event.pl  uei.opennms.org/class/happiness

OpenNMS 101 - Module 4-1: Notifications
Special Values:	

Can be used in both the text message and email subject:
%noticeid% = Notification ID number	%time% = Time sent	%severity% = Event severity
%nodelabel% = May be IP address or empty	%interface% = IP address, may be empty	%service% = Service name, may be empty
%eventid% = Event ID, may be empty	%parm[a_parm_name]% = Value of a named event parameter	%parm[#N]% = Value of the event parameter at index N
%ifalias% = SNMP ifAlias of affected interface	%interfaceresolve% = Reverse DNS name of interface IP address

config file location: /opt/opennms/etc/javamail-configuration.properties
Notification using Gmail

OpenNMS 101 - Module 4-2: Notice Commands
/usr/bin/logger -p local0.warning -t oepnnms "whatever the numeric message is"

OpenNMS 101 - Module 5: Alarms
Critical (7)
This event means numerous devices on the network are affected by the event. Everyone who can should stop what they are doing and focus on fixing the problem.
Color: Purple : #C00
Major	(6)
A device is completely down or in danger of going down. Attention needs to be paid to this problem immediately.
Color: Red : #F30
Minor	(5)
A part of a device (a service, and interface, a power supply, etc.) has stopped functioning. The device needs attention.
Color: Orange : #F90
Warning (4)
An event has occurred that may require action. This severity can also be used to indicate a condition that should be noted (logged) but does not require direct action.
Color: yellow : #FC0
Normal (3)
Informational message. No action required.
Color: Dark green : #360
Cleared (2)
This severity is reserved for use in Alarms to indicate that an alarm describes a self-clearing error condition has been corrected and service is restored. This severity should never be used in event definitions. Please use "Normal" severity for events that clear an alarm.
Color: Grey : #EEE
Indeterminate	(1)
No Severity could be associated with this event.
Color: Light green : #990

OpenNMS 101 - Module 6: SNMP Review

MIB - Management Information Base (MIB)
RFC - Remote functional call

MIB data structure written in Abstract Syntax Notation (ASN.1)

Type of data objects
- Integer
- String
- Counter*
- Gauge*
- TimeTicks (hundredths of a secounds)

snmpwalk -v2c -c public sysdescr
snmpwalk -v2c -c public system

SNMPv1 : Five Commands

- GetRequest
- GetResponce
- GetNext Request
- SetRequest
- Trap

v1 problems:
** Security
** UDP connectionless
** Limited to 32-bit Counters

SNMPv2: Result

New data types:
- Integer32
- Counter32
- Gauge32
- Counter64

SNMPv2 Commands
- GetBulkRequest (large amount of data)
- InformRequest (manager to manager)

SNMPv3 is SNMPv2c with Security
can encypt:
- Authentication
- Payload
- Both
- Neither

# First, map the community name "public" into a "security name"
# sec.name source community
com2sec notConfigUser default public
com2sec onmsUser default YrUsonoZ
# Second, map the security name into a group name:
# groupName securityModel securityName
group notConfigGroup v1 notConfigUser
group notConfigGroup v2c notConfigUser
group onmsGroup v1 onmsUser
group onmsGroup v2c onmsUser
# Third, create a view for us to let the group have rights to:
# Make at least snmpwalk -v 1 localhost -c public system fast again.
# name incl/excl subtree mask(optional)
view systemview included .
view systemview included .
view allview included .1
# Finally, grant the group read-only access to the systemview view.
# group context sec.model sec.level prefix read write notif
access notConfigGroup "" any noauth exact systemview none none
access onmsGroup "" any noauth exact allview none none

# It is also possible to set the sysContact and sysLocation # system variables
through the snmpd.conf file:
syslocation Classroom, Raytheon, 22110 Pacific Blvd., Sterling,
 Virgina, 20166, United States, North America, Earth
syscontact Tarus Balog <tarus@opennms.com>
# Destination for traps
# Disks
disk /
disk /boot
disk /vagrant

OpenNMS 101 - Module 7 : SNMP Traps

 snmptrap -v 1 -c public  . localhost 6 1 ' '  . s 'They be bored'
 snmptrap -v 1 -c public  . localhost 6 2 ' '  . s 'They have Pizza!'
Other Event Sources
● Using send-event.pl or other methods to talk directly to port 5817
● Convert SNMP traps to events via trapd
● Convert Syslogs to events via syslogd
● Convert TL/1 messages via tl1d
OpenNMS 101 - Module 8 : Service Assurance
# snmpwalk -v2c -c public localhost .
# snmpwalk -v2c -c public -On localhost .
O - (captital O, Option)
n - Numeric


~]# cat /tmp/classmonitor.sh 
#!/usr/bin/env bash
echo ok

~]# snmpwalk -v2c -c public -On localhost .
. = INTEGER: 1
. = STRING: /tmp/classmonitor.sh
. = STRING: 
. = STRING: 
. = INTEGER: 5
. = INTEGER: exec(1)
. = INTEGER: run-on-read(1)
. = INTEGER: permanent(4)
. = INTEGER: active(1)
. = STRING: ok
. = STRING: ok
. = INTEGER: 1
. = INTEGER: 0
. = STRING: ok

OpenNMS 101 - Module 10 : Passive Status Keeper

event tranlator

conver one UEI enent to another

config file translator-configuration.xml

OpenNMS 101 - Module 11 : DataCollection
RRD Configuration consists of, how wide is the bucket in secounds



- cf is the consolidataion function which is one of AVERAGE,MIN,MAX,LAST
- xff or x-files factor is the percentage (50%) of vaild samples required for the consolidation
- step: how many steps in the RRA
- rows: how manu rows in the RRA
<rrd step="300">

- step size of 300 secounds or five minutes
- Store the avereage valure of ine step 2016 times (12 samples/hour * 24 hours/days * 7 days = 2016 samples)
- Store the avereage value of 12 steps ( 1 hours ) 1488 times (1 sample / 1 hour * 24 hours/days * 62 days = 1488)
- Store the avereage, max and min values of 288 steps (1day) for 366 days

rrdtool dump loadavg15.rrd

- .rrd files are stored in /opt/opennms/share/rrd
- response time values are stored under response by IP address
- All other data is stored in snmp by nordeid (althought you can configure it for foreign source:foreign ID)

Responce time data == we are getting latecy from those files
*.meta files used for near real time graph


command.prefix = /usr/bin/rrdtool graph - --imgformat PNG --color CANVAS#000000 --font DEDAULT:7 --font TITLE:10 --start {startTime} --end {endTIme}
command.prefix = /usr/bin/rrdtool graph - --imgformat PNG --font DEDAULT:7 --font TITLE:10 --start {startTime} --end {endTIme}

OpenNMS 101 - Module 12 : Thresholds
Description: An optional description for the threshold, to help identify what is their purpose.

  - high: Triggers when the value of the data source equals or exceeds the "value", and is re-armed when it drops below the "re-arm" value.
  - low: Triggers when the value of the data source equals or drops to or below the "value", and is re-armed when it equals or exceeds the "re-arm" value.
  - relativeChange: Triggers when the change in data source value from one collection to the next is greater than or equal to "value" percent. Re-arm and trigger are not used.
  - absoluteChange: Triggers when the value changes by the specified amount or greater. Re-arm and trigger are not used.
  - rearmingAbsoluteChange: Like absoluteChange, Triggers when the value changes by the specified amount or greater. However, the "trigger" is used to re-arm the event after so many iterations with an unchanged delta. Re-arm is not used.

Expression: A mathematical expression involving datasource names which will be evaluated and compared to the threshold values

Data source type: "node" for node-level data items, "if" for interface-level items, or any Generic Resource Type defined on datacollection-config.xml. Node-level will ignore filter configuration.
Datasource label: The name of the collected "string" type data item to use as a label when reporting this threshold

	Value: Use depends on the type of threshold
	Re-arm: Use depends on the type of threshold; it is unused/ignored for relativeChange thresholds
	Trigger: The number of times the threshold must be "exceeded" in a row before the threshold will be triggered. Not used for relativeChange thresholds.
	Triggered UEI: A custom UEI to send into the events system when this threshold is triggered. If left blank, it defaults to the standard thresholds UEIs.
	Rearmed UEI: A custom UEI to send into the events system when this threshold is re-armed. If left blank, it defaults to the standard thresholds UEIs.
	Example UEIs: A typical UEI is of the format "uei.opennms.org/<category>/<name>". It is recommended that when creating custom UEIs for thresholds,
	you use a one-word version of your company name as the category to avoid name conflicts. The "name" portion is up to you.
	Filter Operator: Define the logical function that will be applied over the thresholds filters to determinate if the threshold will be applied or not.
	Filters: Only apply for interfaces and Generic Resources. They are applied in order.
	  operator=OR: if the resource match any of them, the threshold will be processed.
	  operator=AND: the resource must match all the filters.

OpenNMS 102 - 2 - MIB Compiler
snmp mainly we are collecting two things in OpenNMS
1. Getting Events (snmp-traps)
2. Collecting snmp data

* mib files has events provided by ventors or manufatures
* It's a text file. writtent in ASN.1 ( Abstract Syntax Notation One )

two type of events written in mib file

Karaf related files location = /opt/opennms/data 

net-snmp mibs location = /usr/share/snmp/mibs 

OpenNMS 102 - 2 - Maps and Automations

OpenNMS using - Google Geo Encoder

Important attributes to nodes to shows the maps:-
1. address1
2. city
3. state
4. zip


    <automation name="updateAddress950Windy" interval="30000" active="true" 
                action-event="sendNodeUpdatedEvent" />

    <trigger name="selectNullAddress950Windy" operator="&gt;=" row-count="1" >
        SELECT nodeId AS _nodeid,
	FROM assets
	AND longitude IS NULL
	AND nodeid
	IN (SELECT nodeif
	FROM ipinterface
	WHERE issnmpprimary = 'P'
	AND snmpinterfaceid IS NOT NULL
	AND iplike(ipaddr, '172.20.1.*''))
	OR nodeid
	IN (SELECT nodeid
	FROM ipinterface
	WHER issnmpprimary = 'N'
	AND snmpinterfaceid IS NULL
	AND iplike(ipaddr, '172.20.1.*'))
    <action name="updateAddress950Windy" >
	UPDATE assets
	SET address="950 Windy Road",
	WHERE nodeid = ${_nodeid}

    <action-event name="sendNodeUpdatedEvent" for-each-result="true" >
      <assignment type="field" name="uei" value="uei.opennms.org/nodes/nodeUpdated" />
      <assignment type="field" name="nodeid" value="${_nodeid}" />
$OPENNMS_HOME/bin/send-event.pl -p 'daemonName Vacuumd' uei.opennms.org/internal/reloadDaemonConfig
$OPENNMS_HOME/bin/send-event.pl -p 'daemonName Eventd' uei.opennms.org/internal/reloadDaemonConfig

find Daemons
opennms -v status