锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
rabbitmq.config
[{rabbit, [{cluster_partition_handling, autoheal},{loopback_users, []}]}].
#
# Startup script for ovirt-agent
#
# chkconfig: 2345 85 20
# description: ovirt-agent
# processname: ovirt-agent
# pidfile: /var/run/tomcat.pid # config:# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
export OVIRT_AGENT_HOME=/opt/ovirt-agent
[ -f $OVIRT_AGENT_HOME/bin/startServer.sh ] ||?exit 0 [ -f $OVIRT_AGENT_HOME/bin/stopServer.sh ] ||?exit 0
# See how we were called.
case "$1" in
start)
# Start daemon.
echo ?"Starting OVirt-agent: "
$OVIRT_AGENT_HOME/bin/startServer.sh $OVIRT_AGENT_HOME/conf/ovirt-agent.xml
touch /var/lock/subsys/ovirt-agent
;;
stop)
# Stop daemons.
echo ?"Shutting down OVirt-agent: "
$OVIRT_AGENT_HOME/bin/stopServer.sh
rm -f /var/lock/subsys/ovirt-agent
;;
restart)
$0 stop
$0 start
;;
status)
status ovirt-agent
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit 0
pptpsetup --create myvpn --server www.yanlingyi.com --username vpn --password mincloud --encrypt --start
docker
run -d --name="rabbitmq_master" -p 200:22 -p 25672:25672 -p
15672:15672 -p 5672:5672 -p 4369:4369 -p 10051:10050 rabbitmq/ubuntu /bin/bash
-exec 'echo -e "172.20.20.10 rabbitmq-master\n127.0.0.1 localhost"
> /etc/hosts && /etc/init.d/rabbitmq-server start &&
/usr/sbin/sshd -D'
So now you have:
- The elapsed wall clock time (this period's time, minus last period's time) Call this X
- The elapsed process cpu time (this period's time, minus last period's time) Call this Y
- The number of CPUs. Call this C
The percent utilization will be Y / (X x C) * 100
import java.lang.management.*;
import java.util.concurrent.*;
osx = ManagementFactory.getOperatingSystemMXBean();
cores = osx.getAvailableProcessors(); // Factorial to keep the process busy so we can see some actual activity
factorial = { n -> int fact = 1; int i = 1; while(i <= n) { i++; fact *= i; } return fact; }
long elapsedTime = -1, startTime = -1; long elapsedCpu = -1, startCpu = -1;;
for(i in 0..20) { startTime = System.nanoTime(); startCpu = osx.getProcessCpuTime(); CountDownLatch latch = new CountDownLatch(cores); for(x in 1..cores) { Thread.startDaemon() { factorial(1000000); latch.countDown(); } } latch.await(); elapsedTime = System.nanoTime()-startTime; elapsedCpu = osx.getProcessCpuTime()-startCpu; percUsage = (elapsedCpu / (elapsedTime* cores)) *100; println "Percent Usage:$percUsage %"; }