# 重新加载配置文件 curl -X POST http://localhost:9011/-/reload
# ===================================================远程到web主机上执行===================================================== cd wget https://3dview-1251252938.cos.ap-shanghai.myqcloud.com/dengjinjun/scripts/install_exporter.sh chmod +x install_exporter.sh sh install_exporter.sh
# ===================================================远程到数据库监控主机上执行===================================================== cd
declare -i port=9240 find_port() { whiletrue; do if [ ! -z "$(ss -tunlp | grep $port)" ]; then ((port++)) else return"$port" fi done }
find_port sh /root/install_sqlexporter.sh ${CUSTOM_SPELL}${port} sed -i "s/DMN/${CUSTOM_SPELL}/g" /usr/local/sql_exporter_${CUSTOM_SPELL}/history_work.collector.yml sed -i "s/prom_user:prom_password/sa:${SQL_PASSWD}/g" /usr/local/sql_exporter_${CUSTOM_SPELL}/sql_exporter.yml sed -i "s/dbserver1.example.com/${SQL_ADDR}/g" /usr/local/sql_exporter_${CUSTOM_SPELL}/sql_exporter.yml sed -i "s/mssql_standard/mssql_standard,history_work/g" /usr/local/sql_exporter_${CUSTOM_SPELL}/sql_exporter.yml