Grafana and Prometheus deployments for analyzing ibm i system metrics
This project uses Docker Compose to launch two containers: Grafana and Prometheus. Grafana is a popular open-source dashboarding and visualization tool, while Prometheus is a monitoring and alerting toolkit for time series data.
In this architecture, Prometheus collects metrics from two ibm i systems running prometheus-jdbc-exporter and stores them in its time series database. Grafana then retrieves these metrics from Prometheus and displays them in customizable dashboards.
To get started, follow these steps:
-
Install Docker on your system if you haven't already done so. You can find installation instructions for your platform on the Docker website.
-
Clone this repository to your local machine:
git clone https://github.com/ajshedivy/ibmi-system-metrics.git
- Navigate to the repository directory:
cd ibmi-system-metrics/
- Start the containers using Docker Compose:
docker compose up -d
This command will start the containers in the background and leave them running. By default, Prometheus is configured to scrape metrics from the localhost
endpoint. Nativate to http://localhost:9090/targets
to see the list of ibm i exporters running:
You can now access Grafana by opening a web browser and navigating to http://localhost:3000
. Login using the Grafana credentials
- user: admin
- password: grafana
To install a plugin, just find the "Settings" button (a gear icon) on the left-hand pane and go to "Plugins"
Search for "Prometheus" and install the Prometheus plugin from Grafana Labs
Now, you will add your running prometheus deployment as a data source. To do so, go to Grafana configurations and find the "Data sources" option. Click the button to add a data source.
add the url: http://host.docker.internal:9090
host.docker.internal
is a special hostname that can be used to connect from within a Docker container to the host machine's network.
Click "Save and Test" to verify that Grafana can talk to your backend!
Click the Dashboards button on the left-hand navigation pane (looks like four small squares) and click the "import" button.
Upload the json configuration file src\grafana\multi-host-dashboard.json
and click "load".
Now you're visualizing live metric data from two ibm i systems ut33p23
and ut51p41
Feel free to experiment with the dashboard configuration and differenet metrics. I have linked an example python scraper for analyzing the prometheus data in a local python environment. We can utilize the prometheus deplyment endpoint http://localhost:9090/api/v1/query
to query the various metrics. There is also a prometheus client api that we can experiment with which you can install using pip.