Oracle Database 监控:zabbix(一)
https://github.com/netrusov/ZabbixDBA# unzip ZabbixDBA-master.zip
# mkdir /opt/zdba
# cp -r ZabbixDBA-master/* /opt/zdba
# cd /opt/zdba
# cp init.d/zdba /etc/init.d/
# chmod 755 /etc/init.d/zdba
# chkconfig --add zdba
# su - oracle
$ sqlplus / as sysdba
SQL> create user zabbix identified by zabbix default tablespace system temporary tablespace temp profile default account unlock;
SQL> grant connect to zabbix;
SQL> grant resource to zabbix;
SQL> alter user zabbix default role all;
SQL> grant select any table to zabbix;
SQL> grant create session to zabbix;
SQL> grant select any dictionary to zabbix;
SQL> grant unlimited tablespace to zabbix;
SQL> grant select any dictionary to zabbix;
SQL> grant select on v_$session to zabbix;
SQL> grant select on v_$system_event to zabbix;
SQL> grant select on v_$event_name to zabbix;
SQL> grant select on v_$recovery_file_dest to zabbix;
# vi conf/config.pl
{
zabbix => {
host => '192.168.40.35',
port => 10051,
timeout => 30,
},
daemon => {
sleep => 60,
split_logs => 1
},
db => {
default => {
user => 'zabbix',
pass => 'zabbix',
query_list => 'query.props.pl',
sleep => 60,
retry_step => 1,
},
list => ,
ambdb01 => {
dsn => 'DBI:Oracle:host=192.168.40.41;port=1521;sid=amb01',
query_list => ,
sleep => 60,
},
},
}
安装perl模块
# cat cpanfile
requires "Carp" => "0";
requires "Data::Dumper" => "0";
requires "DBI" => "0";
requires "English" => "0";
requires "FindBin" => "0";
requires "forks" => "0";
requires "IO::Socket::INET" => "0";
requires "JSON" => "0";
requires "Log::Any::Adapter::Log4perl" => "0";
requires "Log::Log4perl" => "0";
requires "Moo" => "0";
requires "perl" => "5.010";
requires "strict" => "0";
requires "Time::HiRes" => "0";
requires "warnings" => "0";
https://metacpan.org
# tar zxvf Carp-1.50.tar.gz
# cd Carp-1.50
# perl Makefile.PL
# make
# make install
# tar zxvf Data-Dumper-2.161.tar.gz
# cd Data-Dumper-2.161
# perl Makefile.PL
# make
# make install
# tar zxvf DBI-1.637.tar.gz
# cd DBI-1.637
# perl Makefile.PL
# make
# make install
# tar zxvf forks-0.36.tar.gz
# cd forks-0.36
# perl Makefile.PL
# make
# make install
# tar zxvf IO-1.39.tar.gz
# cd IO-1.39
# perl Makefile.PL
# make
# make install
# tar zxvf JSON-2.97001.tar.gz
# cd JSON-2.97001
# perl Makefile.PL
# make
# make install
# tar zxvf Log-Any-Adapter-Log4perl-0.09.tar.gz
# cd Log-Any-Adapter-Log4perl-0.09
# perl Makefile.PL
# make
# make install
# tar zxvf Log-Log4perl-1.49.tar.gz
# cd Log-Log4perl-1.49
# perl Makefile.PL
# make
# make install
# tar zxvf Module-Runtime-0.016.tar.gz
# cd Module-Runtime-0.016
# perl Makefile.PL
# make
# make install
# tar zxvf Moo-2.003004.tar.gz
# cd Moo-2.003004
# perl Makefile.PL
# make
# make install
# tar zxvf Time-HiRes-1.9758.tar.gz
# cd Time-HiRes-1.9758
# perl Makefile.PL
# make
# make install
# tar zxvf List-MoreUtils-0.428.tar.gz
# cd List-MoreUtils-0.428
# perl Makefile.PL
# make
# make install
# tar zxvf Exporter-Tiny-1.002001.tar.gz
# cd Exporter-Tiny-1.002001
# perl Makefile.PL
# make
# make install
# tar zxvf Sys-SigAction-0.23.tar.gz
# cd Sys-SigAction-0.23
# perl Makefile.PL
# make
# make install
# tar zxvf Acme-Damn-0.08.tar.gz
# cd Acme-Damn-0.08
# perl Makefile.PL
# make
# make insall
# rpm -ivh oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm
# rpm -ivh oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm
# rpm -ivh oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.rpm
# vim /root/.bash_profile
export ORACLE_HOME=/usr/lib/oracle/11.2/client64
export PATH=$PATH:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib:/usr/local/lib
# source /root/.bash_profile
# tar zxvf DBD-Oracle-1.74.tar.gz
# cd DBD-Oracle-1.74
# perl Makefile.PL
# make
# make install
崩溃中......
# yum install -y perl-CPAN
# perl -MCPAN -e shell
cpan> install Log::Any::Adapter
cpan> install Devel::GlobalDestruction
cpan> install Role::Tiny
# service zdba start
Starting ZabbixDBA service:ZabbixDBA started
# cat /opt/zdba/log/zdba.log
starting ZabbixDBA (version 3.2.0)
starting thread for database 'ambdb01'
# cat /opt/zdba/log/ambdb01.log
starting monitoring of 'ambdb01'
connected to 'DBI:Oracle:host=192.168.40.41;port=1521;sid=amb01'
completed fetching data on 'ambdb01' (elapsed 4e-06)
Zabbix Server
一,导入模板
二,创建主机并关联模板
三,大功告成
页:
[1]