This support forum board is for support questions relating to
Nagios XI , our flagship commercial network monitoring solution.
hoegh
Posts: 201 Joined: Thu Jan 04, 2018 7:48 am
Post
by hoegh » Thu Mar 07, 2019 7:14 am
Hi Team,
I'm trying to add JMX object monitoring in Nagios XI.
I have to monitor 4 objects of JMX, in which 2 were added successfully, wheras other 2 objects are generating Critical alerts.
Code: Select all
./check_jmx -U service:jmx:rmi:///jndi/rmi://10.xxx.xx.xx:8008/jmxrmi -O Catalina:type=Manager,host=localhost,context=/Vms -A activeSessions -w 10 -c 30
JMX OK - activeSessions=7 | activeSessions=7
./check_jmx -U service:jmx:rmi:///jndi/rmi://10.xxx.xx.xx:8008/jmxrmi -O java.lang:type=Memory -A HeapMemoryUsage -K used
JMX OK - HeapMemoryUsage.used=544682864 | HeapMemoryUsage.used=544682864
but below is not working
Code: Select all
./check_jmx -U service:jmx:rmi:///jndi/rmi://10.xxx.xx.xx:8008/jmxrmi -O com.zaxxer.hikari:type=Pool* -A ActiveConnections -w 10 -c 30
JMX CRITICAL - com.zaxxer.hikari:type=Pool*
./check_jmx -U service:jmx:rmi:///jndi/rmi://10.xxx.xx.xx:8008/jmxrmi -O Catalina:type=ThreadPool,name=\"http-nio-*\" -A currentThreadsBusy -w 20 -c 60
JMX CRITICAL - Catalina:type=ThreadPool,name="http-nio-*"
Please help me to resolve this.
Thanks
Hoegh
Thanks
Höegh
hoegh
Posts: 201 Joined: Thu Jan 04, 2018 7:48 am
Post
by hoegh » Thu Mar 07, 2019 8:51 am
HI Team,
Actually i need to execute 5 queries like below:
Code: Select all
./check_jmx -U service:jmx:rmi:///jndi/rmi://10.xxx.xx.xx:8008/jmxrmi -O 'com.zaxxer.hikari:type=Pool (HikariPool-1)' -A ActiveConnections -w 10 -c 30
./check_jmx -U service:jmx:rmi:///jndi/rmi://10.xxx.xx.xx:8008/jmxrmi -O 'com.zaxxer.hikari:type=Pool (HikariPool-2)' -A ActiveConnections -w 10 -c 30
./check_jmx -U service:jmx:rmi:///jndi/rmi://10.xxx.xx.xx:8008/jmxrmi -O 'com.zaxxer.hikari:type=Pool (HikariPool-3)' -A ActiveConnections -w 10 -c 30
./check_jmx -U service:jmx:rmi:///jndi/rmi://10.xxx.xx.xx:8008/jmxrmi -O 'com.zaxxer.hikari:type=Pool (HikariPool-4)' -A ActiveConnections -w 10 -c 30
./check_jmx -U service:jmx:rmi:///jndi/rmi://10.xxx.xx.xx:8008/jmxrmi -O 'com.zaxxer.hikari:type=Pool (HikariPool-5)' -A ActiveConnections -w 10 -c 30
If you can see in object name, only HikaruPool-
1 is changing.
I'm expecting wild char [*] something like below command, which can give me result in one query.
Code: Select all
./check_jmx -U service:jmx:rmi:///jndi/rmi://10.xxx.xx.xx:8008/jmxrmi -O 'com.zaxxer.hikari:type=Pool (HikariPool-*)' -A ActiveConnections -w 10 -c 30
Please help
Thanks
Höegh
cdienger
Support Tech
Posts: 5045 Joined: Tue Feb 07, 2017 11:26 am
Post
by cdienger » Thu Mar 07, 2019 1:48 pm
The plugin would need to be updated to accept wildcard. I found
https://github.com/luisdalves/jmxquery/issues/12 which _may_ help but given these are third party plugins, your results may vary. The work around would be to create a check for each pool.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new
Privacy Policy .
hoegh
Posts: 201 Joined: Thu Jan 04, 2018 7:48 am
Post
by hoegh » Fri Mar 08, 2019 8:04 am
Thanks
@cdienger for the link.
But dealing with coding part can be a bit difficult.
Here we have to monitor currently 3 pools connection count, so is there any way if we can pass three objects/pools names in one query itself?
Using comma [,] or semicolon [;] in the check_jmx command or something like that.
or if we can sum all the connection count from all 3 connection pools using plugins like check_multi ?
Thanks
Höegh
cdienger
Support Tech
Posts: 5045 Joined: Tue Feb 07, 2017 11:26 am
Post
by cdienger » Fri Mar 08, 2019 4:14 pm
check_multi is promising. As a quick poc I made this file to sum the value of a column and trigger critical if the value is above 20:
Code: Select all
command [ tmp1 ] = ls -ld /tmp | awk '{ print $2}'
command [ tmp2 ] = ls -ld /tmp | awk '{ print $2}'
command [ echo ] = echo $(($tmp1$ + $tmp2$))
state [ CRITICAL ] = $echo$ gt 20
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new
Privacy Policy .
hoegh
Posts: 201 Joined: Thu Jan 04, 2018 7:48 am
Post
by hoegh » Sat Mar 09, 2019 10:41 am
Thanks
@cdienger ,
example you've give is good idea, but my command string contains output something like
JMX OK - ActiveConnections=0 | ActiveConnections=0
in which i want number of connections. So i tried etching only number from output with help of below link:
https://linuxconfig.org/how-to-extract- ... sh-example
My command file for check_multi:
Code: Select all
command[HikariPool_1]=/usr/local/nagios/libexec/check_jmx -U service:jmx:rmi:///jndi/rmi://10.202.22.66:8008/jmxrmi -O 'com.zaxxer.hikari:type=Pool (HikariPool-1)' -A ActiveConnections
command[HikariPool_2]=/usr/local/nagios/libexec/check_jmx -U service:jmx:rmi:///jndi/rmi://10.202.22.66:8008/jmxrmi -O 'com.zaxxer.hikari:type=Pool (HikariPool-2)' -A ActiveConnections
command[HikariPool_3]=/usr/local/nagios/libexec/check_jmx -U service:jmx:rmi:///jndi/rmi://10.202.22.66:8008/jmxrmi -O 'com.zaxxer.hikari:type=Pool (HikariPool-3)' -A ActiveConnections
command[total_AC]=echo $(($HikariPool_1$ + $HikariPool_2$ + $HikariPool_3$))
state [ WARNING ] = $total_AC$ gt 9
state [ CRITICAL ] = $total_AC$ gt 29
execution:
Code: Select all
[root@OSLMSnagios libexec]# ./check_multi -f ./config/check_jmx_AC.cmd
sh: JMX OK - ActiveConnections=0 + JMX OK - ActiveConnections=0 + JMX OK - ActiveConnections=0 : syntax error in expression (error token is "OK - ActiveConnections=0 + JMX OK - ActiveConnections=0 + JMX OK - ActiveConnections=0 ")
UNKNOWN - 4 plugins checked, 1 unknown (total_AC), 3 ok [please don't run plugins as root!,global_result_rating: parsing error (Evaluation error in '$total_AC$ gt 9': syntax error at (eval 16) line 1, near "( gt" ),global_result_rating: parsing error (Evaluation error in '$total_AC$ gt 29': syntax error at (eval 17) line 1, near "( gt" )]
[ 1] HikariPool_1 JMX OK - ActiveConnections=0
[ 2] HikariPool_2 JMX OK - ActiveConnections=0
[ 3] HikariPool_3 JMX OK - ActiveConnections=0
[ 4] total_AC [RC was 127!]|check_multi::check_multi::plugins=4 time=0.799055 HikariPool_1::check_jmx::ActiveConnections=0 HikariPool_2::check_jmx::ActiveConnections=0 HikariPool_3::check_jmx::ActiveConnections=0
Can you please help us to modify above command in such way so that we can get total connection count as a output string.
Thanks & Regards
Hoegh
Thanks
Höegh
mcapra
Posts: 3739 Joined: Thu May 05, 2016 3:54 pm
Post
by mcapra » Mon Mar 11, 2019 9:13 am
These are
HikariCP pools I assume?
The current implementation of
jmxquery.jar , which supports the
check_jmx plugin, doesn't support multiple Objects being returned (regardless of wildcard support for the query):
https://github.com/WillPlatnick/jmxquer ... #L237-L241
jmxquery.jar can handle composite data and grab specific attributes (done via the
-A /
-I args), but has no way to iterate over multiple Objects. To use this plugin to monitor HikariCP pools, either HikariCP would need to expose a single Object to represent all connection pools (
it currently only registers individual beans per Pool/PoolConfig ), or
jmxquery.jar would need to be modified to detect and iterate over multiple returned Objects.
hoegh
Posts: 201 Joined: Thu Jan 04, 2018 7:48 am
Post
by hoegh » Mon Mar 11, 2019 9:26 am
Thanks
@mcapra ,
I'll see if i can modify jmxquery.jar file as per my requirements.
Thanks
Thanks
Höegh
cdienger
Support Tech
Posts: 5045 Joined: Tue Feb 07, 2017 11:26 am
Post
by cdienger » Mon Mar 11, 2019 10:29 am
For check_multi, you'd need to create commands so that it returns numbers that can be acted on. For example:
Code: Select all
command[HikariPool_1]=/usr/local/nagios/libexec/check_jmx -U service:jmx:rmi:///jndi/rmi://10.202.22.66:8008/jmxrmi -O 'com.zaxxer.hikari:type=Pool (HikariPool-1)' -A ActiveConnections | awk '{print $4}' | grep -o '.$'
command[HikariPool_2]=/usr/local/nagios/libexec/check_jmx -U service:jmx:rmi:///jndi/rmi://10.202.22.66:8008/jmxrmi -O 'com.zaxxer.hikari:type=Pool (HikariPool-2)' -A ActiveConnections | awk '{print $4}' | grep -o '.$'
command[HikariPool_3]=/usr/local/nagios/libexec/check_jmx -U service:jmx:rmi:///jndi/rmi://10.202.22.66:8008/jmxrmi -O 'com.zaxxer.hikari:type=Pool (HikariPool-3)' -A ActiveConnections | awk '{print $4}' | grep -o '.$'
command[total_AC]=echo $(($HikariPool_1$ + $HikariPool_2$ + $HikariPool_3$))
state [ WARNING ] = $total_AC$ > 9
state [ CRITICAL ] = $total_AC$ > 29
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new
Privacy Policy .
hoegh
Posts: 201 Joined: Thu Jan 04, 2018 7:48 am
Post
by hoegh » Thu Mar 14, 2019 8:33 am
Thanks
@cdienger , It's working as per our requirement. Although there are some logical modification needed so that i'll do it by myself.
Thanks for your help
Please close this thread.
Thanks
Höegh