获取mysql大表并发钉钉告警

  sre
#!/usr/bin/bash
#统计test1库表行数top20
/usr/bin/mysqlshow  -h127.0.0.1 -P3306 -uroot -p123456  test1 -v -v  |sort -k6nr |head  -n 20 > /opt/tables/Rows_(date +%Y%m%d)

Table_rows="(cat /opt/tables/Rows_(date +%Y%m%d))"
function SendMessageToDingding()
{
  curl https://oapi.dingtalk.com/robot/send?access_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxd29c \
   -H 'Content-Type: application/json' \
   -d "
  {\"msgtype\": \"text\",    \"text\": {
        \"content\": \"每日表数据量统计情况如下:\nTable_rows\"
     }
  }"
}
SendMessageToDingding 

LEAVE A COMMENT

Captcha Code