Page 1 of 2

Wildfly Monitoring with NCPA Client

Posted: Wed Aug 26, 2020 4:15 am
by DanielKissel
Hello Everyone,

I followed your PDF Guide to configure Wildfly Monitoring via the NCPA Client.

Sadly I am not able to get any Values into Nagios XI.

Everytime I run the Check from the Nagios XI Server i get this as response:

Code: Select all

/usr/local/nagios/libexec/check_ncpa.py -H ###MYIP#### -t ####MyTOKEN#### -P 5693 -M plugins/check_jvm.jar -q "args=-s service:jmx:http-remoting-jmx://###CorrectIPANDPORT#####,args=-u '##JbossUser###',args=-p '##JbossUserPsw###',args=-t jboss,args=-C 'MemorySimpleHeap,MemoryMetaspace,ProcessCPUUsage,SystemCPUUsage,Uptime,ClassCount,ThreadCount',args=-w '17179869184,34359738368,50,70,1500000:,10000,150',args=-c '32212254720,68719476736,70,90,300000:,50000,190'"
Fehler: Hauptklasse GenericASCheck konnte nicht gefunden oder geladen werden
Translation of the Error is that it can't load or find the MainClass GenericASCheck

The NCPA Client on the Machine is set like described in the PDF Tutorial and added the following line to the ncpa.cfg and the check_jvm.jar Plugin has been placed in the plugins folder of the ncpa client.

Code: Select all

.jar = java -Djava.class.path=C:\wildfly\bin\client\jboss-cli-client.jar:$plugin_name GenericASCheck $plugin_args
I tried it both with jboss-cli-client.jar and jboss-client.jar


When using Visual VM on the VM itself I can connect via JMX with no Problem to the Wildfly.

Our Wildfly is running on a Windows Machine.

Any help is highly appreciated :)

Kind regards
Daniel

Re: Wildfly Monitoring with NCPA Client

Posted: Wed Aug 26, 2020 9:59 am
by DanielKissel
Just a little update from my side. I invested some time and get a result back when executing the following command from the PowerShell directly on the Windows Server where my Wildfly is running.

Console Output

Code: Select all

PS C:\ncpa\plugins> java -cp "C:\ncpa\plugins\jboss-cli-client.jar;C:\ncpa\plugins\check_jvm.jar" GenericASCheck -t jboss -s 'service:jmx:http-remoting-jmx://###IPandport###' -C 'MemorySimpleHeap,MemoryMetaspace,ProcessCPUUsage,SystemCPUUsage,Uptime' -w '17179869184,34359738368,50,70,1500000:,10000,150' -c '32212254720,68719476736,70,90,300000:,50000,190' -u ####Jbossuser### -p ####JbossPSW####

CRITICAL: 2 checks returned CRITICAL | jboss_heap=691502728B;17179869184;32212254720;; jboss_metaspace=227843144B;34359738368;68719476736;; jboss_process_cpu_usage=-100.0%;50;70;; jboss_s
ystem_cpu_usage=-100.0%;70;90;; jboss_uptime=68124862ms;1500000:;300000:;;
Heap-Allocated Memory returned OK with 659.47 MiB
Metaspace (non-heap) returned OK with 217.29 MiB
Process CPU usage returned CRITICAL with -100.0 %
System CPU usage returned CRITICAL with -100.0 %
Uptime returned OK with 18.92 hours
How could i get this into the ncpa.cfg to execute properly. I have tried different variants with no success.
Other question why does the HealthCheck return -100% CPU Usage? Is this a Bug?

Re: Wildfly Monitoring with NCPA Client

Posted: Wed Aug 26, 2020 3:16 pm
by cdienger
I'm not sure about the negative percentage at this point, but try this in the ncpa config:

Code: Select all

.jar = java -cp "C:\wildfly\bin\client\jboss-cli-client.jar;C:\ncpa\plugins\check_jvm.jar" GenericASCheck $plugin_args
and let us know if that gives you better results.

Re: Wildfly Monitoring with NCPA Client

Posted: Thu Aug 27, 2020 2:02 am
by DanielKissel
Hello,

