运维自动化之使用PHP+MYSQL+SHELL打造私有监控系统(二)

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介:
现在开始介绍php+mysql+shell监控系统
1 、目的
       此监控系统主要是通过 php+mysql+shell的方式,通过shell脚本对各个机器的其各个服务进行监控,达到及时的了解其各个应用服务的状态(如果宕掉与启动),在检测应用服务宕掉时,记录在日志里与mysql数据库服务器里,同时进行服务宕掉的邮件提示,并自动启动宕掉的应用服务;在检测应该服务启动时,同时进行服务启动的邮件提示,所有的监控内容都能在php制作的web里进行浏览,同时能根据mysql里的数据,把资源监控数据视图化,在浏览数据的时候,更方便。
2 、实现的机制
       监控方式主要是通过 shell脚本的实现,针对应用服务运行的端口进行监控,如果其端口开启,则证明此服务运行,反之则此服务没有运行。
3 、监控的应用服务
       监控的应用服务有:
A、应用服务器的服务监控
web: http、yu_tomcat、tomcat 共3个
交换:  pas、ppas、mas、mmas、cas共5个
引擎: memcache、datastorageservice、http、dbstatserver共4个
B:应用服务器的资源监控
硬盘使用率、 cpu使用率、硬件启动信息错误、i/o使用率、15分钟内的负载、内存使用率(包括内存与swap)、日志错误信息、当前用户登录数
4 、已经监控的省份
       目前天津、广西、贵州、海南、河北、河南、湖北、湖南、宁夏、陕西、青海、西藏、新疆、包头、甘肃、江西都已经部署完成,经过 3个月的测试,没有发现问题。
