(5)数据库服务器(以甘肃数据库为例,脚本解释参照甘肃
web)
- #!/bin/bash
- #ip
- db_ip=$(/sbin/ifconfig eth0|grep "inet addr"|cut -d : -f 2|awk '{print $1}')
- #name
- db_name=$(hostname)
- monitor_name=database
- here='gansu'
- #mysql info
- mysql_ip='1.1.1.1'
- mysql_username='root'
- mysql_passwd='****'
- mysql_database='monitor'
- memory_table=''$here'_memory'
- load_table=''$here'_load'
- io_table=''$here'_io'
- hardware_table=''$here'_hardware'
- message_table=''$here'_message'
- user_table=''$here'_user'
- disk_table=''$here'_disk'
- cpu_table=''$here'_cpu'
- service_table=''$here'_service'
- #date and log
- day="$(date +%Y%m%d)"
- worklog='/usr/local/monitor/logs/all_work_log'
- downlog='/usr/local/monitor/logs/all_down_log'
- now="$(date +%Y-%m-%d-%T)"
- loghere='/usr/local/monitor/logs'
- #cpu service
- alert_cpu='80'
- db_cpu_idle="$(top -b -n 1 | grep Cpu | awk '{print $5}' | cut -f 1 -d .)"
- db_cpu="$(echo 100 - $db_cpu_idle|/usr/bin/bc)"
- #memory service
- alert_mem='100'
- db_mem="$(/usr/bin/free -m|grep Mem|awk '{print $4}')"
- db_swap="$(/usr/bin/free -m|grep Swap|awk '{print $3}')"
- alert_swap='0'
- #memory log
- memory_worklog='/usr/local/monitor/logs/mem_work_log'
- memory_downlog='/usr/local/monitor/logs/mem_down_log'
- #load service
- cpu_count="$(grep -c 'model name' /proc/cpuinfo)"
- alert_load="$(echo $cpu_count/2|/usr/bin/bc)"
- db_load="$(uptime|awk '{print $NF}'|cut -f 1 -d .)"
- db_load_15="$(uptime|awk '{print $NF}')"
- #load log
- load_worklog='/usr/local/monitor/logs/load_work_log'
- load_downlog='/usr/local/monitor/logs/load_down_log'
- #io service
- alert_io='80'
- db_io_idle_back="$(/usr/bin/iostat|awk 'NR==4{print $NF}'|cut -f 1 -d .)"
- db_io_idle="$(echo 100 - $db_io_idle_back|/usr/bin/bc)"
- #io log
- io_worklog='/usr/local/monitor/logs/io_work_log'
- io_downlog='/usr/local/monitor/logs/io_down_log'
- #hardware service
- db_hardware_error="$(dmesg|grep -i error|wc -l)"
- db_info_error="$(dmesg|grep -i error)"
- #hardware error log
- hard_worklog='/usr/local/monitor/logs/hard_work_log'
- hard_downlog='/usr/local/monitor/logs/hard_down_log'
- #message service
- db_message_error_count="$(awk '/"$(date +%Y%m%d)"/' /var/log/messages|grep -i error|wc -l)"
- db_message_error="$(awk '/"$(date +%Y%m%d)"/' /var/log/messages|grep -i error)"
- #message error log
- message_worklog='/usr/local/monitor/logs/message_work_log'
- message_downlog='/usr/local/monitor/logs/message_down_log'
- #user service
- db_user_count="$(/usr/bin/who|wc -l)"
- db_user_info="$(/usr/bin/who)"
- #user log
- user_worklog='/usr/local/monitor/logs/user_work_log'
- user_downlog='/usr/local/monitor/logs/user_down_log'
- #disk service
- alert_disk='80'
- db_disk="$(/bin/df -H|sort -k5nr|grep -vE 'Filesystem|tmpfs|cdrom'|awk '{print $5 " " $1}')"
- db_disk_use=$(echo $db_disk|awk '{print $1}'|cut -d '%' -f1)
- db_disk_partition=$(echo $db_disk|awk '{print $2}')
- #disk log
- disk_worklog='/usr/local/monitor/logs/disk_work_log'
- disk_downlog='/usr/local/monitor/logs/disk_down_log'
- #cpu log
- cpu_worklog='/usr/local/monitor/logs/cpu_work_log'
- cpu_downlog='/usr/local/monitor/logs/cpu_down_log'
- #notification mail
- email='[email protected]'
- #monitor
- if [ ! -d "$loghere" ];then
- mkdir $loghere
- fi
- #check cpu_idle
- #check cpu_idle
- if [ $db_cpu -ge $alert_cpu ];then
- echo "$now ShengFen: $here Server: $db_name Ip: $db_ip Service: cpu_idle Monitor_Server: $monitor_name Cpu_use: $db_cpu"|/bin/mail -s "Notification ShengFen: $here Server: $db_name Service: cpu_use was Exceed Threshold value: 80%" $email
- echo "$now ShengFen: $here Server: $db_name Ip: $db_ip Service: cpu_idle Monitor_Server: $monitor_name Cpu_use: $db_cpu" >> $cpu_downlog-$day
- /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $cpu_table values ('','$here','$db_name','$db_ip','$monitor_name','cpu_use','$alert_cpu','$db_cpu','abnormal',now())";
- else
- echo "$now ShengFen: $here Server: $db_name Ip: $db_ip Service: cpu_idle Monitor_Server: $monitor_name Cpu_use: $db_cpu" >> $cpu_worklog-$day
- /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $cpu_table values ('','$here','$db_name','$db_ip','$monitor_name','cpu_use','$alert_cpu','$db_cpu','normal',now())";
- fi
- #check memory
- if [ $db_mem -le $alert_mem ];then
- echo "$now ShengFen: $here Server: $db_name Ip: $db_ip Service: memory Monitor_Server: $monitor_name Free_mem: $db_mem"|/bin/mail -s "Notification ShengFen: $here Server: $db_name Service: memory was Exceed Threshold value" $email
- echo "$now ShengFen: $here Server: $db_name Ip: $db_ip Service: memory Monitor_Server: $monitor_name Free_mem: $db_mem" >> $memory_downlog-$day
- /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $memory_table values ('','$here','$db_name','$db_ip','$monitor_name','memory','$alert_mem','$db_mem','abnormal',now())";
- else
- echo "$now ShengFen: $here Server: $db_name Ip: $db_ip Service: memory Monitor_Server: $monitor_name Free_mem: $db_mem" >> $memory_worklog-$day
- /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $memory_table values ('','$here','$db_name','$db_ip','$monitor_name','memory','$alert_mem','$db_mem','normal',now())";
- fi
- #check swap
- if [ $db_swap -gt $alert_swap ];then
- echo "$now ShengFen: $here Server: $db_name Ip: $db_ip Service: swap Monitor_Server: $monitor_name Swap_db: $db_swap"|/bin/mail -s "Notification ShengFen: $here Server: $db_name Service: swap Ip: $db_ip was Exceed Threshold value" $email
- echo "$now ShengFen: $here Server: $db_name Ip: $db_ip Service: swap Monitor_Server: $monitor_name Swap_db: $db_swap" >> $memory_downlog-$day
- /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $memory_table values ('','$here','$db_name','$db_ip','$monitor_name','swap','$alert_swap','$db_swap','abnormal',now())";
- else
- echo "$now ShengFen: $here Server: $db_name Ip: $db_ip Service: swap Monitor_Server: $monitor_name Swap_db: $db_swap" >> $memory_worklog-$day
- /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $memory_table values ('','$here','$db_name','$db_ip','$monitor_name','swap','$alert_swap','$db_swap','normal',now())";
- fi
- #check load_15
- if [ $db_load -ge $alert_load ];then
- echo "$now ShengFen: $here Server: $db_name Ip: $db_ip Service: load_15 Monitor_Server: $monitor_name Load_use: $db_load_15"|/bin/mail -s "Notification ShengFen: $here Server: $db_name Service: load_15 Ip: $db_ip was Exceed Threshold value" $email
- echo "$now ShengFen: $here Server: $db_name Ip: $db_ip Service: load_15 Monitor_Server: $monitor_name Load_use: $db_load_15" >> $load_downlog-$day
- /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $load_table values ('','$here','$db_name','$db_ip','$monitor_name','load_15','$alert_load','$db_load_15','abnormal',now())";
- else
- echo "$now ShengFen: $here Server: $server Ip: $ip Service: load Monitor_Server: $monitor_name Load_use: $db_load_15" >> $load_worklog-$day
- /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $load_table values ('','$here','$db_name','$db_ip','$monitor_name','load_15','$alert_load','$db_load_15','normal',now())";
- fi
- #check io_idle
- if [ $db_io_idle -ge $alert_io ];then
- echo "$now ShengFen: $here Server: $db_name Ip: $db_ip Service: io_idle Monitor_Server: $monitor_name Io_use: $db_io_idle"|/bin/mail -s "Notification ShengFen: $here Server: $db_name Service: io_use was Exceed Threshold value: 80%" $email
- echo "$now ShengFen: $here Server: $db_name Ip: $db_ip Service: io_idle Monitor_Server: $monitor_name Io_use: $db_io_idle" >> $io_downlog-$day
- /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $io_table values ('','$here','$db_name','$db_ip','$monitor_name','io_use','$alert_io','$db_io_idle','abnormal',now())";
- else
- echo "$now ShengFen: $here Server: $db_name Ip: $db_ip Service: io_idle Monitor_Server: $monitor_name Io_use: $db_io_idle" >> $io_worklog-$day
- /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $io_table values ('','$here','$db_name','$db_ip','$monitor_name','io_use','$alert_io','$db_io_idle','normal',now())";
- fi
- #check hareware error info
- if [ $db_hardware_error -gt 0 ];then
- echo "$now ShengFen: $here Server: $db_name Ip: $db_ip Service: hardware_error Monitor_Server: $monitor_name Error: $db_info_error"|/bin/mail -s "Notification ShengFen: $here Server: $db_name Service: hardware_error were some hardware imformation error" $email
- echo "$now ShengFen: $here Server: $db_name Ip: $db_ip Service: hardware_error Monitor_Server: $monitor_name Error: $db_info_error" >> $hard_downlog-$day
- /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $hardware_table values ('','$here','$db_name','$db_ip','$monitor_name','hardware_error','0','$db_hardware_error','abnormal',now())";
- else
- echo "$now ShengFen: $here Server: $db_name Ip: $db_ip Service: hardware_error Monitor_Server: $monitor_name Error: Nothing" >> $hard_worklog-$day
- /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $hardware_table values ('','$here','$db_name','$db_ip','$monitor_name','hardware_error','0','$db_hardware_error','normal',now())";
- fi
- #check message error
- if [ $db_message_error_count -ge 1 ];then
- echo "$now ShengFen: $here Server: $db_name Ip: $db_ip Service: message_error Monitor_Server: $monitor_name Message_error: $db_message_error"|/bin/mail -s "Notification ShengFen: $here Server: $db_name Service: message_error were some message imformation error" $email
- echo "$now ShengFen: $here Server: $db_name Ip: $db_ip Service: message_error Monitor_Server: $monitor_name Message_error: $db_message_error" >> $message_downlog-$day
- /usr/bin/mysql-h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $message_table values ('','$here','$db_name','$db_ip','$monitor_name','message_error','1','$db_message_error_count','abnormal',now())";
- else
- echo "$now ShengFen: $here Server: $db_name Ip: $db_ip Service: message_error Monitor_Server: $monitor_name Message_error: Nothing" >> $message_worklog-$day
- /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $message_table values ('','$here','$db_name','$db_ip','$monitor_name','message_error','1','$db_message_error_count','normal',now())";
- fi
- #check user
- if [ $db_user_count -ge 3 ];then
- echo "$now ShengFen: $here Server: $db_name Ip: $db_ip Service: user Monitor_Server: $monitor_name User: $db_user_info"|/bin/mail -s "Notification ShengFen: $here Server: $db_name Service: user was Exceed Threshold value: 3" $email
- echo "$now ShengFen: $here Server: $db_name Ip: $db_ip Service: user Monitor_Server: $monitor_name User: $db_user_info" >> $user_downlog-$day
- /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $user_table values ('','$here','$db_name','$db_ip','$monitor_name','user','3','$db_user_count','abnormal',now())";
- else
- echo "$now ShengFen: $here Server: $db_name Ip: $db_ip Service: user Monitor_Server: $monitor_name User: normal" >> $user_worklog-$day
- /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $user_table values ('','$here','$db_name','$db_ip','$monitor_name','user','3','$db_user_count','normal',now())";
- fi
- #check disk
- if [ $db_disk_use -ge $alert_disk ];then
- echo "$now ShengFen: $here Server: $db_name Ip: $db_ip Service: disk_use Monitor_Server: $monitor_name Disk_use: $db_disk_partition ($db_disk_use%)"|/bin/mail -s "Warning!!! $here Server: $db_name Service: disk_use was Exceed Threshold value : $alert_disk% " $email
- echo "$now ShengFen: $here Server: $db_name Ip: $db_ip Service: disk_use Monitor_Server: $monitor_name Disk_use: $db_disk_partion ($db_disk_use%)" >> $disk_downlog-$day
- /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $disk_table values ('','$here','$db_name','$db_ip','$monitor_name','disk_use','$alert_disk','$db_disk_partition','$db_disk_use','abnormal',now())";
- else
- echo "$now ShengFen: $here Server: $db_name Ip: $db_ip Service: disk_use Monitor_Server: $monitor_name Disk_use: $db_disk_partition ($db_disk_use%)" >> $disk_worklog-$day
- /usr/bin/mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "insert into $disk_table values ('','$here','$db_name','$db_ip','$monitor_name','disk_use','$alert_disk','$db_disk_partition','$db_disk_use','normal',now())";
- fi
注意:
web、交换、引擎服务器里监控内容除了资源监控(如硬盘、io、cpu、用户
、负载、日志错误信息、登录硬件错误信息、内存),还包括应用服务监控,而备用与数据库服务器的监控没有应用服务器监控,只有资源监控。
6
、mysql数据库内容与解释
之前的
shell监控脚本部署完成后,会在监控的时候,把监控的数据一部分写入到本机的日志里,另外一个部分写入到mysql数据库,所以在mysql里会专门的建立一个数据库与数据表,接收shell监控写入的数据。
(
1)数据库表名的结构
数据表有
10个,分别是cpu、disk、hardware、io、load、memory、message、service、user、device。在创建各自省份的时候,会在表名前加入省份名称中文拼音,比如像创建甘肃省的cpu表,在数据库里找个表名为gansu_cpu。
A、
cpu、hardware、io、load、memory、message、user这些表的字段一样,内容为:
- 字段 类型 解释
- id int(10) 编号,主要为监控此服务的次数
- province varchar(30) 省份名称
- server varchar(30) 监控主机名称,主要是监控主机hostname的名称
- ip varchar(20) 监控主机的ip
- monitor_server varchar(30) 监控主机的类型,我这里分别有web、交换、引擎、备用、数据库
- service varchar(20) 监控的服务名称
- alert int(10) 监控服务的阀值
- value int(10) 监控服务的当前值
- status varchar(10) 监控服务器的状态,normal与abnormal
- date datetime 监控服务的时间
下面是我的
mysql数据库里甘肃cpu截图
B、
disk数据表的内容
- 字段 类型 解释
- id int(10) 编号,主要为监控此服务的次数
- province varchar(30) 省份名称
- server varchar(30) 监控主机名称,主要是监控主机hostname的名称
- ip varchar(20) 监控主机的ip
- monitor_server varchar(30) 监控主机的类型,我这里分别有web、交换、引擎、备用、数据库
- service varchar(20) 监控的服务名称
- alert int(10) 监控服务的阀值
- partition varchar(30) 最大硬盘的分区名称
- value int(10) 监控服务的当前值
- status varchar(10) 监控服务器的状态,normal与abnormal
- date datetime 监控服务的时间
下面是我的
mysql里甘肃disk的截图
C、
service数据表的内容
- 字段 类型 解释
- id int(10) 编号,主要为监控此服务的次数
- province varchar(30) 省份名称
- server varchar(30) 监控主机名称,主要是监控主机hostname的名称
- ip varchar(20) 监控主机的ip
- monitor_server varchar(30) 监控主机的类型,我这里分别有web、交换、引擎、备用、数据库
- service varchar(20) 监控的服务名称
- status varchar(10) 监控服务器的状态,normal与abnormal
- date datetime 监控服务的时间
下面是我的
mysql数据库里甘肃service截图
D、
device
- 字段 类型 解释
- id int(10) 编号,主要为监控此服务的次数
- name varchar(255) 设备的名称
- ip varchar(30) 设备的ip
- mac varchar(30) 设备的mac
- type varchar(30) 设备的类型
- jifang_name varchar(255) 机房的名称
- raw_name varchar(255) 机架的名称
- raw_location varchar(45) 机架的位置
- assets_code varchar(30) 财产编号
- state varchar(30) 设备状态
- price int(10) 设备的架构
下面是我的
device数据表的截图
(
2)数据库的建立
我建立的数据库为
monitor,创建的语句为:
create database monitor;
(
3)数据库表的建立
数据表建立有
2个方式:
1、使用
create_database.sh脚本建立,脚本内容如下:
- #!/bin/bash
- #mysql info
- mysql_ip='1.1.1.1'
- ##数据库的ip
- mysql_username='root'
- ##数据库的登录用户
- mysql_passwd='****'
- ##数据库的登录密码
- mysql_database='monitor'
- ##需要登录的数据库
- here='gansu'
- ##创建数据库的省份名称
- memory_table=''$here'_memory'
- load_table=''$here'_load'
- io_table=''$here'_io'
- hardware_table=''$here'_hardware'
- message_table=''$here'_message'
- user_table=''$here'_user'
- disk_table=''$here'_disk'
- cpu_table=''$here'_cpu'
- service_table=''$here'_service'
- ##创建数据库的表名
- #create table memory
- mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "create table $memory_table(id int(10) not null primary key auto_increment,province varchar(30) not null,server varchar(30) not null,ip varchar(20) not null,monitor_server varchar(30) not null,service varchar(20) not null,alert int(10) not null,value int(10) not null,status varchar(10) not null,date datetime)ENGINE=InnoDB DEFAULT CHARSET=utf8;"
- #create table load
- mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "create table $load_table(id int(10) not null primary key auto_increment,province varchar(30) not null,server varchar(30) not null,ip varchar(20) not null,monitor_server varchar(30) not null,service varchar(20) not null,alert int(10) not null,value int(10) not null,status varchar(10) not null,date datetime)ENGINE=InnoDB DEFAULT CHARSET=utf8;"
- #create table io
- mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "create table $io_table(id int(10) not null primary key auto_increment,province varchar(30) not null,server varchar(30) not null,ip varchar(20) not null,monitor_server varchar(30) not null,service varchar(20) not null,alert int(10) not null,value int(10) not null,status varchar(10) not null,date datetime)ENGINE=InnoDB DEFAULT CHARSET=utf8;"
- #create table hardware
- mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "create table $hardware_table(id int(10) not null primary key auto_increment,province varchar(30) not null,server varchar(30) not null,ip varchar(20) not null,monitor_server varchar(30) not null,service varchar(20) not null,alert int(10) not null,value int(10) not null,status varchar(10) not null,date datetime)ENGINE=InnoDB DEFAULT CHARSET=utf8;"
- #create table message
- mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "create table $message_table(id int(10) not null primary key auto_increment,province varchar(30) not null,server varchar(30) not null,ip varchar(20) not null,monitor_server varchar(30) not null,service varchar(20) not null,alert int(10) not null,value int(10) not null,status varchar(10) not null,date datetime)ENGINE=InnoDB DEFAULT CHARSET=utf8;"
- #create table user
- mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "create table $user_table(id int(10) not null primary key auto_increment,province varchar(30) not null,server varchar(30) not null,ip varchar(20) not null,monitor_server varchar(30) not null,service varchar(20) not null,alert int(10) not null,value int(10) not null,status varchar(10) not null,date datetime)ENGINE=InnoDB DEFAULT CHARSET=utf8;"
- #create table disk
- mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "create table $disk_table(id int(10) not null primary key auto_increment,province varchar(30) not null,server varchar(30) not null,ip varchar(20) not null,monitor_server varchar(30) not null,service varchar(20) not null,alert int(10) not null,partition varchar(30) not null,value int(10) not null,status varchar(10) not null,date datetime)ENGINE=InnoDB DEFAULT CHARSET=utf8;"
- #create table cpu
- mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "create table $cpu_table(id int(10) not null primary key auto_increment,province varchar(30) not null,server varchar(30) not null,ip varchar(20) not null,monitor_server varchar(30) not null,service varchar(20) not null,alert int(10) not null,value int(10) not null,status varchar(10) not null,date datetime)ENGINE=InnoDB DEFAULT CHARSET=utf8;"
- #create table service
- mysql -h $mysql_ip -u$mysql_username -p$mysql_passwd $mysql_database -e "create table $service_table(id int(10) not null primary key auto_increment,province varchar(30) not null,server varchar(30) not null,ip varchar(20) not null,monitor_server varchar(30) not null,service varchar(20) not null,status varchar(10) not null,date datetime)ENGINE=InnoDB DEFAULT CHARSET=utf8;"
注意:
device这个表我没有在create_database.sh脚本里创建,如果你想使用这个功能,就自己创建这个表。
2、在后头进行添加省份
php监控程序的时候,使用create_province.sh进行创立,这个在后面部分进行说明。
7、
php程序设计的web端的内容与解释
php监控程序主要是通过从
mysql数据库里获得数据,然后在网页里展示数据。
我设计的这个程序主要有
4个功能:
1、资产管理
主要是通过
device数据表进行数据的收集,通过add.php、add_device.php、list_device.php、conn.php、head.php、head_device.php进行数据的输入与展示。
2、监控详情
主要是通过各自省份的数据表进行数据的采集,比如进行甘肃省分的采集,需要用到的数据表有
gansu_cpu、gansu_disk、gansu_io、gansu_load、gansu_hardware、gansu_message、gansu_memory、gansu_user、gansu_service,通过list.php、gansu.php(各自省份的都有各自的php文件,比如广西的为guangxi.php)、conn.php、head.php、province.php进行数据的展示。
3、当日报警
主要是通过各自省份的数据表进行数据的采集,比如进行甘肃省分的采集,需要用到的数据表有
gansu_cpu、gansu_disk、gansu_io、gansu_load、gansu_hardware、gansu_message、gansu_memory、gansu_user、gansu_service,通过warn.php、gansu_warn.php(各自省份的都有各自的php文件,比如广西的为guangxi_warn.php)、conn.php、head.php、warn_province.php。
下一篇文章地址:
运维自动化之使用PHP+MYSQL+SHELL打造私有监控系统(五)
http://dl528888.blog.51cto.com/2382721/1035252