概述
在zabbix5.0版本以上,新增了一个特性,那就是zabbix-agent2,这个是zabbix公司使用go语言重写的一个代理,可以完全替代原来的zabbix-agent。这个代理功能比原来的要强大的多,内置了很多个插件支持对基础资源的监控。这里我选用oracle的插件,来看看zabbix-agent2可以支持监控哪些指标。
安装
安装zabbix-agent2 这里采用zabbix提供的官方repo,进行安装
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
yum insall -y zabbix-agent2
|
配置/etc/zabbix/zabbix_agent2.conf文件,修改Server属性值,运行zabbix服务器对其进行轮询取数 安装oracleInstant 这里也是采用oracle提供的oracleInstant包进行安装
rpm -ivh https://download.oracle.com/otn_software/linux/instantclient/211000/oracle-instantclient-basic-21.1.0.0.0-1.x86_64.rpm
|
设置oracle环境变量
ORACLE_HOME=/usr/lib/oracle/21/client64;export ORACLE_HOME
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib64:$LD_LIBRARY_PATH;export LD_LIBRARY_PATH
|
配置oracle监控账户
创建oracle监控账号以及授权
CREATE USER zabbix_mon IDENTIFIED BY zabbix_pass;
-- Grant access to the zabbix_mon user.
GRANT CONNECT, CREATE SESSION TO zabbix_mon;
GRANT SELECT ON DBA_TABLESPACE_USAGE_METRICS TO zabbix_mon;
GRANT SELECT ON DBA_TABLESPACES TO zabbix_mon;
GRANT SELECT ON DBA_USERS TO zabbix_mon;
GRANT SELECT ON DBA_DATA_FILES TO zabbix_mon;
GRANT SELECT ON DBA_FREE_SPACE TO zabbix_mon;
GRANT SELECT ON DBA_TEMP_FILES to zabbix_mon;
GRANT SELECT ON GV_$SORT_SEGMENT to zabbix_mon;
GRANT SELECT ON V_$ACTIVE_SESSION_HISTORY TO zabbix_mon;
GRANT SELECT ON V_$ARCHIVE_DEST TO zabbix_mon;
GRANT SELECT ON V_$ASM_DISKGROUP TO zabbix_mon;
GRANT SELECT ON V_$DATABASE TO zabbix_mon;
GRANT SELECT ON V_$DATAFILE TO zabbix_mon;
GRANT SELECT ON V_$INSTANCE TO zabbix_mon;
GRANT SELECT ON V_$LOG TO zabbix_mon;
GRANT SELECT ON V_$OSSTAT TO zabbix_mon;
GRANT SELECT ON V_$PGASTAT TO zabbix_mon;
GRANT SELECT ON V_$PARAMETER TO zabbix_mon;
GRANT SELECT ON V_$PROCESS TO zabbix_mon;
GRANT SELECT ON V_$RECOVERY_FILE_DEST TO zabbix_mon;
GRANT SELECT ON V_$RESTORE_POINT TO zabbix_mon;
GRANT SELECT ON V_$RESTORE_POINT TO zabbix_mon;
GRANT SELECT ON V_$SESSION TO zabbix_mon;
GRANT SELECT ON V_$SGASTAT TO zabbix_mon;
GRANT SELECT ON V_$SYSMETRIC TO zabbix_mon;
GRANT SELECT ON V_$SYSTEM_PARAMETER TO zabbix_mon;
GRANT SELECT ON V_$PDBS TO zabbix_mon;
GRANT SELECT ON V_$SYSTEM_PARAMETER to zabbix_mon;
|
配置zabbix-agent2配置文件 为了方便oracle监控管理,建议使用新的配置文件,放置在/etc/zabbix/zabbix_agent2.d钟,配置内容如下:
[root@vcenter zabbix_agent2.d]# cat monitor_oracle.conf
Plugins.Oracle.Sessions.demo.Uri=tcp://172.20.20.150:1521
Plugins.Oracle.Sessions.demo.User=zabbix_mon
Plugins.Oracle.Sessions.demo.Password=zabbix_pass
Plugins.Oracle.Sessions.demo.Service=demopdb
|
配置主机模板
zabbix自带的模板已经有了对Oracle指标的监控,这里我们需要对相应的宏变量进行设置,指向我们的oracle数据库即可。
|