glinuz / db2_exporter

Prometheus IBM DB2 exporter
MIT License
17 stars 7 forks source link

Monitoring DB2 with 2 or more Databases #7

Open ahuachacona opened 3 years ago

ahuachacona commented 3 years ago

Hi man, my name is Axel Huachacona. First of all, thank you very much for your work.

Now, if you will allow me, I need some help.

Right now I need to check the status of my DB2 server but inside I have at least 6 different schemas that I use. With just one schema it works perfect but, apparently, the exporter only allows monitoring a single schema (like the SAMPLE schema in your example) but I need to know if it is possible to monitor more than one at the same time without having to raise more than one instance of the exporter.

Is there any possible way to do this?

Thank you again for your work!

I'll leave my environment specifications:

glinuz commented 3 years ago

I need some time to analyze it. No longer working on it。

ahuachacona commented 3 years ago

Hi my friend, I was able to make funcional it by using this method for Windows.

  1. Adding ENV variables to W2. Something like this:

    Name:   CGO_CFLAGS
    Value:  -IC:\PROGRA~1\IBM\SQLLIB\INCLUDE
    
    Name:   CGO_LDFLAGS
    Value:  -LC:\PROGRA~1\IBM\SQLLIB\LIB
    
    Name:   IBM_DB_DIR
    Value:  C:\PROGRA~1\IBM\SQLLIB
    
    Name:   LD_LIBRARY_PATH
    Value:  C:\PROGRA~1\IBM\SQLLIB\LIB
  2. DB2 Update.

    db2 update monitor switches using bufferpool on
    db2 update dbm cfg using DFT_MON_BUFPOOL on
  3. Download master branch on a zip, extract and inside the folder, run the following to build from source.

    go get github.com/glinuz/db2_exporter
    go build github.com/glinuz/db2_exporter
    
    This create an .exe file called 'db2_exporter.exe'.
  4. RUN from command line.

    db2_exporter.exe -log.level debug -dsn "DATABASE=DBNAME;HOSTNAME=localhost;PORT=50000;PROTOCOL=TCPIP;UID=DB2ADMIN;PWD=PASSW0RD!;"

Following this steps, I was able to collect data from my DB2 Server on a Windows machine. Hope this help to somebody else.

Bye and thank you man!

glinuz commented 3 years ago

First, db2_exporter monitor database by query sysibmadm schema,it can get all stats,include all schema in this database.(DB2 struct Instance-->database-->schema). You only need to customize SQL in metrics.toml file.

If you want to monitor more than one database in on DB2 instance,sorry. db2_exporter base on the ODBC,it is not support more than one database.But you can run multi db2_exporter process with different -dsn -port,in one server.

Thank you ,the method for Windows.