Configure the Python agent
Here we show how to modify a Python program to add Kensu.
Here is the program script.py. This shows the program before we add Kensu.
The content is very simple. Using Pandas, it merges three DataFrames.
In the end, the output is written to a data file.
To include Kensu in your program, follow these steps:
- Create a conf.ini file.
- Init Kensu.
- Modify the libraries imports to import Kensu modules instead.
1️⃣ Create a conf.ini file
The conf.ini file is where you put your credentials and define where the output should go. The output destination is called a Reporter.
The default reporter is the APIReporter. That writes the data to the Kensu cloud. You access the Kensu cloud with the Kensu dashboard.
To send entities to Kensu, you need to add the api_url and your api_token.
2️⃣ Init Kensu in your code
In your code, create a Kensu client. To do that, add the following lines to the script.
This client will use the properties defined in the conf.ini file.
3️⃣ Modify the libraries imports to import Kensu modules
The last step that you need to use Kensu is to modify the import libraries in order to use the Kensu Pandas instead of the base Pandas.
Here is the fully modified version to use Kensu.