一 问题描述
我使用jstat命令来监控Java应用,前端时间调试Logstash的时候,Logstash单独指定JDK1.8,但是服务器上其他Java应用还是使用的JDK1.7,监控脚本jstat_status.py指定的jstat还是1.7版本
http://john88wang.blog.51cto.com/2165294/1708302
Logstash的监控信息没有收集到,Zabbix server端有报错信息
12257:20160611:144426.851 error reason for "xxxxxxxx:java.discovery_status[logstash_shipper,all]" changed: Received value [Warning: Unresolved Symbol: sun.gc.generation.2.space.0.capacity substituted NaNWarning: Unresolved Symbol: sun.gc.generation.2.space.0.used substituted NaNWarning: Unresolved Symbol: sun.gc.generation.2.minCapacity substituted NaNWarning: Unresolved Symbol: sun.gc.generation.2.maxCapacity substituted NaNWarning: Unresolved Symbol: sun.gc.generation.2.capacity substituted NaNWarning: Unresolved Symbol: sun.gc.generation.2.space.0.capacity substituted NaNWarning: Unresolved Symbol: sun.gc.generation.2.space.0.capacity substituted NaNWarning: Unresolved Symbol: sun.gc.generation.2.space.0.used substituted NaNWarning: Unresolved Symbol: sun.gc.generation.2.space.0.capacity substituted NaNTraceback (most recent call last): File "/opt/app/zabbix/sbin/jstat_status.py", line 181, in <module> jproc.compute_jstats() File "/opt/app/zabbix/sbin/jstat_status.py", line 115, in compute_jstats self.zdict[‘Perm_used‘] = format(float(self.pdict[‘PU‘]) * 1024,‘0.2f‘)ValueError: invalid literal for float(): ?] is not suitable for value type [Numeric (unsigned)] and data type [Decimal]
二 问题解决
单独使用jstat查看
$ sudo /opt/app/jdk1.8/bin/jstat -gcutil 1634 S0 S1 E O M CCS YGC YGCT FGC FGCT GCT 68.67 0.00 35.78 5.98 92.24 89.23 4 0.584 2 0.188 0.772
]$ sudo jstat -gcutil 1634 Warning: Unresolved Symbol: sun.gc.generation.2.space.0.capacity substituted NaN Warning: Unresolved Symbol: sun.gc.generation.2.space.0.used substituted NaN Warning: Unresolved Symbol: sun.gc.generation.2.space.0.capacity substituted NaN S0 S1 E O P YGC YGCT FGC FGCT GCT 0.00 92.09 70.17 4.13 3 0.543 2 0.188 0.730
jstat1.8 jstat1.7的输出不同,jstat 1.7 有 P这个项目表示Permanent space utilization as a percentage of the space‘s current capacity.
jstat1.8 没有P这个项目,而是有个M和CCS两个项目分别表示
Metaspace utilization as a percentage of the space‘s current capacity. 和
Compressed class space utilization as a percentage.
将logstsh的jdk版本调整到1.7问题得到解决
本文出自 “Linux SA John” 博客,请务必保留此出处http://john88wang.blog.51cto.com/2165294/1787948
原文地址:http://john88wang.blog.51cto.com/2165294/1787948