为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。
【DM版本】:dm8
【操作系统】:统信
【CPU】:8c16g
【问题描述】*:老师帮看下这个函数哪里报错了,实在是不明白
function check_dm(){
# 存储使用情况&内存使用情况&CPU 使用情况"
storage=$(df -h)
memory=$(free -g)
cpu=$(uptime)
network=$(ss -autnp | grep ESTA | grep dmserver | tail -n 100)
ports=$(ss -tnlp | egrep "dmserver|asm|css|:22")
processes=$(ps -ef | grep /dm)
error_logs=$(for i infind /dm/log/ -mtime -1 -type f
;do tail -200 $i | grep date +%F
| grep ERROR && echo $i || echo "$ORACLE_SID 无报错信息";done)
export PORT=ss -tnlp | grep dmserver | grep 52 | awk '{print $4}' | cut -d ':' -f4
database_info=$(disql sysdba/'"dameng@"'@localhost:$PORT -e "select status$ as 实例状态 from v$instance; select count(1) as 活跃连接数,vs.user_name from v$sessions vs where vs.state='ACTIVE' group by user_name order by 1 desc limit 10;select count() as 过去24小时内归档文件数 from v$archived_log where first_time > sysdate()-1;"|grep -v data_arrive_process | tail -n+5)
database_info+=$(disql sysdba/'"dameng@"'@localhost:$PORT -e "select summary.,round(USED_MB/TOTAL_MB,4)100||'%' as 表空间使用率 from (select tablespace_name,sum(maxbytes/1024/1024) as TOTAL_MB,sum(bytes/1024/1024) as USED_MB from dba_data_files group by tablespace_name) summary order by 4 desc limit 5;select username,account_status as 用户状态 from dba_users where account_status!= 'OPEN';"|grep -v data_arrive_process | tail -n+5)
database_info+=$(disql sysdba/'"dameng@"'@localhost:$PORT -e "select path as 备份 from v$backup_history order by start_time desc limit 2;select case when count() = 0 then '无' else '有事务等待信息' end as 事务等待情况 from v$trxwait;"|grep -v data_arrive_process | tail -n+5)
}