ikzelf / zbxdb

Zabbix database monitoring, the easy and extendable way
GNU General Public License v3.0
94 stars 45 forks source link

Oracle DB Discovery Script #49

Closed Loca5h closed 4 years ago

Loca5h commented 4 years ago

I have a single server which hosts multiple database instances (Oracle 11), I have been trying to use the zbx_discover_oradbs script to identify them all but I have run into a couple of issues.

  1. pseudo-terminal will not be allocated because stdin error is generated running the script. Have added -T to the ssh connection string in zbx_discover_oradbs.py to get round this.

  2. When the script runs it prints : error member server01: 0, {"data":[]}. The cfg is setup as test;;alerts;ssh;username;;;server01

I have put some print statements through zbx_discover_oradbs.py and I can see lsnrctl is being called and the service data is returned but this isn't being converted into a JSON. I'm a a bit of a loss any thoughts?.

Also just to confirm, when multiple DBs are on a single host, each database instance should be a separate host item in zabbix. you cant have multiple databases reporting to a single host. Have tried this and zabbix seems to get quite confused over the data. Thanks

ikzelf commented 4 years ago

I hope to check/correct this by tomorrow. Yes, you are richt about each oracle database translates to one zabbix host, not for every rac instance. For the 12c for the root container. Some databases have over 1k items. A bit much to combine that in one host. (My taste of it)

Loca5h commented 4 years ago

Thanks for the update, once i have this one working i will be moving onto a RAC test so be interested to see how that works. So far though all the hosts i have added manually provide excellent metrics and triggers, so thanks for this great addon.

ikzelf commented 4 years ago

Thanks for the heads up. My main reason for being a bit sloppy about this db discovery thing is that I am not so sure about how smart this is. All db’s are owned by the same discovery rule on a single zabbix host. Accidentally drop that owning host and all your monitored hosts are gone. I mostly use ansible with the zabbix_host module for this.

If you do want an lld like upload for your databases, you might want to take a look at https://github.com/ikzelf/csv-to-lld In the csv you maintain your list of databases to monitor.

An other reason is that if a new db is discovered and added to zabbix, the first ‘nodata’ alert will quickly wake you up since you still have to configure the zbxdb process and the db account. That also can be handled using ansible.

ikzelf commented 4 years ago

Hi, I fixed the script and also found that the header is not very documented but should be site;cluster;alert_group;protocol;user;password;password_enc;members customer13;clus01;oeps;ssh;;;;clus01-node01,clus01-node02

Also added a few verbosity levels to trace what is happening.

Loca5h commented 4 years ago

Morning, sorry for the slow reply. Have tested the updated script this morning, both the SSH TTY error and empty JSON fixed. Script returns the expected data on a Server instance running multiple databases. Thanks!.