Database Connector (php+MySQL)

Using this connector, you can collect selected aggregated data from your database in your KPI Watchdog profile. Installation requires only basic technical skills (knowledge of your database structure is a plus)

2-steps set-up:

  1. Install DB connector on your server- Open DB connector in text editor (e.g. Notepad), fill in the information in REQUIRED section  and copy this file to any folder on your server accessible from web. You can also rename this file to increase security.  
  2. In your KPIwatchdog.com account, create new data source where you will need URL location of connector and optionally also the API key. Then you will be able to create the individual KPIs using the simple SQL query builder built-in in the website.


Note: As stated in Privacy Policy, we do not require, store nor have access to any sensitive credentials (e.g. password) for your data sources. If your data source does not have an API in place, we provide the tools to create it on your side (e.g. DB Connector for websites with MySQL database). Such tools create read-only API and are authenticated via the special API key. You are never asked to submit your database credentials or password directly on the KPIwatchdog.com website.

Detailed guide:

Installation

Fill in the information in DB CONFIG section of db_connector.php and copy this file to any folder on your server accessible from web. Optionaly you can edit SECURITY CONFIG section. You can also rename this file in order to increase security.

Database settings

  • KPIW_DB_TYPE: currently we only support MySQL databases for this connector but MariaDB should also work with MySQL driver.
  • KPIW_DB_HOST: IP address of your database server.
  • KPIW_DB_NAME: database name.
  • KPIW_DB_USERNAME: username of your database user.
  • KPIW_DB_PASSWORD: password of your database user.
  • KPIW_DB_CHARSET: character set used for database connection.

For increased security, we recommend you to create a new read-only user with restricted acess to desired tables/columns. You can also use Views in MySQL to prepare stored queries you want to read using this DB Connector and allow your database user to read these Views only.

Security settings

  • ALLOW_LOOPBACK_IP: allow access from localhost (127.0.0.1) for testing purposes
  • ALLOW_PRIVATE_IP: allow access from LAN (private network IPs) for testing purposes
  • API_REQUIRE_HTTPS: allow access outside LAN only using HTTPS protocol (SSL must be installed on the server)
  • API_KEY: optional API key (use the same key in your DB Connector settings on kpiwatchdog.com)

Security features

  • You are the only person knowing DB connector URL (security through obscurity).
  • Access is restricted only to KPI Watchdog IP address.
  • You may require secret API key (kind of password you set on both sides- in KPI Watchdog settings and in DB Connector).
  • You may require encrypted connection (HTTPS).
  • Input data are sanitized.

See also our video tutorial:

Feedback and Knowledge Base