Using OpenNMS to monitor SNMP, can't see MIB data - snmp

I have a MIB with oids and events. The device the MIB relates to is online. OpenNMS sees and gathers information about the interfaces on the appliance, as well as the linux variant it is running.
but it doesn't see the other oids (or I can't find/chart them).
The gui reports Polling Status (Managed) and Package (uti_p). The uti_p package is
<package name="uti_p">
<filter>IPADDR != '0.0.0.0'</filter>
<include-range begin="10.19.0.200" end="10.19.0.210" />
<rrd step="300">
<rra>RRA:AVERAGE:0.5:1:2016</rra>
<rra>RRA:AVERAGE:0.5:12:1488</rra>
<rra>RRA:AVERAGE:0.5:288:366</rra>
<rra>RRA:MAX:0.5:288:366</rra>
<rra>RRA:MIN:0.5:288:366</rra>
</rrd>
<service name="ICMP" interval="300000" user-defined="false" status="on">
<parameter key="retry" value="2" />
<parameter key="timeout" value="3000" />
<parameter key="rrd-repository" value="/var/lib/opennms/rrd/response" />
<parameter key="rrd-base-name" value="icmp" />
<parameter key="ds-name" value="icmp" />
</service>
<service name="SNMP" interval="300000" user-defined="false" status="on">
<parameter key="retry" value="2"/>
<parameter key="timeout" value="3000"/>
<parameter key="port" value="161"/>
<parameter key="oid" value=".1.3.6.1.4.1.nnnn"/>
</service>
<downtime interval="30000" begin="0" end="300000" />
<downtime interval="300000" begin="300000" end="43200000" />
<downtime interval="600000" begin="43200000" end="432000000" />
<downtime begin="432000000" delete="true" />
</package>
I have a collectd-configuration
<package name="uti_p">
<filter>IPADDR != '0.0.0.0'</filter>
<include-range begin="10.19.0.200" end="10.19.0.210"/>
<service name="SNMP" interval="30000" user-defined="false" status="on">
<parameter key="collection" value="HsmLan"/>
<parameter key="port" value="161"/>
<parameter key="retry" value="3"/>
<parameter key="timeout" value="3000"/>
<parameter key="thresholding-enabled" value="true"/>
</service>
</package>
The .../rrd/snmp/{node} directory does not show any collection of data for the various oids that I am looking for.
In response to comments:
$ snmpwalk -v 2c -c FIPS14023 10.19.0.204 iso.3.6.1.4.1.nnnn
...
iso.3.6.1.4.1.nnnn.1.1.10.0 = INTEGER: 29
iso.3.6.1.4.1.nnnn.1.1.11.0 = STRING: "29.0"
...
i.e., it returns the expected data from the MIB.
The Community set in OpenNMS is FIPS14023, and the automatic discovery process finds the node.
Node Hsm.204
Interface 10.19.0.204
Polling Status Managed
Polling Package uti_p
Monitor Class org.opennms.netmgt.poller.monitors.SnmpMonitor
Service Parameters
oid .1.3.6.1.4.1.nnnn
The Requisition name for the class of appliance is correct.
I just can find where the above String "29.0" is supposed to appear. As I understand it, the data should be collected into RRD db files, but the node Database IDs never show up in the /etc/opennms/rrdsnmp directory.
riw#riw-ubuntu-vbox:/etc/opennms/rrdsnmp$ ls
riw#riw-ubuntu-vbox:/etc/opennms/rrdsnmp$
Thank you!

I would debug the SNMP access as the following with assuming you have SNMP v2 setup:
Test access to SNMP agent from your OpenNMS server with snmpwalk -v 2c -c
OpenNMS associates SNMP community strings with the IP address. You can verify this in the Web UI in "Admin -> Configure OpenNMS -> Configure OpenNMS Community Names by IP Address" and use the "Lookup" field. It will show you which SNMP community is configured for your device and fix this if necessary.
Go to the node page and rescan the server and see if the "SNMP Attributes" fields with IP and physical interfaces get filled.
If Step 1 does not give you the full SNMP tree you have to fix your surrounding configuration, IP tables or SNMP agent configuration for views and community.

Is there a reason you are defining a different collection set "HsmLan" over the default collection for SNMP in collectd?
Be sure to include the collection service at the bottom of collectd-configuration.xml for HsmLan, ala:
<collector service="HsmLan" class-name="org.opennms.netmgt.collectd.SnmpCollector"/>
If there is, you need to define this "snmp-collection" in datacollection-config.xml and include collections via the tag which references collections named in xml files (that have OIDs, etc) in etc/datacollection/
The poller-configuration.xml you listed at the top has no bearing on data collection. It is for service polling.

