再给monitor数据库专门分配个用户来访问.
grant all privileges on monitor.* to 'dbmonitor'@'localhost' identified by '123456';
如果你要监控多个服务器的话,那就要给远程访问权限,命令如下:
grant all privileges on monitor.* to 'dbmonitor'@'%' identified by '123456';
最后刷新让其生效
flush privileges;
$MYSQL "insert into servers(hostname,ip,rootpartion,loadaverage,uptime,memory,Process,time) values('$HOSTNAME','$IP','$DISK','$loadaverage','$UPTIME','$memory','$Process',now())"
else
$MYSQL "update servers set rootpartion='$DISK',loadaverage='$loadaverage',uptime='$UPTIME',memory='$memory',Process='$Process',time=now() where hostname='$HOSTNAME'"