hyperic hq笔记

下载包的时候最好选择版本,它看你下载的平台默认为win32的。
http://sourceforge.net/projects/hyperic-hq/files/

在线文档说明安装步骤比较详细
http://support.hyperic.com/display/DOC/HQ+Documentation
默认安装的话(不带任何参数),就是自带的数据库postgresql ,解压缩后的安装bat脚本有些古怪,必须直接执行才可以,把它拖到,命令行执行反而不行。agent安装后,启动命令在安装目录下buldles文件夹下的bin里面,而不是安装目录的bin下面,搞不懂。

下载源码:
http://hyperic-hq.svn.sourceforge.net/viewvc/hyperic-hq/src/?view=tar

稍微看了一下tomcat plugin写法,基于jmx,要求tomcat开放jmx服务才行。
tomcat6是自动发现了,但是没有发现本机的tomcat5.5
plugin分针对server的和针对agent的。

HQU--可认为是服务端plugin,用于增加监视器,UI界面等。
http://support.hyperic.com/display/hypcomm/HQU+Documentation
4.5
http://support.hyperic.com/display/EVO/Introduction+to+Plugin+Development

如下的文档又说可以放在agent目录下面
http://support.hyperic.com/display/DOC/Plugin+Development+Center

对于ipf admin来说,只需要服务端plugin(JMX)来监听个机器上开放的(JVM Managaer)服务即可。

使用pdk:<Agent Directory>/pdk

这个Server UI大概是struts2写的,奇慢,又丑,……

测试本地jmx都没自动发现

Server 下面的tomcat的控制说明可知,需要配置tomcat才能控制
To configure Tomcat for JMX monitoring see http://tomcat.apache.org/tomcat-6.0-doc/monitoring.html.
For a quick down and dirty method follow these instructions,
in /bin/catalina.sh add:
[ $1 != "stop" ] && JAVA_OPTS="-Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.port=6969 \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.authenticate=false $JAVA_OPTS"
export JAVA_OPTS
看来还得自己实现
4.5的文档
http://support.hyperic.com/display/EVO/
用户手册中说
jmx必须自己配置plugin

它的文档真是恼火,看半天还是从这里看到一些信息:

The 3.0.2 and earlier versions of the MxServerDetector would auto-configure jmx.url using the port defined by the command line argument:
-Dcom.sun.management.jmxremote.port=xxxx

Servers run with just the local connector enabled do not define a port, so the jmx.url ptql query must be manually configured.
This enhancement will auto-configure jmx.url to use the local connector if java is start with -Dcom.sun.management.jmxremote and ptql query is defined as the value like so:
-

Dcom.sun.management.jmxremote=ptql:State.Name.eq=java,Args.*.eq=org.hyperic.MyMainClass

Note: for standalone apps using the "Sun JVM 1.5" server type, server auto-discovery is not enabled by default. It can be turned on by adding the following to agent.properties:
jmx.sun.discover=true

对于下面这样一段话,我看了n遍不知道什么意思,简直要骂人!

1. This code provides two methods — of which you must use one — for defining the install (base) path for
the process.style="width: 575px;height: 169px">

<!-- derive installpath from JAVA_HOME env prop... -->
<property name="PROC_HOME_ENV" value="JAVA_HOME"/>
<!-- derive installpath from -Dproc.java.home=... -->
<property name="PROC_HOME_PROPERTY" value="proc.java.home"/>

If using the first method, replace JAVA_HOME with the environmental property of the process. If using the

second method, replace proc.java.home with the defined name-value pair argument of the process; the

MxServer Detector class uses this variable to perform auto-discovery.

You could instead use a third method:

>

<property name="PROC_MAIN_CLASS" value="proc.java.home"/>

As with PROC_HOME_PROPERTY, this variable tells the MxServerDetector class to autodiscover the process

with this PTQL: State.Name.eq=java,Args.*.sw=-D<value of proc main class>.

Any of these methods will set the installpath config variable to be the current working directory of the process

in question. And while this is particularly useful for log-tracking and control plugins (which are outside the

scope of this tutorial), this value is also used later [55] in this XML descriptor.

安装配置手册里面:

agent向服务端发送数据包。

serveragent发送指令。

agent第一次连接server时会告知向server开放的端口,server记在database里面发起连接。

手册上说agent启动脚本是直接在agent_home/bin下的脚本。

linux下面是如此,但是windows下似乎要在bundles里面的。

如果出现No token file found, waiting for Agent to initialize的提示,说明原来的已经有个agent占用同样的端口运行在,需要停止。[这提示真是很威武]

57上安装agent后,能现实的就只有系统状态,其余都看不到。

   

websphere似乎是通过对安装路径里的分析来获得属性的。

api示例:

http://svn.hyperic.org/projects/hqapi/trunk/src/org/hyperic/hq/hqapi1/test/

不考虑跳过hyperic Server而写自己的jmx监视MBean的原因:

hyperic server 对于weblogic和websphere都有扩展的监控,如果跳过可能以后不好继续使用这方面的功能。

hyperic server还是做了些事情的,跳过它就丢弃了他提供的功能。

hyperic的支持非常差,经常搜到的问题没有回复。也需要购买才行吧。

