(Python库:**psutil**) ## 一、系统监控 >[info]#### top -bi -n 1 获取负载、任务、CPU、内存信息 top - 23:24:01 up 2 days, 10:52, 2 users, load average: 0.00, 0.01, 0.05 Tasks: 92 total, 1 running, 91 sleeping, 0 stopped, 0 zombie %Cpu(s): 1.2 us, 0.3 sy, 0.0 ni, 98.4 id, 0.1 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem : 1883724 total, 428164 free, 325268 used, 1130292 buff/cache KiB Swap: 0 total, 0 free, 0 used. 1356252 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND >[info]#### df -h|egrep '[0-9.]+G' 获取磁盘信息 /dev/vda1 40G 3.1G 35G 9% / /dev/vdb1 99G 61M 94G 1% /cache >[info]#### /proc/net/dev 获取流量信息 Inter-| Receive | Transmit face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed eth0: 297710038 359115 0 0 0 0 0 0 108704337 200526 0 0 0 0 0 0 lo: 6777133 29428 0 0 0 0 0 0 6777133 29428 0 0 0 0 0 0 ## 二、Python收集 ## 三、python发送 ## 四、定时任务 crontab -e cat /var/spool/cron/root