在 Ubuntu 上监控 IBM Informix 数据库状态,通常可以从 操作系统层面 和 Informix 自身工具 两个维度来做。下面按常见、实用方式来说明。
onstat(最核心)Informix 自带监控命令,需在 informix 用户下执行。
su - informix
onstat -
常用示例:
onstat - # 数据库整体状态(Online/Quiescent/Offline)
onstat -g ses # 当前会话
onstat -g sql # 正在执行的 SQL
onstat -g con # 连接情况
onstat -g lo # 锁情况
onstat -g mem # 内存使用
onstat -d # 数据库空间(dbspace)
onstat -l # 日志状态
oncheck(检查完整性)oncheck -pr # 检查 root dbspace
oncheck -pe # 查看 extent 使用
ontape / onbar(备份状态)onstat -g arc # 查看归档状态
ps -ef | grep oninit
top -u informix
htop
Informix 主进程是
oninit
netstat -anp | grep 1526
ss -tanp | grep oninit
df -h
iostat -x 1
free -h
vmstat 1
默认路径(视安装而定):
$INFORMIXDIR/tmp/online.log
实时监控:
tail -f $INFORMIXDIR/tmp/online.log
journalctl -u informix
/var/log/syslog
例如每 5 分钟记录状态:
*/5 * * * * su - informix -c "onstat - > /var/log/inf_status.log"
onstatoninit 进程是否存在onstat - 返回状态| 状态 | 含义 |
|---|---|
| Online | 正常运行 |
| Quiescent | 只读模式 |
| Offline | 已停止 |
| Recovery | 恢复中 |
onstat - # 是否 Online
onstat -g ses # 会话数
onstat -g lo # 是否锁等待
onstat -d # 空间是否满
tail online.log # 报错
如果你愿意,可以告诉我:
我可以给你一套 可直接用的监控脚本或 Zabbix 模板。