5 shell监控脚本内容与解释
1)web服务器(以甘肃web为例)
 
   
  1. #!/bin/bash  
  2. #ip  
  3. web_ip=$(/sbin/ifconfig eth0|grep "inet addr"|cut -d : -f 2|awk '{print $1}')  
  4. ##eth0网卡的ip  
  5. #name  
  6. web_name=$(hostname)  
  7. ##web主机名  
  8. monitor_name=web 
  9. ##监控的服务器是什么类型  
  10. here='gansu' 
  11. ##监控的省份  
  12. #mysql info  
  13. mysql_ip='1.1.1.1' 
  14. ##数据库的ip  
  15. mysql_username='root' 
  16. ##数据库的用户  
  17. mysql_passwd='****' 
  18. #数据库的密码  
  19. mysql_database='monitor' 
  20. ##选择的数据库  
  21. memory_table=''$here'_memory'  
  22. load_table=''$here'_load'  
  23. io_table=''$here'_io'  
  24. hardware_table=''$here'_hardware'  
  25. message_table=''$here'_message'  
  26. user_table=''$here'_user'  
  27. disk_table=''$here'_disk'  
  28. cpu_table=''$here'_cpu'  
  29. service_table=''$here'_service'  
  30. ##想数据库里写入的表  
  31. #date and log  
  32. day="$(date +%Y%m%d)" 
  33. worklog='/usr/local/monitor/logs/all_work_log' 
  34. downlog='/usr/local/monitor/logs/all_down_log' 
  35. ##日志与实际  
  36. now="$(date +%Y-%m-%d-%T)" 
  37. #web service  
  38. tomcat="$(netstat -antl|grep 8080|wc -l)" 
  39. web_http="$(ps -ef|grep httpd|grep -v grep|wc -l)" 
  40. yz_tomcat="$(netstat -antl|grep 8081|wc -l)" 
  41. ##通过端口与服务在后头的运行情况监控其运行状态  
  42. #cpu service  
  43. alert_cpu='80' 
  44. ##cpu的报警阀值  
  45. web_cpu_idle="$(top -b -n 1 | grep Cpu | awk '{print $5}' | cut -f 1 -d .)" 
  46. web_cpu="$(echo 100 - $web_cpu_idle|/usr/bin/bc)" 
  47. ##监控cpu的使用率  
  48. #memory service  
  49. alert_mem='100' 
  50. ##内存的报警阀值  
  51. web_mem="$(/usr/bin/free -m|grep Mem|awk '{print $4}')" 
  52. web_swap="$(/usr/bin/free -m|grep Swap|awk '{print $3}')" 
  53. ##memory与swap的使用率  
  54. alert_swap='0' 
  55. ##swap的报警阀值  
  56. #memory log  
  57. memory_worklog='/usr/local/monitor/logs/mem_work_log' 
  58. memory_downlog='/usr/local/monitor/logs/mem_down_log' 
  59. #load service  
  60. cpu_count="$(grep -c 'model name' /proc/cpuinfo)" 
  61. alert_load="$(echo $cpu_count/2|/usr/bin/bc)" 
  62. web_load="$(uptime|awk '{print $NF}'|cut -f 1 -d .)" 
  63. web_load_15="$(uptime|awk '{print $NF}')" 
  64. #监控负载的使用率  
  65. #load log  
  66. load_worklog='/usr/local/monitor/logs/load_work_log' 
  67. load_downlog='/usr/local/monitor/logs/load_down_log' 
  68. #io service  
  69. alert_io='80' 
  70. web_io_idle_back="$(/usr/bin/iostat|awk 'NR==4{print $NF}'|cut -f 1 -d .)" 
  71. web_io_idle="$(echo 100 - $web_io_idle_back|/usr/bin/bc)" 
  72. ##io的使用值  
  73. #io log  
  74. io_worklog='/usr/local/monitor/logs/io_work_log' 
  75. io_downlog='/usr/local/monitor/logs/io_down_log' 
  76. #hardware service  
  77. web_hardware_error="$(dmesg|grep -i error|wc -l)" 
  78. web_info_error="$(dmesg|grep -i error)" 
  79. ##开机启动的错误信息  
  80. #hardware error log  
  81. hard_worklog='/usr/local/monitor/logs/hard_work_log' 
  82. hard_downlog='/usr/local/monitor/logs/hard_down_log' 
  83. #message service  
  84. web_message_error_count="$(awk '/"$(date +%Y%m%d)"/' /var/log/messages|grep -i error|wc -l)"  
  85. web_message_error="$(awk '/"$(date +%Y%m%d)"/' /var/log/messages|grep -i error)"  
  86. ##日志的错误信息  
  87. #message error log  
  88. message_worklog='/usr/local/monitor/logs/message_work_log' 
  89. message_downlog='/usr/local/monitor/logs/message_down_log' 
  90. #user service  
  91. web_user_count="$(/usr/bin/who|wc -l)" 
  92. web_user_info="$(/usr/bin/who)" 
  93. ##当前登录的用户值  
  94. #user  log  
  95. user_worklog='/usr/local/monitor/logs/user_work_log' 
  96. user_downlog='/usr/local/monitor/logs/user_down_log' 
  97. #disk service  
  98. alert_disk='80' 
  99. web_disk="$(/bin/df -H|sort -k5nr|grep -vE 'Filesystem|tmpfs|cdrom'|awk '{print $5 " " $1}')"  
  100. web_disk_use=$(echo $web_disk|awk '{print $1}'|cut -d '%' -f1)  
  101. web_disk_partition=$(echo $web_disk|awk '{print $2}')  
  102. #硬盘使用率  
  103. #disk log  
  104. disk_worklog='/usr/local/monitor/logs/disk_work_log' 
  105. disk_downlog='/usr/local/monitor/logs/disk_down_log' 
  106. #cpu log  
  107. cpu_worklog='/usr/local/monitor/logs/cpu_work_log' 
  108. cpu_downlog='/usr/local/monitor/logs/cpu_down_log' 
  109. #notification mail  
  110. email='denglei@ctfo.com' 
  111. ##报警的接收人  
  112. #monitor  
  113. if [ ! -d "$loghere" ];then  
  114.     mkdir $loghere  
  115. fi  
  116. #check web service  
  117. if [ $web_http -ge 1 ];then  
  118.     echo "$now ShengFen: $here Server: $web_name Ip: $web_ip Service: http Monitor_Server: $monitor_name is working" >> $worklog-$day  
  119.     /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $service_table values ('','$here','$web_name','$web_ip','$monitor_name','web_http','working',now())";  
  120. else  
  121.     /etc/init.d/httpd start  
  122.     echo "$now ShengFen: $here Server: $web_name Ip: $web_ip Service: http Monitor_Server: $monitor_name is down"|/bin/mail -s "Notification ShengFen: $here Server: $web_name Service:  http  was a problem" $email  
  123.     echo "$now ShengFen: $here Server: $web_name Ip: $web_ip Service: http Monitor_Server: $montior_name is down" >> $downlog-$day  
  124.     /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $service_table values ('','$here','$web_name','$web_ip','$monitor_name','web_http','downing',now())";  
  125. fi  
  126.  
  127. if [ $tomcat -ge 1 ];then  
  128.     echo "$now ShengFen: $here Server: $web_name Ip: $web_ip Service: tomcat Monitor_Server: $monitor_name is working" >> $worklog-$day  
  129.     /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $service_table values ('','$here','$web_name','$web_ip','$monitor_name','tomcat','working',now())";  
  130. else  
  131.     /usr/local/monitor/shell/web_tomcat.sh  
  132.   echo "$now ShengFen: $here Server: $web_name Ip: $web_ip Service: tomcat Monitor_Server: $monitor_name is down"|/bin/mail -s "Notification ShengFen: $here Server: $web_name Service:  tomcat  was a problem" $email   
  133.   echo "$now ShengFen: $here Server: $web_name Ip: $web_ip Service: tomcat Monitor_Server: $montior_name is down" >> $downlog-$day  
  134.     /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $service_table values ('','$here','$web_name','$web_ip','$monitor_name','tomcat','downing',now())";  
  135. fi  
  136. if [ $yz_tomcat -ge 1 ];then  
  137.     echo "$now ShengFen: $here Server: $web_name Service: Ip: $web_ip yz_tomcat Monitor_Server: $monitor_name is working" >> $worklog-$day  
  138.     /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $service_table values ('','$here','$web_name','$web_ip','$monitor_name','yz_tomcat','working',now())";  
  139. else  
  140.     /usr/local/monitor/shell/web_yz_tomcat.sh  
  141.   echo "$now ShengFen: $here Server: $web_name Service: Ip: $web_ip yz_tomcat Monitor_Server: $monitor_name is down"|/bin/mail -s "Notification ShengFen: $here Server: $web_name Service:  yz_tomcat  was a problem" $email   
  142.   echo "$now ShengFen: $here Server: $web_name Service: Ip: $web_ip yz_tomcat Monitor_Server: $montior_name is down" >> $downlog-$day  
  143.     /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $service_table values ('','$here','$web_name','$web_ip','$monitor_name','yz_tomcat','downing',now())";  
  144. fi  
  145. #check cpu_idle  
  146. if [ $web_cpu -ge $alert_cpu ];then  
  147.     echo "$now ShengFen: $here Server: $web_name Ip: $web_ip Service: cpu_idle Monitor_Server: $monitor_name Cpu_use: $web_cpu"|/bin/mail -s "Notification ShengFen: $here Server: $web_name Service: cpu_use  was Exceed Threshold value: 80%" $email  
  148.     echo "$now ShengFen: $here Server: $web_name Ip: $web_ip Service: cpu_idle Monitor_Server: $monitor_name Cpu_use: $web_cpu" >> $cpu_downlog-$day  
  149.     /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $cpu_table values ('','$here','$web_name','$web_ip','$monitor_name','cpu_use','$alert_cpu','$web_cpu','abnormal',now())";  
  150. else  
  151.     echo "$now ShengFen: $here Server: $web_name Ip: $web_ip Service: cpu_idle Monitor_Server: $monitor_name Cpu_use: $web_cpu" >> $cpu_worklog-$day  
  152.     /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $cpu_table values ('','$here','$web_name','$web_ip','$monitor_name','cpu_use','$alert_cpu','$web_cpu','normal',now())";  
  153. fi  
  154. #check memory  
  155. if [ $web_mem -le $alert_mem ];then  
  156.         echo "$now ShengFen: $here Server: $web_name Ip: $web_ip Service: memory Monitor_Server: $monitor_name Free_mem: $web_mem"|/bin/mail -s "Notification ShengFen: $here Server: $web_name Service: memory  was Exceed Threshold value" $email  
  157.         echo "$now ShengFen: $here Server: $web_name Ip: $web_ip Service: memory Monitor_Server: $monitor_name Free_mem: $web_mem" >> $memory_downlog-$day  
  158.         /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $memory_table values ('','$here','$web_name','$web_ip','$monitor_name','memory','$alert_mem','$web_mem','abnormal',now())";  
  159. else  
  160.         echo "$now ShengFen: $here Server: $web_name Ip: $web_ip Service: memory Monitor_Server: $monitor_name Free_mem: $web_mem" >> $memory_worklog-$day  
  161.         /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $memory_table values ('','$here','$web_name','$web_ip','$monitor_name','memory','$alert_mem','$web_mem','normal',now())";  
  162. fi  
  163. #check swap  
  164. if [ $web_swap -gt $alert_swap ];then  
  165.         echo "$now ShengFen: $here Server: $web_name Ip: $web_ip Service: swap Monitor_Server: $monitor_name Swap_web: $web_swap"|/bin/mail -s "Notification ShengFen: $here Server: $web_name Service: swap Ip: $web_ip was Exceed Threshold value" $email  
  166.         echo "$now ShengFen: $here Server: $web_name Ip: $web_ip Service: swap Monitor_Server: $monitor_name Swap_web: $web_swap" >> $memory_downlog-$day  
  167.         /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database  -e "insert into $memory_table values ('','$here','$web_name','$web_ip','$monitor_name','swap','$alert_swap','$web_swap','abnormal',now())";  
  168. else  
  169.         echo "$now ShengFen: $here Server: $web_name Ip: $web_ip Service: swap Monitor_Server: $monitor_name Swap_web: $web_swap" >> $memory_worklog-$day  
  170.         /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $memory_table values ('','$here','$web_name','$web_ip','$monitor_name','swap','$alert_swap','$web_swap','normal',now())";  
  171. fi  
  172. #check load_15  
  173. if [ $web_load -ge $alert_load ];then  
  174.         echo "$now ShengFen: $here Server: $web_name Ip: $web_ip Service: load_15 Monitor_Server: $monitor_name Load_use: $web_load_15"|/bin/mail -s "Notification ShengFen: $here Server: $web_name Service: load_15 Ip: $web_ip was Exceed Threshold value" $email  
  175.         echo "$now ShengFen: $here Server: $web_name Ip: $web_ip Service: load_15 Monitor_Server: $monitor_name Load_use: $web_load_15" >> $load_downlog-$day  
  176.         /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $load_table values ('','$here','$web_name','$web_ip','$monitor_name','load_15','$alert_load','$web_load_15','abnormal',now())";  
  177. else  
  178.         echo "$now ShengFen: $here Server: $server Ip: $ip Service: load Monitor_Server: $monitor_name Load_use: $web_load_15" >> $load_worklog-$day  
  179.         /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $load_table values ('','$here','$web_name','$web_ip','$monitor_name','load_15','$alert_load','$web_load_15','normal',now())";  
  180. fi  
  181. #check io_idle  
  182. if [ $web_io_idle -ge $alert_io ];then  
  183.         echo "$now ShengFen: $here Server: $web_name Ip: $web_ip Service: io_idle Monitor_Server: $monitor_name Io_use: $web_io_idle"|/bin/mail -s "Notification ShengFen: $here Server: $web_name Service: io_use  was Exceed Threshold value: 80%" $email  
  184.         echo "$now ShengFen: $here Server: $web_name Ip: $web_ip Service: io_idle Monitor_Server: $monitor_name Io_use: $web_io_idle" >> $io_downlog-$day  
  185.         /usr/bin/mysql  -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $io_table values ('','$here','$web_name','$web_ip','$monitor_name','io_use','$alert_io','$web_io_idle','abnormal',now())";  
  186. else  
  187.         echo "$now ShengFen: $here Server: $web_name Ip: $web_ip Service: io_idle Monitor_Server: $monitor_name Io_use: $web_io_idle" >> $io_worklog-$day  
  188.         /usr/bin/mysql  -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $io_table values ('','$here','$web_name','$web_ip','$monitor_name','io_use','$alert_io','$web_io_idle','normal',now())";  
  189. fi  
  190. #check hareware error info  
  191. if [ $web_hardware_error -gt 0 ];then  
  192.         echo "$now ShengFen: $here Server: $web_name Ip: $web_ip Service: hardware_error Monitor_Server: $monitor_name Error: $web_info_error"|/bin/mail -s "Notification ShengFen: $here Server: $web_name Service: hardware_error  were some hardware imformation error" $email  
  193.         echo "$now ShengFen: $here Server: $web_name Ip: $web_ip Service: hardware_error Monitor_Server: $monitor_name Error: $web_info_error" >> $hard_downlog-$day  
  194.         /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $hardware_table values ('','$here','$web_name','$web_ip','$monitor_name','hardware_error','0','$web_hardware_error','abnormal',now())";  
  195. else  
  196.         echo "$now ShengFen: $here Server: $web_name Ip: $web_ip Service: hardware_error Monitor_Server: $monitor_name Error: Nothing" >> $hard_worklog-$day  
  197.         /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $hardware_table values ('','$here','$web_name','$web_ip','$monitor_name','hardware_error','0','$web_hardware_error','normal',now())";  
  198. fi  
  199. #check message error  
  200. if [ $web_message_error_count -ge 1 ];then  
  201.         echo "$now ShengFen: $here Server: $web_name Ip: $web_ip Service: message_error Monitor_Server: $monitor_name Message_error: $web_message_error"|/bin/mail -s "Notification ShengFen: $here Server: $web_name Service: message_error  were some message imformation error" $email  
  202.         echo "$now ShengFen: $here Server: $web_name Ip: $web_ip Service: message_error Monitor_Server: $monitor_name Message_error: $web_message_error" >> $message_downlog-$day  
  203.         /usr/bin/mysql-h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $message_table values ('','$here','$web_name','$web_ip','$monitor_name','message_error','1','$web_message_error_count','abnormal',now())";  
  204. else  
  205.         echo "$now ShengFen: $here Server: $web_name Ip: $web_ip Service: message_error Monitor_Server: $monitor_name Message_error: Nothing" >> $message_worklog-$day  
  206.         /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database  -e "insert into $message_table values ('','$here','$web_name','$web_ip','$monitor_name','message_error','1','$web_message_error_count','normal',now())";  
  207. fi  
  208. #check user  
  209. if [ $web_user_count -ge 3 ];then  
  210.         echo "$now ShengFen: $here Server: $web_name Ip: $web_ip Service: user Monitor_Server: $monitor_name User: $web_user_info"|/bin/mail -s "Notification ShengFen: $here Server: $web_name  Service: user  was Exceed Threshold value: 3" $email  
  211.         echo "$now ShengFen: $here Server: $web_name Ip: $web_ip Service: user Monitor_Server: $monitor_name User: $web_user_info" >> $user_downlog-$day  
  212.         /usr/bin/mysql  -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $user_table values ('','$here','$web_name','$web_ip','$monitor_name','user','3','$web_user_count','abnormal',now())";  
  213. else  
  214.         echo "$now ShengFen: $here Server: $web_name Ip: $web_ip Service: user Monitor_Server: $monitor_name User: normal" >> $user_worklog-$day  
  215.         /usr/bin/mysql  -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $user_table values ('','$here','$web_name','$web_ip','$monitor_name','user','3','$web_user_count','normal',now())";  
  216. fi  
  217. #check disk  
  218. if [ $web_disk_use -ge $alert_disk ];then  
  219.         echo "$now ShengFen: $here Server: $web_name Ip: $web_ip Service: disk_use Monitor_Server: $monitor_name Disk_use: $web_disk_partition ($web_disk_use%)"|/bin/mail -s "Warning!!! $here Server: $web_name Service: disk_use  was Exceed Threshold value : $alert_disk% " $email  
  220.         echo "$now ShengFen: $here Server: $web_name Ip: $web_ip Service: disk_use Monitor_Server: $monitor_name Disk_use: $web_disk_partion ($web_disk_use%)" >> $disk_downlog-$day  
  221.         /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database  -e "insert into $disk_table values ('','$here','$web_name','$web_ip','$monitor_name','disk_use','$alert_disk','$web_disk_partition','$web_disk_use','abnormal',now())";  
  222. else  
  223.         echo "$now ShengFen: $here Server: $web_name Ip: $web_ip Service: disk_use Monitor_Server: $monitor_name Disk_use: $web_disk_partition ($web_disk_use%)" >> $disk_worklog-$day  
  224.         /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database  -e "insert into $disk_table values ('','$here','$web_name','$web_ip','$monitor_name','disk_use','$alert_disk','$web_disk_partition','$web_disk_use','normal',now())";  
  225. fi  
