如何设置监控目标服务器cpu,内存等信息

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

如何设置监控目标服务器cpu,内存等信息

wanxi3
我把ngrinder-monitor拷贝到了目标服务器,sh run_monitor_bg.sh后,创建测试用例,添加了目标服务器的IP。但是测试完成后,还是没有目标服务器的信息,是我哪里没有做对么
Reply | Threaded
Open this post in threaded view
|

Re: 如何设置监控目标服务器cpu,内存等信息

junoyoon
Administrator
Did you check the firewall b/w controller and target?

You can try to see it's connectable from controller by using

> # in your controller sever, run following.
> telnet {your_target_ip} 13243

Reply | Threaded
Open this post in threaded view
|

Re: 如何设置监控目标服务器cpu,内存等信息

neven7
In reply to this post by wanxi3
执行时,加上-o参数,指定配置文件为本目录下的配置文件__agent.conf, 并将monitor.binding_port设置为你的controller端的ip;

如需搜集自定义数据,可以查看如下文章:

nGrinder对监控机器收集自定义数据及源码分析
http://blog.csdn.net/neven7/article/details/50782451
Reply | Threaded
Open this post in threaded view
|

Re: 如何设置监控目标服务器cpu,内存等信息

熊金飞
This post was updated on .
ngrinder服务器IP:192.168.84.140
目标服务器IP:192.168.84.174

将monitor.binding_port修改成192.168.84.140

[root@localhost ngrinder-monitor]# cat __agent.conf
common.start_mode=monitor
# If you want to monitor bind to the different local ip not automatically selected ip. Specify below field.
#monitor.binding_port=hostname_or_ip
monitor.binding_port=192.168.84.140

运行./run_monitor.sh -o 报错:
[root@localhost ngrinder-monitor]# ./run_monitor.sh -o
16:12:24.464 [main] INFO  agent config - NGRINDER_AGENT_HOME : /root/.ngrinder_agent
16:12:24.468 [main] INFO  agent config - Overwrite the existing agent.conf with __agent.conf
16:12:24.593 [main] INFO  starter - ***************************************************
16:12:24.593 [main] INFO  starter - * Start nGrinder Monitor...
16:12:24.593 [main] INFO  starter - ***************************************************
16:12:26.693 [main] INFO  o.n.monitor.agent.RegisterMXBean - Added MXBean:org.ngrinder.monitor:name=System.
16:12:26.693 [main] INFO  o.n.monitor.agent.RegisterMXBean - Default MXBean Initialized.
16:12:26.693 [main] INFO  o.n.monitor.agent.MonitorServer - Service URL:service:jmx:rmi://[::]/jndi/rmi://[::]:0/jmxrmi is initiated.
16:12:26.742 [main] ERROR starter - ERROR: Cannot bind to URL [rmi://[::]:0/jmxrmi]: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: ::; nested exception is:
        java.net.ConnectException: 拒绝连接]
16:12:26.746 [main] ERROR starter - Error while starting Monitor
java.io.IOException: Cannot bind to URL [rmi://[::]:0/jmxrmi]: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: ::; nested exception is:
        java.net.ConnectException: 拒绝连接]
        at javax.management.remote.rmi.RMIConnectorServer.newIOException(RMIConnectorServer.java:826) ~[na:1.7.0_79]
        at javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:431) ~[na:1.7.0_79]
        at org.ngrinder.monitor.agent.MonitorServer.start(MonitorServer.java:101) ~[ngrinder-core-3.4.jar:na]
        at org.ngrinder.NGrinderAgentStarter.startMonitor(NGrinderAgentStarter.java:104) [ngrinder-core-3.4.jar:na]
        at org.ngrinder.NGrinderAgentStarter.main(NGrinderAgentStarter.java:217) [ngrinder-core-3.4.jar:na]
