Skip to content
Raman Sailopal edited this page Jul 12, 2021 · 13 revisions

Setup Guide - With Grafana/Prometheus (to view metrics)

  1. Install Grafana - https://grafana.com/docs/grafana/latest/installation/
  2. Install Prometheus - https://prometheus.io/docs/prometheus/latest/installation/
  3. Run the YottaDB metrics “exporter” by following the instructions here https://github.com/RamSailopal/yotta-dashboard/blob/main/README.md
  4. Add the extract found at https://raw.githubusercontent.com/RamSailopal/yotta-dashboard/main/prometheus.yml to the prometheus.yml config file in /etc/prometheus. Change the IP address and port to the address/port of the server where the “exporter” is running accordingly.
  5. Start Prometheus
  6. Start Grafana and log into the web interface (default port is 3000, default username and password is admin/admin)
  7. Click on the cog icon on the left hand side representing configuration, then Data Sources and Add Data Source. Select the Prometheus data source. Name it and then enter the URL. Click Save and Test to ensure it is working.
  8. Click on the four square boxes icon on the left hand side representing Dashboards. Click Manage and then Import. Paste the JSON found here - https://raw.githubusercontent.com/RamSailopal/yotta-dashboard/main/examples/Yottadb-grafana.json to the json panel. Click Load.
  9. A dashboard will then be created showing Orders, Sets and Gets metrics. To add further metrics, click on the add panel icon, then click the Metrics “drop down” option in the Query section, ensuring that Prometheus is selected as the data source. All the metrics exported from YottaDB should now appear for selection to chart in a panel.

Additional Setup = With Loki/Promtail (to view YottaDB system logs)

  1. Attain the latest copy of Loki - e.g. curl -O -L "https://github.com/grafana/loki/releases/download/v2.2.1/loki-linux-amd64.zip
  2. Unzip the file to attain the executable - unzip "loki-linux-amd64.zip"
  3. Give the executable file executable permissions - chmod a+x "loki-linux-amd64"
  4. Move the executable file to an executable system path and rename to loki - mv "loki-linux-amd64" "/usr/local/bin/loki"
  5. Create a configuration directory for Loki - mkdir "/etc/Loki"
  6. Copy the configuration yaml file cp "loki.yaml" "/etc/loki"
  7. Amend the configuration file with the correct IP address accordingly
  8. Create a systemd service file - cp "systemd/loki.service" "/usr/lib/systemd/system/loki.service"
  9. Attain the latest copy of Promtail - e.g. curl -O -L "https://github.com/grafana/loki/releases/download/v2.2.1/promtail-linux-arm64.zip"
  10. Unzip the file to attain the executable - unzip "promtail-linux-amd64.zip"
  11. Give the executable file executable permissions - chmod a+x "promtail-linux-amd64"
  12. Move the executable file to an executable system path and rename to loki - mv "promtail-linux-amd64" "/usr/local/bin/promtail"
  13. Create a configuration directory for Loki - mkdir "/etc/promtail"
  14. Copy the configuration yaml file cp "promtail.yaml" "/etc/promtail"
  15. Create a systemd service file - cp "systemd/promtail.service" "/usr/lib/systemd/system/promtail.service"
  16. Reload the systemd daemon - systemctl daemon-reload
  17. Start the Loki service - systemctl start loki
  18. Start the Promtail service - systemctl start promtail
  19. Add the JSON from https://raw.githubusercontent.com/RamSailopal/YottaDB-dashboard/main/examples/Yottadb-graf-loki.yaml to create a new dashboard (as instructed earlier)

Optional Integration with M-Gateway logs

  1. Add the promtail-mgsi.yaml contents to /etc/promtail/promtail.yaml - cat promtail-mgsi.yaml >> /etc/promtail/promtail.yaml
  2. Restart the Promtail service - systemctl restart promtail
  3. Run install-mgsi.sh to install and run the %zmgsi("log") global export daemon - ./install.mgsi.sh
  4. Add a new panel to the dashboard with Loki as the Query source and the label as filename=/var/log/mgsi.log

Adding API dashboard

  1. Install the infinity Grafana datasource by accessing the command line of the server running Grafana and executing grafana-cli plugins install yesoreyeram-infinity-datasource
  2. On the Grafana GUI, access datasources in the same way as previously covered and add an infinity datasource
  3. Enter the URL of the endpoint as e.g. http://<< ipaddress of api server >>:<< port of api server >>/routines
  4. Click Save and Test
  5. Repeat the process of adding additional Infinity datasources for each for of the endpoints i.e. /globals, /locks etc.
  6. Import the dashboard https://raw.githubusercontent.com/RamSailopal/YottaDB-dashboard/main/apiserver/apidash.json in the same way as previously covered
  7. A second dashboard should now be available with the name - YottaDB1