2)交换服务器(以甘肃交换为例,解释内容参照甘肃web)
 
  1. #!/bin/bash  
  2. #ip  
  3. jh_ip=$(/sbin/ifconfig eth0|grep "inet addr"|cut -d : -f 2|awk '{print $1}')  
  4. #name  
  5. jh_name=$(hostname)  
  6. monitor_name=jiaohuan 
  7. here='gansu' 
  8. #mysql info  
  9. mysql_ip='1.1.1.1' 
  10. mysql_username='root' 
  11. mysql_passwd='****' 
  12. mysql_database='monitor' 
  13. memory_table=''$here'_memory'  
  14. load_table=''$here'_load'  
  15. io_table=''$here'_io'  
  16. hardware_table=''$here'_hardware'  
  17. message_table=''$here'_message'  
  18. user_table=''$here'_user'  
  19. disk_table=''$here'_disk'  
  20. cpu_table=''$here'_cpu'  
  21. service_table=''$here'_service'  
  22. #date and log  
  23. day="$(date +%Y%m%d)" 
  24. worklog='/usr/local/monitor/logs/all_work_log' 
  25. downlog='/usr/local/monitor/logs/all_down_log' 
  26. now="$(date +%Y-%m-%d-%T)" 
  27. loghere='/usr/local/monitor/logs' 
  28. #jiaohuan service  
  29. pas="$(ps -ef|grep pas|grep -v grep|grep -v ppas|wc -l)" 
  30. ppas="$(ps -ef|grep ppas|grep -v grep|wc -l)" 
  31. cas="$(ps -ef|grep cas|grep -v grep|wc -l)" 
  32. mas="$(ps -ef|grep mas|grep -v grep|grep -v mmas|wc -l)" 
  33. mmas="$(ps -ef|grep mmas|grep -v grep|wc -l)" 
  34. #cpu service  
  35. alert_cpu='80' 
  36. jh_cpu_idle="$(top -b -n 1 | grep Cpu | awk '{print $5}' | cut -f 1 -d .)" 
  37. jh_cpu="$(echo 100 - $jh_cpu_idle|/usr/bin/bc)" 
  38. #memory service  
  39. alert_mem='100' 
  40. jh_mem="$(/usr/bin/free -m|grep Mem|awk '{print $4}')" 
  41. jh_swap="$(/usr/bin/free -m|grep Swap|awk '{print $3}')" 
  42. alert_swap='0' 
  43. #memory log  
  44. memory_worklog='/usr/local/monitor/logs/mem_work_log' 
  45. memory_downlog='/usr/local/monitor/logs/mem_down_log' 
  46. #load service  
  47. cpu_count="$(grep -c 'model name' /proc/cpuinfo)" 
  48. alert_load="$(echo $cpu_count/2|/usr/bin/bc)" 
  49. jh_load="$(uptime|awk '{print $NF}'|cut -f 1 -d .)" 
  50. jh_load_15="$(uptime|awk '{print $NF}')" 
  51. #load log  
  52. load_worklog='/usr/local/monitor/logs/load_work_log' 
  53. load_downlog='/usr/local/monitor/logs/load_down_log' 
  54. #io service  
  55. alert_io='80' 
  56. jh_io_idle_back="$(/usr/bin/iostat|awk 'NR==4{print $NF}'|cut -f 1 -d .)" 
  57. jh_io_idle="$(echo 100 - $jh_io_idle_back|/usr/bin/bc)" 
  58. #io log  
  59. io_worklog='/usr/local/monitor/logs/io_work_log' 
  60. io_downlog='/usr/local/monitor/logs/io_down_log' 
  61. #hardware service  
  62. jh_hardware_error="$(dmesg|grep -i error|wc -l)" 
  63. jh_info_error="$(dmesg|grep -i error)" 
  64. #hardware error log  
  65. hard_worklog='/usr/local/monitor/logs/hard_work_log' 
  66. hard_downlog='/usr/local/monitor/logs/hard_down_log' 
  67. #message service  
  68. jh_message_error_count="$(awk '/"$(date +%Y%m%d)"/' /var/log/messages|grep -i error|wc -l)"  
  69. jh_message_error="$(awk '/"$(date +%Y%m%d)"/' /var/log/messages|grep -i error)"  
  70. #message error log  
  71. message_worklog='/usr/local/monitor/logs/message_work_log' 
  72. message_downlog='/usr/local/monitor/logs/message_down_log' 
  73. #user service  
  74. jh_user_count="$(/usr/bin/who|wc -l)" 
  75. jh_user_info="$(/usr/bin/who)" 
  76. #user  log  
  77. user_worklog='/usr/local/monitor/logs/user_work_log' 
  78. user_downlog='/usr/local/monitor/logs/user_down_log' 
  79. #disk service  
  80. alert_disk='80' 
  81. jh_disk="$(/bin/df -H|sort -k5nr|grep -vE 'Filesystem|tmpfs|cdrom'|awk '{print $5 " " $1}')"  
  82. jh_disk_use=$(echo $jh_disk|awk '{print $1}'|cut -d '%' -f1)  
  83. jh_disk_partition=$(echo $jh_disk|awk '{print $2}')  
  84. #disk log  
  85. disk_worklog='/usr/local/monitor/logs/disk_work_log' 
  86. disk_downlog='/usr/local/monitor/logs/disk_down_log' 
  87. #cpu log  
  88. cpu_worklog='/usr/local/monitor/logs/cpu_work_log' 
  89. cpu_downlog='/usr/local/monitor/logs/cpu_down_log' 
  90. #notification mail  
  91. email='denglei@ctfo.com' 
  92. #monitor  
  93. if [ ! -d "$loghere" ];then  
  94.     mkdir $loghere  
  95. fi  
  96. #monitor  
  97. #jiaohuan check  
  98. if [ $pas -ge 1 ];then  
  99.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: pas Monitor_Server: $monitor_name is working" >> $worklog-$day  
  100.     /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $service_table values ('','$here','$jh_name','$jh_ip','$monitor_name','pas','working',now())";  
  101. else  
  102.                 /usr/local/lbs/bin4.0.7.7/pas -daemon  
  103.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: pas Monitor_Server: $monitor_name is down"|/bin/mail -s "Notification ShengFen: $here Server: $jh_name Service:  pas  was a problem" $email  
  104.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: pas Monitor_Server: $montior_name is down" >> $downlog-$day  
  105.     /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $service_table values ('','$here','$jh_name','$jh_ip','$monitor_name','pas','downing',now())";  
  106. fi  
  107. if [ $ppas -ge 1 ];then  
  108.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: ppas Monitor_Server: $monitor_name is working" >> $worklog-$day  
  109.     /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $service_table values ('','$here','$jh_name','$jh_ip','$monitor_name','ppas','working',now())";  
  110. else  
  111.                 /usr/local/lbs/bin4.0.7.7/ppas -daemon  
  112.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: ppas Monitor_Server: $monitor_name is down"|/bin/mail -s "Notification ShengFen: $here Server: $jh_name Service:  ppas  was a problem" $email  
  113.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: ppas Monitor_Server: $montior_name is down" >> $downlog-$day  
  114.     /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $service_table values ('','$here','$jh_name','$jh_ip','$monitor_name','ppas','downing',now())";  
  115. fi  
  116. if [ $mas -ge 1 ];then  
  117.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: mas Monitor_Server: $monitor_name is working" >> $worklog-$day  
  118.     /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $service_table values ('','$here','$jh_name','$jh_ip','$monitor_name','mas','working',now())";  
  119. else  
  120.                 /usr/local/lbs/bin4.0.7.7/mas -daemon  
  121.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: mas Monitor_Server: $monitor_name is down"|/bin/mail -s "Notification ShengFen: $here Server: $jh_name Service:  mas  was a problem" $email  
  122.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: mas Monitor_Server: $montior_name is down" >> $downlog-$day  
  123.     /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $service_table values ('','$here','$jh_name','$jh_ip','$monitor_name','mas','downing',now())";  
  124. fi  
  125. if [ $mmas -ge 1 ];then  
  126.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: mmas Monitor_Server: $monitor_name is working" >> $worklog-$day  
  127.     /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $service_table values ('','$here','$jh_name','$jh_ip','$monitor_name','mmas','working',now())";  
  128. else  
  129.                 /usr/local/lbs/bin4.0.7.7/mmas -daemon  
  130.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: mmas Monitor_Server: $monitor_name is down"|/bin/mail -s "Notification ShengFen: $here Server: $jh_name Service:  mmas  was a problem" $email  
  131.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: mmas Monitor_Server: $montior_name is down" >> $downlog-$day  
  132.     /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $service_table values ('','$here','$jh_name','$jh_ip','$monitor_name','mmas','downing',now())";  
  133. fi  
  134. if [ $cas -ge 1 ];then  
  135.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: cas Monitor_Server: $monitor_name is working" >> $worklog-$day  
  136.     /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $service_table values ('','$here','$jh_name','$jh_ip','$monitor_name','cas','working',now())";  
  137. else  
  138.                 /usr/local/lbs/bin4.0.7.7/cas -daemon  
  139.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: cas Monitor_Server: $monitor_name is down"|/bin/mail -s "Notification ShengFen: $here Server: $jh_name Service:  cas  was a problem" $email  
  140.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: cas Monitor_Server: $montior_name is down" >> $downlog-$day  
  141.     /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $service_table values ('','$here','$jh_name','$jh_ip','$monitor_name','cas','downing',now())";  
  142. fi  
  143. #check cpu_idle  
  144. if [ $jh_cpu -ge $alert_cpu ];then  
  145.     echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: cpu_idle Monitor_Server: $monitor_name Cpu_use: $jh_cpu"|/bin/mail -s "Notification ShengFen: $here Server: $jh_name Service: cpu_use  was Exceed Threshold value: 80%" $email  
  146.     echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: cpu_idle Monitor_Server: $monitor_name Cpu_use: $jh_cpu" >> $cpu_downlog-$day  
  147.     /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $cpu_table values ('','$here','$jh_name','$jh_ip','$monitor_name','cpu_use','$alert_cpu','$jh_cpu','abnormal',now())";  
  148. else  
  149.     echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: cpu_idle Monitor_Server: $monitor_name Cpu_use: $jh_cpu" >> $cpu_worklog-$day  
  150.     /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $cpu_table values ('','$here','$jh_name','$jh_ip','$monitor_name','cpu_use','$alert_cpu','$jh_cpu','normal',now())";  
  151. fi  
  152. #check memory  
  153. if [ $jh_mem -le $alert_mem ];then  
  154.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: memory Monitor_Server: $monitor_name Free_mem: $jh_mem"|/bin/mail -s "Notification ShengFen: $here Server: $jh_name Service: memory  was Exceed Threshold value" $email  
  155.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: memory Monitor_Server: $monitor_name Free_mem: $jh_mem" >> $memory_downlog-$day  
  156.         /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $memory_table values ('','$here','$jh_name','$jh_ip','$monitor_name','memory','$alert_mem','$jh_mem','abnormal',now())";  
  157. else  
  158.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: memory Monitor_Server: $monitor_name Free_mem: $jh_mem" >> $memory_worklog-$day  
  159.         /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $memory_table values ('','$here','$jh_name','$jh_ip','$monitor_name','memory','$alert_mem','$jh_mem','normal',now())";  
  160. fi  
  161. #check swap  
  162. if [ $jh_swap -gt $alert_swap ];then  
  163.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: swap Monitor_Server: $monitor_name Swap_jh: $jh_swap"|/bin/mail -s "Notification ShengFen: $here Server: $jh_name Service: swap Ip: $jh_ip was Exceed Threshold value" $email  
  164.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: swap Monitor_Server: $monitor_name Swap_jh: $jh_swap" >> $memory_downlog-$day  
  165.         /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database  -e "insert into $memory_table values ('','$here','$jh_name','$jh_ip','$monitor_name','swap','$alert_swap','$jh_swap','abnormal',now())";  
  166. else  
  167.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: swap Monitor_Server: $monitor_name Swap_jh: $jh_swap" >> $memory_worklog-$day  
  168.         /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $memory_table values ('','$here','$jh_name','$jh_ip','$monitor_name','swap','$alert_swap','$jh_swap','normal',now())";  
  169. fi  
  170. #check load_15  
  171. if [ $jh_load -ge $alert_load ];then  
  172.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: load_15 Monitor_Server: $monitor_name Load_use: $jh_load_15"|/bin/mail -s "Notification ShengFen: $here Server: $jh_name Service: load_15 Ip: $jh_ip was Exceed Threshold value" $email   
  173.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: load_15 Monitor_Server: $monitor_name Load_use: $jh_load_15" >> $load_downlog-$day  
  174.         /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $load_table values ('','$here','$jh_name','$jh_ip','$monitor_name','load_15','$alert_load','$jh_load_15','abnormal',now())";  
  175. else  
  176.         echo "$now ShengFen: $here Server: $server Ip: $ip Service: load Monitor_Server: $monitor_name Load_use: $jh_load_15" >> $load_worklog-$day  
  177.         /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $load_table values ('','$here','$jh_name','$jh_ip','$monitor_name','load_15','$alert_load','$jh_load_15','normal',now())";  
  178. fi  
  179. #check io_idle  
  180. if [ $jh_io_idle -ge $alert_io ];then  
  181.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: io_idle Monitor_Server: $monitor_name Io_use: $jh_io_idle"|/bin/mail -s "Notification ShengFen: $here Server: $jh_name Service: io_use  was Exceed Threshold value: 80%" $email  
  182.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: io_idle Monitor_Server: $monitor_name Io_use: $jh_io_idle" >> $io_downlog-$day  
  183.         /usr/bin/mysql  -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $io_table values ('','$here','$jh_name','$jh_ip','$monitor_name','io_use','$alert_io','$jh_io_idle','abnormal',now())";  
  184. else  
  185.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: io_idle Monitor_Server: $monitor_name Io_use: $jh_io_idle" >> $io_worklog-$day  
  186.         /usr/bin/mysql  -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $io_table values ('','$here','$jh_name','$jh_ip','$monitor_name','io_use','$alert_io','$jh_io_idle','normal',now())";  
  187. fi  
  188. #check hareware error info  
  189. if [ $jh_hardware_error -gt 0 ];then  
  190.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: hardware_error Monitor_Server: $monitor_name Error: $jh_info_error"|/bin/mail -s "Notification ShengFen: $here Server: $jh_name Service: hardware_error  were some hardware imformation error" $email  
  191.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: hardware_error Monitor_Server: $monitor_name Error: $jh_info_error" >> $hard_downlog-$day  
  192.         /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $hardware_table values ('','$here','$jh_name','$jh_ip','$monitor_name','hardware_error','0','$jh_hardware_error','abnormal',now())";  
  193. else  
  194.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: hardware_error Monitor_Server: $monitor_name Error: Nothing" >> $hard_worklog-$day  
  195.         /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $hardware_table values ('','$here','$jh_name','$jh_ip','$monitor_name','hardware_error','0','$jh_hardware_error','normal',now())";  
  196. fi  
  197. #check message error  
  198. if [ $jh_message_error_count -ge 1 ];then  
  199.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: message_error Monitor_Server: $monitor_name Message_error: $jh_message_error"|/bin/mail -s "Notification ShengFen: $here Server: $jh_name Service: message_error  were some message imformation error" $email  
  200.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: message_error Monitor_Server: $monitor_name Message_error: $jh_message_error" >> $message_downlog-$day  
  201.         /usr/bin/mysql-h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $message_table values ('','$here','$jh_name','$jh_ip','$monitor_name','message_error','1','$jh_message_error_count','abnormal',now())";  
  202. else  
  203.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: message_error Monitor_Server: $monitor_name Message_error: Nothing" >> $message_worklog-$day  
  204.         /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database  -e "insert into $message_table values ('','$here','$jh_name','$jh_ip','$monitor_name','message_error','1','$jh_message_error_count','normal',now())";  
  205. fi  
  206. #check user  
  207. if [ $jh_user_count -ge 3 ];then  
  208.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: user Monitor_Server: $monitor_name User: $jh_user_info"|/bin/mail -s "Notification ShengFen: $here Server: $jh_name  Service: user  was Exceed Threshold value: 3" $email  
  209.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: user Monitor_Server: $monitor_name User: $jh_user_info" >> $user_downlog-$day  
  210.         /usr/bin/mysql  -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $user_table values ('','$here','$jh_name','$jh_ip','$monitor_name','user','3','$jh_user_count','abnormal',now())";  
  211. else  
  212.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: user Monitor_Server: $monitor_name User: normal" >> $user_worklog-$day  
  213.         /usr/bin/mysql  -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $user_table values ('','$here','$jh_name','$jh_ip','$monitor_name','user','3','$jh_user_count','normal',now())";  
  214. fi  
  215. #check disk  
  216. if [ $jh_disk_use -ge $alert_disk ];then  
  217.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: disk_use Monitor_Server: $monitor_name Disk_use: $jh_disk_partition ($jh_disk_use%)"|/bin/mail -s "Warning!!! $here Server: $jh_name Service: disk_use  was Exceed Threshold value : $alert_disk% " $email  
  218.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: disk_use Monitor_Server: $monitor_name Disk_use: $jh_disk_partion ($jh_disk_use%)" >> $disk_downlog-$day  
  219.         /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database  -e "insert into $disk_table values ('','$here','$jh_name','$jh_ip','$monitor_name','disk_use','$alert_disk','$jh_disk_partition','$jh_disk_use','abnormal',now())";  
  220. else  
  221.         echo "$now ShengFen: $here Server: $jh_name Ip: $jh_ip Service: disk_use Monitor_Server: $monitor_name Disk_use: $jh_disk_partition ($jh_disk_use%)" >> $disk_worklog-$day  
  222.         /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database  -e "insert into $disk_table values ('','$here','$jh_name','$jh_ip','$monitor_name','disk_use','$alert_disk','$jh_disk_partition','$jh_disk_use','normal',now())";  
  223. fi  





 本文转自 reinxu 51CTO博客,原文链接:http://blog.51cto.com/dl528888/1035131,如需转载请自行联系原作者


