jmxquery - null pointer exception after patching for wildcard entries - java

i want to monitor c3p0 connection pool parameters with Icinga.
So i found for this the nagios plugin jmxquery.
There will be a patch for wildcard queries.
I've patched the plugin like described here,
but after that i'll get NullPointerException's on every query i run.
[root#hostname target]# ./check_jmx -U service:jmx:rmi:///jndi/rmi://<HOSTNAME>:9001/jmxrmi -O com.mchange.v2.c3p0:type=PooledDataSource[2rw2h791t5s2b210jnofo\|2ab68416] -A numConnectionsAllUsers -I numConnectionsAllUsers -vvvv -username monitorRole -password *******************
JMX CRITICAL - NullPointerException: null connecting to com.mchange.v2.c3p0:type=PooledDataSource[2rw2h791t5s2b210jnofo|2ab68416] by URL service:jmx:rmi:///jndi/rmi://<HOSTNAME>:9001/jmxrmijava.lang.NullPointerException
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1008)
at java.lang.Double.parseDouble(Double.java:540)
at jmxquery.JMXQuery.compare(JMXQuery.java:199)
at jmxquery.JMXQuery.report(JMXQuery.java:147)
at jmxquery.JMXQuery.main(JMXQuery.java:93)
Any Ideas??

Alternate tool to access jmx beans.
Jmxterm is a command line based interactive JMX client. It's designed to allow user to access a Java MBean server from command line without graphical environment. If this is useful please check.
JMXTerm

Related

Getting Java IO exception when using jenkins cli , jdk 8.144 , jenkins v2.93

This is the error.
root#myserver#java -jar
/opt/tomcat/webapps/ROOT/WEB-INF/jenkins-cli.jar -s
http://localhost:8181 -auth ****:**** help
java.io.IOException: Bogus chunk size
at sun.net.www.http.ChunkedInputStream.processRaw(ChunkedInputStream.java:319)
at sun.net.www.http.ChunkedInputStream.readAheadBlocking(ChunkedInputStream.java:572)
at sun.net.www.http.ChunkedInputStream.readAhead(ChunkedInputStream.java:609)
at sun.net.www.http.ChunkedInputStream.read(ChunkedInputStream.java:696)
at java.io.FilterInputStream.read(FilterInputStream.java:133)
at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:3375)
at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:3368)
at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:3356)
at hudson.cli.CLI$1ClientSideImpl.<init>(CLI.java:658)
at hudson.cli.CLI.plainHttpConnection(CLI.java:684)
at hudson.cli.CLI._main(CLI.java:612)
at hudson.cli.CLI.main(CLI.java:426)
On further troubleshooting I found the issue to be linked to reverse-proxy .
“The HTTP(S) connection mode of the CLI in Jenkins 2.54 and newer does not work correctly behind an Apache HTTP reverse proxy server using mod_proxy. Workarounds include using a different reverse proxy such as Nginx or HAProxy, or using the SSH connection mode where possible.”
I used ssh instead .
https://issues.jenkins-ci.org/browse/JENKINS-47279

Exception getting zoo instance in geomesa accumulo data store

Thanks for your attention. I am setting up Accumulo Data Store using geomesa and zookeper and have completed set up configuration changes and installed required instance like accumulo, java and maven.
When I am creating a new feature using command line interface using command geomesa create-schema -u root -p ****** \
-c device_ping \
-f feature \
-s uuid:String:index=true,dtg:Date,geom:Point:srid=4326 \
--dtg dtg
It fails giving
Exception getting zoo instance and terminate throwing error "Unable to create data store, please check your connection parameters."
I am unable to find solution to this problem and don't know which configuration parameters are wrong. Here is the details of attached screenshot
GeoMesa works to figure out the Zookeepers from a local copy of the Accumulo cluster's configuration. That configuration is likely in $ACCUMULO_HOME.
You can manually set the zookeepers with -z host1,host2,host3. If the hosts are correct (or you set them manually), you might check that zookeeper is running and can be accessed from your laptop.
To double check Zookeeper, you can do something like...
echo ruok | nc hostName portNumber
If Zookeeper is running, you'll receive an 'imok' message back.
Lastly, if Zookeeper is up and running, but just slow for some reason, you can increase the Zookeeper timeout by setting the Java system property "instance.zookeeper.timeout" higher. The timeout is currently set to 5 seconds.

How to check heap memory usage and tomcat version in one command with check_jmx4perl and nagios