Related

HTTP Service is not getting discovered in OpenNms for tomcat8.5 without SendResonPharse

HttpMonitor Config was working fine with tomcat7 and http service was getting detected however as we have updated to tomcat 8.5 http service is not getting discovered unless we set connector properties as sendReasonPhrase=true, the difference in the curl response is like below in compare to tomcat7 and tomcat 8.5 (withoutsend Reson Phrase parameter set)
tomcat7 gives ok in its header and tomcat8.5 does not.
however option for sendreson phase will be deprecated and removed from tomcat9 and even this option will not be available (https://tomcat.apache.org/tomcat-8.5-doc/config/http.html)
I am not sure why httpMonitor in openNms is not able to detect the http service even the snmpwalk output see port 80 available (both with and without send reason phrase)
in poller-configuration.xml looks like below for http
<service name="HTTP" interval="300000" user-defined="false" status="on">
<parameter key="retry" value="1"/>
<parameter key="timeout" value="3000"/>
<parameter key="port" value="80"/>
<parameter key="url" value="/"/>
<parameter key="rrd-repository" value="/var/lib/opennms/rrd/response"/>
<parameter key="rrd-base-name" value="http"/>
<parameter key="ds-name" value="http"/>
</service>
even we tried setting
<parameter key="response-text" value="~\bOK\b"/>
and
<parameter key="response" value="200"/>
however it did not help, i guess above parameter play its role once service got discovered however the problem here the service is not getting discovered (unless SendReson pharse is turn on ) it will only detect http service in tomcat 8.5 if we have sendreson phase turn on in connector definition inside server.xml
Kindly help to understand this behaviour here and possible solution for this without any change on client side.
openNms version info:

OpenNMS implement script to get status of any service

I am trying to implement script(sh, py..) that will get mi True(Up) of False(Down) status if my installed app on nodes is up-to-date.
Before that, i tried to implement simple script found on net (https://wiki.opennms.org/wiki/SystemExecuteMonitor) just to see if script works.
OpenNMS is installed on Windows 10.
This is what i did so far:
In poller-configuration.xml
`<service name="Test" interval="300000" user-defined="false" status="on">
<parameter key="script" value="/etc/scripts/test.sh"/>
<parameter key="banner" value="OK"/>
<parameter key="retry" value="3"/>
<parameter key="timeout" value="3000"/>
<parameter key="rrd-repository" value="/opt/opennms/share/rrd/response"/>
<parameter key="ds-name" value="test"/>
</service>`
AND
`<monitor service="Test" class-name="org.opennms.netmgt.poller.monitors.SystemExecuteMonitor"/>`
In default-foreign-source.xml
`<detector name="Test" class="org.opennms.netmgt.poller.monitors.SystemExecuteMonitor">
<parameter key="script" value="/etc/scripts/test.sh"/>
<parameter key="banner" value="OK"/>
<parameter key="retry" value="3"/>
<parameter key="timeout" value="3000"/>
<parameter key="rrd-repository" value="/opt/opennms/share/rrd/response"/>
<parameter key="ds-name" value="test"/>
</detector>`
And this is what i am missing: snmpd.conf
I don't have that file in OpenNMS, so my question is where should i call that script to be executed and do i miss anything else to get this working?
Thnx!
In the meantime, i've implemented groovy script like this:
In poller-configuration.xml
<service name="MinGroovy" interval="300000" user-defined="true" status="on">
<parameter key="file-name" value="C:/OpenNMS/etc/scripts/MinimalGroovy.groovy"/>
<parameter key="bsf-engine" value="org.codehaus.groovy.bsf.GroovyEngine"/>
<parameter key="rrd-repository" value="/opt/opennms/share/rrd/response" />
</service>
AND
<monitor service="MinGroovy" class-name="org.opennms.netmgt.poller.monitors.BSFMonitor"/>
this is my groovy script:
#!/usr/bin/env groovy\
bsf_monitor.log("ERROR", "Starting MinimalGroovy.groovy", null);
filePath = "//netpath/output/temp.txt"
file = new File(filePath)
if (file.exists()){
return "OK";
}else{
return "NOK";
}
In groovy-starter.conf i added:
enter #lib for opennms
load ${opennms.home}/lib/*.jar
If i run script in groovy console, it works OK!
And this is the error i get in poller.log in OpenNMS:
ERROR [pool-9-thread-27] o.o.n.p.m.BSFMonitor: Starting MinimalGroovy.groovy
Any help?
Your service definition in the poller-configuration.xml looks suspicious to me:
<service name="MinGroovy" interval="300000" user-defined="true" status="on">
<parameter key="file-name" value="C:/OpenNMS/etc/scripts/MinimalGroovy.groovy"/>
<parameter key="bsf-engine" value="org.codehaus.groovy.bsf.GroovyEngine"/>
<parameter key="rrd-repository" value="/opt/opennms/share/rrd/response" />
</service>
The file name is located on "C:/..." whereas your rrd-repository is in "/opt/opennms". Do you have installed OpenNMS on Windows or Linux? The path to your groovy script in the service definition is from the OpenNMS process perspective.

JGroups configuration for internet

I have successfully got JGroups working on the local network across via different machines using TCP, I can't use multicast. I need the ability for two nodes to communicate over the internet. Changing the addresses to the public ones doesn't seem to work and requires additional configuration.
I've looked at http://www.jgroups.org/manual-3.x/html/protlist.html
and set external_addr but maybe there is more to set.
How to you set it up to communicate via public addresses?
Configuration:
<config xmlns="urn:org:jgroups"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/jgroups-4.0.xsd">
<TCP bind_port="7800"
recv_buf_size="${tcp.recv_buf_size:130k}"
send_buf_size="${tcp.send_buf_size:130k}"
max_bundle_size="64K"
sock_conn_timeout="300"
client_bind_addr="GLOBAL"
thread_pool.min_threads="0"
thread_pool.max_threads="20"
thread_pool.keep_alive_time="30000"/>
<TCPPING async_discovery="true"
initial_hosts="${jgroups.tcpping.initial_hosts:52.211.80.63[7801]}"
port_range="2"/>
<MERGE3 min_interval="10000"
max_interval="30000"/>
<FD_SOCK/>
<FD timeout="3000" max_tries="3" />
<VERIFY_SUSPECT timeout="1500" />
<BARRIER />
<pbcast.NAKACK2 use_mcast_xmit="false"
discard_delivered_msgs="true"/>
<UNICAST3 />
<pbcast.STABLE desired_avg_gossip="50000"
max_bytes="4M"/>
<pbcast.GMS print_local_addr="true" join_timeout="2000"
view_bundling="true"/>
<MFC max_credits="2M"
min_threshold="0.4"/>
<FRAG2 frag_size="60K" />
<!--RSVP resend_interval="2000" timeout="10000"/-->
<pbcast.STATE_TRANSFER/>
</config>
No, you won't need external_addr unless you are behind a NAT. What you need to do is:
Set TCP.bind_addr (I suggest remove TCP.client_bind_addr), e.g. to one of the public IP addresses (50.x.x.x)
TCPPING.initial_hosts needs to have all (or a majority) of the members' addresses
Your current configuration doesn't work because (1) bind_addr is undefined and (2) initial_hosts lists a member at port 7801, but TCP.bind_port is 7800.

MSDeploy setParameter not working

We are trying to integrate a 'build once, deploy anywhere' model in our build-deploy system.
MSDeploy works wonders for this, cutting down build time dramatically with CRC checksum comparisons and (for the most part) it works just as well when using parameterisation to change applications web.configs depending on the environment we deploy to.
I have the majority of these parameters nailed down, but a few elements and attributes never seem to change, no matter how many different ways I call them in the parameters.xml file. I have outlined three examples of this, here is the web.config file I am trying to change:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="DbConnectionString" connectionString="Data Source=null;Initial Catalog=null;Trusted_Connection=no;User ID=user1;Password=pass*9;" providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<customErrors mode="On" defaultRedirect="/Library/Error/PageNotFound.aspx">
</customErrors>
</system.web>
<applicationSettings>
<settings>
<setting name="service_Address" serializeAs="String">
<value></value>
</setting>
<settings>
</applicationSettings>
</configuration>
Here is the parameters.xml file:
<parameter name="DbConnectionString" defaultValue="">
<parameterEntry kind="XmlFile" scope="\\web.config$" match="/configuration/connectionStrings/add[#name='DbConnectionString']/#connectionString" />
</parameter>
<parameter name="customErrorsMode" defaultValue="">
<parameterEntry kind="XmlFile" scope="\\web.config$" match="configuration/system.web/customErrors/#mode" />
</parameter>
<parameter name="service_Address" defaultValue="">
<parameterEntry kind="XmlFile" scope="\\web.config$" match="/configuration/applicationSettings/aim.Web.Properties.Settings/setting[#name='service_Address']/value" />
</parameter>
And here is the corresponding setParameters.xml file:
<setParameter name="DbConnectionString" value="Data Source=dbserver;Initial Catalog=DB1;Trusted_Connection=no;User ID=user1;Password=pass*9;"/>
<setParameter name="customErrorsMode" value="Off"/>
<setParameter name="service_Address" value="https://myservice.asmx"/>
I have tested each XPath expression and the results are the exact same as any of the other working parameters, but the above never seem to change.
Does anyone see anything obvious I'm missing here?
service_Address
I found the answer to this problem here:
Replace web.config elements with MSDeploy
I was missing 'text()' at the end of the XPath expression, the correct XPath is:
/configuration/applicationSettings/aim.Web.Properties.Settings/setting[#name='ai‌​m_Web_AddressService_Address']/value/text()
customErrorsMode
For the customErrorsMode problem, I was missing a '/' at the start of my XPath expression. The correct expression is:
/configuration/system.web/customErrors/#mode
connectionStrings
This one really got to me, it was the last one I figured out. After doing a bit of digging I found out that MSDeploy automatically parameterizes certain elements, connection string being one of them, more info here:
Configuring Parameters for Web Package Deployment
My parameter declaration for the connection string in question should have been:
<parameter name="DbConnectionString-Web.config Connection String" defaultValue="">
<parameterEntry kind="XmlFile" scope="\\web.config$" match="/configuration/connectionStrings/add[#name='DbConnectionString']" />
</parameter>
My setParameter definition should have looked like this:
<setParameter name="DbConnectionString-Web.config Connection String" value="Data Source=dbserver;Initial Catalog=DB1;Trusted_Connection=no;User ID=user1;Password=pass*9;" />

getting service from wsdd via xpath not wroking (xmltask)

I am trying to get the XPath "/deployment/service". Tested on this site:
http://www.xmlme.com/XpathTool.aspx
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org /axis/wsdd/providers/java">
<service name="kontowebservice" provider="java:RPC" style="rpc" use="literal">
<parameter name="wsdlTargetNamespace" value="http://strategies.spine"/>
<parameter name="wsdlServiceElement" value="ExposerService"/>
<parameter name="wsdlServicePort" value="kontowebservice"/>
<parameter name="className" value="some.package.internal.KontoWebServiceImpl_WS"/>
<parameter name="wsdlPortType" value="Exposer"/>
<parameter name="typeMappingVersion" value="1.2"/>
<operation xmlns:operNS="http://strategies.spine" xmlns:rtns="http://www.w3.org/2001/XMLSchema" name="expose" qname="operNS:expose" returnQName="exposeReturn" returnType="rtns:anyType" soapAction="">
<parameter xmlns:tns="http://www.w3.org/2001/XMLSchema" qname="in0" type="tns:anyType"/>
</operation>
<parameter name="allowedMethods" value="expose"/>
<parameter name="scope" value="Request"/>
</service>
</deployment>
I absolutely can't find out why it always tells me that my xpath does not match...
This may be stupid, but am I missing something?
EDIT
Thanks to the answer from Dimitre Novatchev I was able to find a workaround:
<xmltask failwithoutmatch="true" report="false">
<fileset dir="${src.gen}/" includes="**/*-deploy.wsdd" />
<copy path="//*[local-name()='service']" buffer="tmpServiceBuf" append="true" />
</xmltask>
<xmltask failwithoutmatch="true" report="false" source="${basedir}/env/axis/WEB-INF/server-config.wsdd" dest="${build.stage}/resources/WEB-INF/server-config.wsdd">
<insert path="//*[local-name()='transport'][last()]" buffer="tmpServiceBuf" position="after" />
</xmltask>
Binding namespaces with xmltask (which is the tool that gave me the headaches) seems not to be possible. The code above did the trick.
The Problem: This XML document has a default namespace. XPath considers any unprefixed names to be in "no-namespace". It tries to select /deployment/service where the elements deployment and service are in no-namespace and doesn't select any node, because in the provided XML documents there are no such elements that are in "no- namespace (they all are in the "http://xml.apache.org/axis/wsdd/" namespace)
The solution: Using the language which hosts XPath (such as C#, Jave, XSLT, or any other language that you may be using) bind a prefix (say x:) to the namespace "http://xml.apache.org/axis/wsdd/".
Then, change:
/deployment/service
to
/x:deployment/x:service
Now the last XPath expression correctly selects the desired node.

Resources