Centos搭建Jmxtrans服务

前端之家收集整理的这篇文章主要介绍了Centos搭建Jmxtrans服务前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1、下载安装包

http://central.maven.org/maven2/org/jmxtrans/jmxtrans/

在这个地址上选择自己所需要的版本,并下载rpm包,我选择jmxtrans-259.rpm


2、安装

执行命令

[root@dx3local]#rpm-ijmxtrans-259.rpm

如果有以下错误

[root@dx3local]#rpm-ijmxtrans-259.rpm
error:Faileddependencies:
java>=1.7isneededbyjmxtrans-259-1.noarch

则执行命令

[root@dx3local]#rpm-ijmxtrans-259.rpm--nodeps--force


3、查看安装

默认应用安装在 /usr/share/jmxtrans目录下

初始化脚本目录 /etc/init.d/jmxtrans

json文件存放位置 /var/lib/jmxtrans


4、调试,查看

将日志等级修改为DEBUG

修改配置文件/usr/share/jmxtrans/etc/wrapper.conf中的wrapper.java.additional.5=-Djmxtrans.log.level=DEBUG

日志文件目录 wrapper.java.additional.6=-Djmxtrans.log.dir=/var/log/jmxtrans


在/var/lib/jmxtrans目录下创建编写自己的查询文件(json格式)

{
"servers":[
{
"host":"dx2.zdp.ol","port":"22222","queries":[
{
"outputWriters":[
{
"@class":"com.googlecode.jmxtrans.model.output.GangliaWriter","settings":{
"groupName":"jmxtrans","host":"100.100.160.200","port":"8649"
}
}
],"obj":"kafka.consumer:type=ConsumerFetcherManager,name=MaxLag,clientId=flume","resultAlias":"dx2_22222.ConsumerFetcherManager.MaxLag"
}
],"numQueryThreads":2
}
]
}


5、启动脚本

[root@dx2bin]#pwd
/usr/share/jmxtrans/bin
[root@dx2bin]#./jmxtransstart/var/lib/jmxtrans/dx2_jmxtrans.json


6、查看日志文件

[root@dx2bin]#tail-f/var/log/jmxtrans/jmxtrans.log
部分日志文件
[09九月201614:21:10][jmxtrans-result-5]1715596DEBUG(com.googlecode.jmxtrans.model.output.GangliaWriter:201)-SendingGangliametricdx2_33334_PMSGateway.ConsumerFetcherManager.MaxLag.Value=0[type=INT32]
[09九月201614:21:10][jmxtrans-result-5]1715596DEBUG(com.googlecode.jmxtrans.model.output.GangliaWriter:201)-SendingGangliametricdx2_33334_PMSGateway.ConsumerFetcherManager.MaxLag.Value=0[type=INT32]
[09九月201614:21:12][ServerScheduler_Worker-6]1717578DEBUG(com.googlecode.jmxtrans.jobs.ServerJob:58)-+++++Startedserverjob:Server(pid=null,host=dx2.zdp.ol,port=33336,url=service:jmx:rmi:///jndi/rmi://dx2.zdp.ol:33336/jmxrmi,cronExpression=null,numQueryThreads=0)
[09九月201614:21:12][ServerScheduler_Worker-6]1717578DEBUG(com.googlecode.jmxtrans.jobs.ServerJob:58)-+++++Startedserverjob:Server(pid=null,numQueryThreads=0)
[09九月201614:21:12][ServerScheduler_Worker-6]1717578DEBUG(com.googlecode.jmxtrans.jobs.ServerJob:64)-+++++Finishedserverjob:Server(pid=null,numQueryThreads=0)

7、从输出端Ganglia查看效果

wKioL1fSWIugGFTWAAHcw0QfnKU261.png

原文链接:https://www.f2er.com/centos/380782.html

猜你在找的CentOS相关文章