this is the response from Nagios XI for the suggested NCPA Configuration

Code: Select all

UNKNOWN: Failed to connect: Unsupported protocol: http-remoting-jmx

These are some variants I have tried and commented in the ncpa.cfg with the results i had recieved from Nagios:

Code: Select all


#Here i copied the jboss-cli-client.jar to the plugins folder from the NCPA Agent
#.jar = java -cp "C:\ncpa\plugins\jboss-cli-client.jar;C:\ncpa\plugins\check_jvm.jar" GenericASCheck $plugin_args
# Result: UNKNOWN: Failed to connect: Unsupported protocol: http-remoting-jmx

#.jar = java -cp "C:\ncpa\plugins\jboss-cli-client.jar;$plugin_name" GenericASCheck $plugin_args
# Result: UNKNOWN: Failed to connect: Unsupported protocol: http-remoting-jmx

#.jar = java -cp "C:\ncpa\plugins\jboss-cli-client.jar;"$plugin_name GenericASCheck $plugin_args
#Result: Fehler: Hauptklasse C:\ncpa\plugins\check_jvm.jar konnte nicht gefunden oder geladen werden

Kind regards
Daniel

Re: Wildfly Monitoring with NCPA Client

Posted: Thu Aug 27, 2020 5:54 pm
by ssax
Are you running this through docker for windows or do you have it directly installed on windows?

I want to lab it up and see what I find.

Re: Wildfly Monitoring with NCPA Client

Posted: Thu Aug 27, 2020 6:06 pm
by cdienger
The message "UNKNOWN: Failed to connect: Unsupported protocol: http-remoting-jmx" is an indicator that check_jvm.jar is getting loaded but jboss-cli-client.jar isn't. Java can be finicky when it comes to loading classes. Try this entry:

Code: Select all

.jar = java -cp "C:\wildfly\bin\client\jboss-cli-client.jar:C:\ncpa\plugins\check_jvm.jar" GenericASCheck $plugin_args

Re: Wildfly Monitoring with NCPA Client

Posted: Fri Aug 28, 2020 1:45 am
by DanielKissel
Hello everyone,

Wildfly is installed directly on the Windows Server and is running as a Service via NSSM.

Kind regards
Daniel

Re: Wildfly Monitoring with NCPA Client

Posted: Fri Aug 28, 2020 1:52 am
by DanielKissel
cdienger wrote:The message "UNKNOWN: Failed to connect: Unsupported protocol: http-remoting-jmx" is an indicator that check_jvm.jar is getting loaded but jboss-cli-client.jar isn't. Java can be finicky when it comes to loading classes. Try this entry:

Code: Select all

.jar = java -cp "C:\wildfly\bin\client\jboss-cli-client.jar:C:\ncpa\plugins\check_jvm.jar" GenericASCheck $plugin_args


When executing this the Result is, that the Main Class is not found

Code: Select all

.jar = java -cp "C:\ncpa\plugins\jboss-cli-client.jar:C:\ncpa\plugins\check_jvm.jar" GenericASCheck $plugin_args
#Result: Fehler: Hauptklasse GenericASCheck konnte nicht gefunden oder geladen werden

Re: Wildfly Monitoring with NCPA Client

Posted: Fri Aug 28, 2020 5:34 pm
by ssax
What version of wildfly are you using?

For testing, can you try putting check_jvm.jar in your C:\Users\YOURUSER\ then change your ncpa entry to:

Code: Select all

.jar = java -cp "C:\wildfly\bin\client\jboss-cli-client.jar:check_jvm.jar" GenericASCheck $plugin_args
Then restart the NCPA service and test again and see if that works.

Is this path accurate?

Code: Select all

C:\wildfly\bin\client\jboss-cli-client.jar

Re: Wildfly Monitoring with NCPA Client

Posted: Mon Aug 31, 2020 12:28 am
by DanielKissel
Hi,

i will try. Currently we are still running a Wildfly 12.

Wildfly is on our E:\ Partition. Just change from the C:\ Drive to E:\ Drive and your Path is correct.