We are using Jolokia and jmx4perl to monitor tomcat instances with Nagios. We are currently using the following command definition:
define command {
command_name check_tomcat
command_line $USER3$/check_jmx4perl \
--url $ARG1$ \
--mbean java.lang:type=Memory \
--attribute HeapMemoryUsage \
--path used \
--base java.lang:type=Memory/HeapMemoryUsage/max \
--label "Heap-Memory: %.2r% used (%.2v %u / %.2b %w)" \
--warning 80 --critical 90
}
... which gives us a nice output like this in Nagios:
OK - Heap-Memory: 37.93% used (295520640 / 779091968)
In an ideal world, I would also like to get the Tomcat version like so:
OK - Tomcat 7.0.68 - Heap-Memory: 37.93% used (295520640 / 779091968)
Can this be done with one command or will I need 2 command definitions and 2 service definitions?
Thanks,
First yes can check tomcat with your custom configration.That configration will have your command and service for checking tomcat.Then you can read that cfg file like this.
--config /etc/nagios/check_jmx4perl/tomcat.cfg
--server servername \
--check tc_servlet_requests \
--critical 1000 \
servletname
To write command and service in a single configuration file.Just write your command definition followed by service definition of that command.Also make sure the .cfg file has root privileges.
Jmx4Perl provides an alternate way for accessing Java JEE Server
management interfaces which are based on JMX (Java Management
Extensions). It is an agent based approach, where a small Java
Webapplication deployed on the application server provides an
HTTP/JSON based access to JMX MBeans registered within the
application server.HOW IT WORKS
For the agent mode a small Java Agent WAR (web archive) needs to be
deployed on the Java application server. This agent is provided by
the Jolokia project (www.jolokia.org). There is no need to add any
startup parameters to the application server and to open any
additional ports.The Perl module JMX::Jmx4Perl accesses the deployed agent servlet
and transform the request's results from JSON into a simple Perl
object.

How to check if JMX agent is working in Tomcat?

I have a Tomcat 8 instance. I'm trying to connect to it from JColsole. In order to do so I have added to the setenv.bat the following line:
CATALINA_OPTS=%CATALINA_OPTS% -Dcom.sun.management.jmxremote.password.file=D:\Utils\Apache\Tomcat\conf\remote.users -Dcom.sun.management.jmxremote.access.file=D:\Utils\Apache\Tomcat\conf\remote.acl -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=7777 -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=localhost
and in those two files -- remote.users and remote.acl i have defined user test with password test and the role readwrite.
However I cannot connect via JConsole (I tried using url localhost:7777 and service:jmx:rmi://localhost:7777).
Further investigation showed, that I cannot even telnet to 7777.
What am I doing wrong?
As it happens, when Tomcat is running as a service on Windows, I don't need setenv.bat, I need to use tomcat8w.exe -- GUI toll for adding options

h2 cluster with file based database

I have set up an h2 cluster but cannot connect via the console or using a datasource all I get is this:
IO Exception: "java.io.IOException: The filename, directory name, or volume label syntax is incorrect"; "E:/baseDirDefinedInServerConnection/myDB,localhost:1112/myDB" [90031-176] 90031/90031 (Help)
I have configured 2 servers thus:
java -cp h2-1.3.167.jar org.h2.tools.Server -tcp -tcpPort 1111 -tcpAllowOthers -baseDir E:\myBaseDir
at tcp://myIp:1111 (others can connect)
java -cp h2-1.3.167.jar org.h2.tools.Server -tcp -tcpPort 1112 -tcpAllowOthers -baseDir E:\myBaseDir\server
at tcp://myIp:1112 (others can connect)
So you see I have one database in a directory (this has been created) and another database in another directory. Both are up and running.
I have run the cluster tool thus:
java -cp h2-1.3.167.jar org.h2.tools.CreateCluster -urlSource jdbc:h2:tcp://localhost:1111/myDB -urlTarget jdbc:h2
:tcp://localhost:1112/myDB -user username -password pass -serverList localhost:1111,localhost:1112
And it all looks good. If I try to connect thorugh the console without the cluster list I get this message, which proves we are in clustered mode, which is good:
Clustering error - database currently runs in cluster mode, server list: 'localhost:1111,localhost:1112'" [
I have checked the permissions on the directories and all has read/write access.
Yes this is a windows machine.
Using H2 version:
Bundle-Vendor: H2 Group
Bundle-Version: 1.3.167
Any ideas what I might have done wrong?
Thanks for reading.
Guess you already found out that one should connect like this
jdbc:h2:tcp://localhost:1111,localhost:1112/myDB

Categories