Caused by: javax.naming.ServiceUnavailableException: null
        at com.sun.jndi.rmi.registry.RegistryContext.bind(RegistryContext.java:143) ~[na:1.7.0_79]
        at com.sun.jndi.toolkit.url.GenericURLContext.bind(GenericURLContext.java:226) ~[na:1.7.0_79]
        at javax.naming.InitialContext.bind(InitialContext.java:419) ~[na:1.7.0_79]
        at javax.management.remote.rmi.RMIConnectorServer.bind(RMIConnectorServer.java:643) ~[na:1.7.0_79]
        at javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:426) ~[na:1.7.0_79]
        ... 3 common frames omitted
Caused by: java.rmi.ConnectException: Connection refused to host: ::; nested exception is:
        java.net.ConnectException: 拒绝连接
        at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619) ~[na:1.7.0_79]
        at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216) ~[na:1.7.0_79]
        at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202) ~[na:1.7.0_79]
        at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:341) ~[na:1.7.0_79]
        at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source) ~[na:1.7.0_79]
        at com.sun.jndi.rmi.registry.RegistryContext.bind(RegistryContext.java:137) ~[na:1.7.0_79]
        ... 7 common frames omitted
Caused by: java.net.ConnectException: 拒绝连接
        at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.7.0_79]
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) ~[na:1.7.0_79]
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:198) ~[na:1.7.0_79]
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) ~[na:1.7.0_79]
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.7.0_79]
        at java.net.Socket.connect(Socket.java:579) ~[na:1.7.0_79]
        at java.net.Socket.connect(Socket.java:528) ~[na:1.7.0_79]
        at java.net.Socket.<init>(Socket.java:425) ~[na:1.7.0_79]
        at java.net.Socket.<init>(Socket.java:208) ~[na:1.7.0_79]
        at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:40) ~[na:1.7.0_79]
        at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:147) ~[na:1.7.0_79]
        at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613) ~[na:1.7.0_79]
        ... 12 common frames omitted
Usage: run_monitor.sh [options]
  Options:
    -ah, --agent-home
       this agent's unique home path. The default is ~/.ngrinder_agent
    -o, --overwrite-config
       overwrite overwrite the existing .ngrinder_agent/agent.conf with the
       local __agent.conf
    -s, --silent
       silent mode
    -v, --version
       show version
    -help, -?, -h
       prints this message

关于配置文件的疑问:
1、monitor.binding_port 这个难道不应该是端口吗?我一开始写成:13243,如果是Controller的IP 我觉得应该是:monitor.binding_host




Reply | Threaded
Open this post in threaded view
|

Re: 如何设置监控目标服务器cpu,内存等信息

熊金飞
各位好,问题已经解决,是配置文件说明有误:

cat /root/.ngrinder_agent/agent.conf
common.start_mode=monitor
# If you want to monitor bind to the different local ip not automatically selected ip. Specify below field.
monitor.binding_ip=192.168.84.174
monitor.binding_port=13243

这里monitor.binding_port=hostname_or_ip修正为:monitor.binding_ip=hostname_or_ip

备注:看了ngrinder的源码ngrinder/ngrinder-core/src/main/java/org/ngrinder/common/constants/MonitorConstants.java:,描述如下:

public interface MonitorConstants {
        public static final String PROP_MONITOR_BINDING_IP = "monitor.binding_ip";
        public static final String PROP_MONITOR_BINDING_PORT = "monitor.binding_port";

        /**
         * Monitor Constant
         */
        public static final int DEFAULT_MONITOR_COLLECTOR_INTERVAL = 1;
        public static final String DEFAULT_MONITOR_DOMAIN = "org.ngrinder.monitor";
        public static final String SYSTEM = "name=System";
        public static final String MONITOR_FILE_PREFIX = "monitor_system_";
}


但是模板配置文件:ngrinder/ngrinder-controller/src/main/resources/ngrinder_agent_home_template/agent_monitor.conf
写的有误:
common.start_mode=monitor
# If you want to monitor bind to the different local ip not automatically selected ip. Specify below field.
#monitor.binding_port=hostname_or_ip
monitor.binding_port=${monitorPort}
Reply | Threaded
Open this post in threaded view
|

Re: 如何设置监控目标服务器cpu,内存等信息

junoyoon
Administrator
Thanks. We fixed this issue by https://github.com/naver/ngrinder/pull/179