How to let zabbix know when Java Heap is out of memory on CentOS - jmx

My server is running some java processes (Wowza media Server).
And 1 day, it had been error "out of memory java heap".
I want zabbix to detect this issue to send notify email.
Anyone know about this please help, or just give me an idea.
Thank a lot.
I tried to find some commandline to get java heap size,
java -XX:+PrintFlagsFinal -version | grep HeapSize
but this is not what i want.
I want to get the value of heap memory at the time i run the command

You can use JMX to monitor JVM metrics (cpu, threads, memory).
JMX monitoring has native support in Zabbix in the form of a Zabbix daemon called “Zabbix Java gateway”, introduced since Zabbix 2.0.
You can see the documentation here.

As mentioned you can use JVM . For
The interface for the item key "jmx [java.lang: type = Memory,
HeapMemoryUsage.committed]
Does your Host in Zabbix have JMX interface configured? You can see how it should look like in the documentation link, mentioned above. in section: Configuring JMX interface
p.s mostly it is server_ip and port 6969.

Related

JMX Monitoring using jboss-cli

We have an application which used JBoss 4.2.3.GA and we are migrating it to WildFly 8.2. In the old implementation, the JMX monitoring was done using twiddle. Since twiddle doesn't exist in WildFly, we are using the JBoss CLI for JMX monitoring.
Is it the right approach to use the JBoss CLI for JMX monitoring? Are there any command line tools similar to twiddle which can be used for JMX monitoring in WildFly?
One option to get something similar would be to simply query the JMX MBeans programmatically yourself. The advantage here is that your solution can be reused without depending on things like Twiddle which may be discontinued and also are compatible with other app servers.
Here is an example using Groovy to query an MBean in Tomcat and here is an example using Java to query an MBean in ActiveMQ.
If you choose to go with Groovy, you should be aware that there is a way to use Groovy (or Javascript or Python) to wrap the CLI and have more of a control flow. The CLI is great for simple declarative things, but lacks the versatility of a proper scripting language.
If you want to use pure CLI, then that's fine too, but I would suggest you create files which you can then call through bash e.g.:
$JBOSS_HOME/bin/jboss-cli.sh -c --file="my-jvm-monitoring.cli"
You might find this CLI model reference useful and also this blog about monitoring WildFly with the CLI

Java Mission Control with windows services: disabled functionality

I am trying to use the "Log historical data" functionality provided by Java Mission Control to record information about:
- Used Java Heap Memory
- Commited Java Heap
- Maximum Java Heap
of a local tomcat instance running as a Windows service.However I can't add any new graph using the "Add..." button.
It is fine if I try the same with a local application, but some parts of JMC seem to be disabled when connecting to windows services. The Java options that I am using for Tomcat are:
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=6666
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.local.only=false
-XX:+UnlockCommercialFeatures
-XX:+FlightRecorder
Any help/suggestion would be appreciated.
Hopefully you've already got an answer for your question, but if not, I have some questions for you:
Which version of JMC are you using?
Can you run JMC with -consoleLog (JDK\bin\jmc -consoleLog | more), so see if you get any - output?
Can't you find the MBeans, or what happens when you want to add them to a graph?
Can you see the MBeans if you connect with jconsole?
//Klara, JMC dev

After starting hadoop, i cannot start mahout ..!

When Starting Mahout i got an error message like this
root#fazil-VPCEB45FG:/usr/local/mahout/bin# ./mahout
hadoop binary is not in PATH,HADOOP_HOME/bin,HADOOP_PREFIX/bin, running locally
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
i have installed openjdk0.6, Whether openjdk is supported by mahout
There's no OpenJDK 0.6 -- you mean 1.6. Yes Java 6 is supported, as you see in the project documentation. This does not seem to have anything to do with Mahout as it's an error from the JVM itself. The error itself says the problem: you requested a heap that's too large. So, I'd go see what heap you requested in Hadoop config and check it. This is the kind of info you should post in a question.
It's exactly what is says in the error message
Could not reserve enough space for object heap
check your your hadoop config files: hadoop-env.sh and
mapred-site.xml for any properties where you have allocated memory to JVM through the Xmx parameter and lower the values if you don't have enough physical memory.
If you have plenty of ram and you run java on 64-bit OS you need to add a -d64 java option to enforce 64-bit mode (it's not done by default in some cases)
Edit: for stand alone mode (your case) just use a proper Xmx value and -d64 if it is 64bits OS
JAVA_HEAP_MAX parameter in mahout file you're running should be lowered. It was 3GB in the mahout version I downloaded.

Access JVM properties from command line

I have some JBoss 5.1.0 instances running on JDK1.6 on RHEL5. I would like to access heap/permgen/etc information from their VMs.
The JBoss configuration has not explicitly enabled JMX on the JVM for remote access with JConsole/JVisualVM.
I can access JBoss-related information through Twiddle, and, if I had a GUI on this machine, I would be able to access this information by running JConsole/JVisualVM (JDK 1.6 allows the connection of these clients after the app has been started, even without the com.sun.management options).
Is there a way to access this information without restarting these VMs?
The ways I can envisage doing it are:
Using Twiddle to access this information through JBoss' JMX console - if this is possible, what should I be passing in to find the information?
Using a command line client to connect to the running JDK in the same way that JConsole can. I am aware of cmdline-jmxclient but I don't know if it is capable of this.
The solution is to use jstat:
jstat -gccapacity -t 4994 5s
This line prints out the Garbage Collector capacity information, plus a timestamp for process 4994 every 5 seconds.
You need to be the correct user to gain access to the VM, so for me the above command had to be run sudo -u jboss jstat ....
There's lots more information on the documentation page.

aws memory high usage

Recently I configured my instance into a micro environment in EC2 with glassfish and mysql in windows..
I deployed my war and i was able to access my site through http.
I changed my application and redeployed the war and it also worked.
When I was about to redeploy the war for 4th or 5th time, the application got deployed, I saw the message in the log file. But I was unable to access the site through http.
Then I tried the command "asadmin list-applications" and I got the following message.
Error occurred during initialization of VM
Could not reserve enough space for object heap
After that I was not able to connect to my instance through RDP and I had to reboot, I was able to access it again after that. I started the servers again (glassfish mysql), but no luck.
I noticed that the memory usage is around 90% or more. CPU isage is low.
now I can not access my site through http. what shall i do ?
Thanks in advance !
Honestly, there are a couple issues working against you here:
1) Windows requires FAR more RAM than Ubuntu to run at a minimum decent level.
2) GlassFish has a much larger footprint than Tomcat or Jetty.
Is there any particular reason you need Windows? Like is there a specific need that your server run some executables for file processing or something like that outside the JVM? Most would agree that Linux (Ubuntu or other) will give you much better results in performance and stability to run an App Server like GlassFish in any environment.

Resources