http://hermannsspace.de/wp/collect-pnp4nagios-data-in-check_mk-distributed-environment
global定时同步脚本
cat /opt/sync_cmk_perfdata.sh #!/bin/bash perfdata_path="/opt/omd/sites/global/var/pnp4nagios/perfdata/" SITES=(slave1:10.0.70.105) for site in ${SITES[*]} do site_id=$(echo $site|cut -d : -f 1) site_host=$(echo $site|cut -d : -f 2) #获取远程rrd文件列表 rrd_files=$(ssh root@$site_host find /opt/omd/sites/$site_id/var/pnp4nagios/perfdata -name *.rrd) #远程rrdcache写入磁盘 ssh root@$site_host /omd/sites/$site_id/bin/rrdtool flushcached -d unix:/omd/sites/$site_id/tmp/run/rrdcached.sock $rrd_files #远程rrd同步到本地 rsync -avz root@$site_host:/opt/omd/sites/$site_id/var/pnp4nagios/perfdata/ $perfdata_path #替换xml中的远程site_id为本地site_id find $perfdata_path -name "*.xml" |xargs sed -i "s/sites\/$site_id/sites\/global/g" done # crontab -l */5 * * * * /opt/sync_cmk_perfdata.sh >/dev/null 2>&1global配置apache rewrite
cat /opt/omd/apache/multisite_proxy.conf Options +FollowSymLinks RewriteEngine On RewriteRule ^/(slave1|slave2|slave3)/(.*) http://10.0.70.104/global/$2 [P] posted on 2017-06-27 13:55 北京涛子 阅读( ...) 评论( ...) 编辑 收藏转载于:https://www.cnblogs.com/liujitao79/p/7084796.html