#!/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\": \"每日表数据量统计情况如下:\n$Table_rows\"
     }
  }"
}
SendMessageToDingding 

发表评论

您的电子邮箱地址不会被公开。

Captcha Code