测试:

对于如下的实例

<?xml version="1.0"?>

<plugin name="myjmx">

<server name="myjmx">

<property name="OBJECT_NAME"

value="*:type=abc"/>

<!-- derive installpath from -Djonas.base=... –>

line:10<property name="PROC_HOME_PROPERTY" value="proc.java.home" />

line:11<property name="PROC_MAIN_CLASS" value="co.ipmc.test.IpfServer"/>

<!-- XXX need to support time-stamp format -->

<property name="DEFAULT_LOG_FILE" value="logs/my.log" />

<config>

<option name="jmx.url" description="JMX URL to MBeanServer"

default="service:jmx:rmi:///jndi/rmi://localhost:29999/server" />

<option name="process.query" description="PTQL for Java Process" default="State.Name.eq=java,Args.*.sw=proc.java.home"/>

</config>

<properties>

<property name="serverVersion" description="Server Version" />

<property name="serverVendor" description="Server Vendor" />

</properties>

<plugin type="log_track"

class="org.hyperic.hq.product.Log4JLogTrackPlugin" />

<plugin type="autoinventory"

class="org.hyperic.hq.product.jmx.MxServerDetector" />

</server>

</plugin>

对于10,11行,需要在运行的命令加入参数,如下

java -jar run-test.jar -Dproc.java.home=/usr/java/jdk1.6.0_17 co.ipmc.test.IpfServer

注意,就算run-test.jar包里面已经指明了主类,任然要在命令行里面写出主类。不然就找不到。

最终通过如下命令测试

java -jar bundles/agent-4.5.1/pdk/lib/hq-pdk-4.5.1.jar -Dplugin.include=myjmx -p myjmx -m discover

 

终于发现了这个server了

ERROR [Thread-1] [MxServerDetector] 'myjmx 3.0 Linux' measurement plugin not found

org.hyperic.hq.product.PluginNotFoundException: measurement plugin name=myjmx 3.0 Linux not found

    at org.hyperic.hq.product.PluginManager.getPlugin(PluginManager.java:286)

    at org.hyperic.hq.product.ServerDetector.mergeConfigDefaults(ServerDetector.java:991)

    at org.hyperic.hq.product.ServerDetector.setMeasurementConfig(ServerDetector.java:1024)

    at org.hyperic.hq.product.DaemonDetector.newServerResource(DaemonDetector.java:201)

    at org.hyperic.hq.product.jmx.MxServerDetector.getServerResource(MxServerDetector.java:323)

    at org.hyperic.hq.product.jmx.MxServerDetector.getServerResources(MxServerDetector.java:379)

    at org.hyperic.hq.autoinventory.scanimpl.NullScan.scan(NullScan.java:83)

    at org.hyperic.hq.autoinventory.Scanner.start(Scanner.java:198)

    at org.hyperic.hq.autoinventory.ScanManager.mainRunLoop(ScanManager.java:141)

    at org.hyperic.hq.autoinventory.ScanManager.access$000(ScanManager.java:41)

    at org.hyperic.hq.autoinventory.ScanManager$1.run(ScanManager.java:107)

1 servers detected

Server: SERV myjmx 3.0 [/usr/java/jdk1.6.0_17]

AIID...../usr/java/jdk1.6.0_17

config...

product..process.query=State.Name.sw=java,Args.*.eq=co.ipmc.test.IpfServer,Args.*.eq=-Dproc.java.home=/usr/java/jdk1.6.0_17,jmx.url=service:jmx:rmi:///jndi/rmi://localhost:29999/server,

metric...

control..null

Runtime Resource Report...

Platform=Linux, fqdn=192.168.0.10 (CentOS 5.2)

config...

product..null

metric...platform.log_track.level=Warn,platform.log_track.enable=true,platform.config_track.enable=true,

control..null

cprops...cpuSpeed=8 @ 2128 MHz (8x16),defaultGateway=192.168.0.1,arch=x86_64,ram=16000 MB,vendor=CentOS,vendorVersion=5.2,primaryDNS=192.168.0.1,ip=192.168.122.1,version=2.6.18-92.el5xen,

   [No services discovered]

然后兴冲冲的去重启agent,不断地刷server,仍然没出来。

什么错也没报。真是很无语,这种东西用起来真吃力呀!

到此为止吧,就算我愚钝不堪,仅为这么个基本的jmx配置就搞这半天,这个工具也太不好用了吧。

总结一下感觉不爽的地方:

  • 相关资料稀少,使用者提出的问题鲜有人回答,往往是使用者之间的沟通而没有支持与使用者的沟通。估计使用的人也不多。
  • 官方写的文档这里引用那里,那里引用这里,转的头昏脑胀还是没搞明白,它就是不让你看懂。
  • HQ server的UI太俗不说,反应非常慢,一个操作要隔几秒钟,按得我手疼。
  • 本机器上安装server后,机器反应速度奇慢,关闭server服务则明显改善,如果再跑上个agent那更不得了。我对其性能持怀疑态度,如果agent所在服务器服务多,再开上个agent那就是雪上加霜,不知这样的监控有多少可评测性。

Total views.

© 2013 - 2024. All rights reserved.

Powered by Hydejack v6.6.1