自动获取服务器系统信息:
创建数据库表(这里没有写入数据库中):
[root@rhel8 shell]# vim audit_audit_system.sql
CREATE TABLE `audit_audit_system`(
`id` int(11) NOT NULL AUTO_INCREMENT,
`ip_info` varchar(50) NOT NULL,
`serv_info` varchar(50) NOT NULL,
`cpu_info` varchar(50) NOT NULL,
`disk_info` varchar(50) NOT NULL,
`mem_info` varchar(50) NOT NULL,
`load_info` varchar(50) NOT NULL,
`mark_info` varchar(50) NOT NULL,
PRIMARY KEY(`id`),
UNIQUE KEY `ip_info`(`ip_info`),
UNIQUE key `ip_info_2`(`ip_info`)`
);
脚本:
[root@rhel8 shell]# cat auto_system_collect.sh
#!/bin/bash
# auto get system info
# by author tanbaobao 2020/06/11
echo -e "