KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache
System : Linux 10-169-227-96.cprapid.com 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
User : kwssawblade ( 1099)
PHP Version : 7.2.34
Disable Function : exec,passthru,shell_exec,system
Directory :  /opt/monitoring/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //opt/monitoring/bandwidthusage.sh
#!/bin/bash
#10 */2 * * * sh /opt/monitoring/bandwidthusage.sh

WebHook='https://oapi.dingtalk.com/robot/send?access_token=9c19cbc699ec3aa08d6ee84d2f60ccd05e655f80815d7e716132ef39ce16dedf'
App_name='带宽使用率'
USERNAME=`cat /etc/passwd |grep "/home" | grep -v "/bin/false" | awk -F ":" '{print $1}'`


Server_name='独立主机18'


function SMTDD() {
    curl $WebHook -H 'Content-Type: application/json' -d "
    {
        'msgtype': 'text',
        'text': {
            'content': '$App_name预警:请注意\n服务器: $Server_name\n用户: ${user_name}\n带宽使用率大于${PERCENT}%\n'
        },
        'at': {
            'isAtAll': false
        }
    }" >/dev/null 2>&1
}


for user_name in ${USERNAME};do
    PERCENT=`uapi --user=${user_name} StatsBar get_stats display='bandwidthusage' | grep "percent:" | awk '{print $2}'`
    if [ ${PERCENT} -ge 90 ];then
       SMTDD
    fi
done


Anon7 - 2021