相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
3月前
|
Shell Linux
shell 脚本常用于自动化执行文件备份与压缩的任务
shell 脚本常用于自动化执行文件备份与压缩的任务
28 1
|
3月前
|
Unix Shell Linux
在Unix/Linux操作系统中,Shell脚本广泛用于自动化任务
在Unix/Linux操作系统中,Shell脚本广泛用于自动化任务
26 2
|
3月前
|
关系型数据库 MySQL PHP
|
4天前
|
PHP
web简易开发——通过php与HTML+css+mysql实现用户的登录,注册
web简易开发——通过php与HTML+css+mysql实现用户的登录,注册
|
2月前
|
监控 关系型数据库 MySQL
PHP与MySQL的结合:实现局域网上网行为监控软件的数据库管理
在当今信息化时代,网络安全日益成为重要的话题。为了有效监控和管理局域网上网行为,开发一个基于PHP和MySQL的数据库管理系统是一个理想的选择。本文将介绍如何结合PHP和MySQL,开发一款简单而高效的局域网上网行为监控软件,并重点关注数据库管理方面的实现。
184 0
|
3月前
|
存储 运维 Shell
Shell内置命令大全,Linux运维工程师收藏!
Shell内置命令大全,Linux运维工程师收藏!
161 0
Shell内置命令大全,Linux运维工程师收藏!
|
3月前
|
运维 Linux 网络安全
利用群晖NAS+shell脚本实现运维命令执行结果文件自动上传
利用群晖NAS+shell脚本实现运维命令执行结果文件自动上传
122 0
|
3月前
|
关系型数据库 MySQL BI
python报表自动化系列 - 通过Python使用MySQL数据库
python报表自动化系列 - 通过Python使用MySQL数据库
75 0
|
3月前
|
存储 Shell
Shell编程自动化之if、for、while和函数
本文主要介绍了Shell编程自动化之if、for、while和函数,并结合实例测试。
27 3
|
3月前
|
Shell Windows Perl
Shell编程自动化之数学运算与条件测试
本文主要介绍了Shell编程自动化之数学运算与条件测试,并结合实例测试。
25 0