Install the library
Here we show how to set up a virtual environment and add the required Python packages.
You need an ingestion Token and the Ingestion API URL. Follow these instructions.
2️⃣ Clone Kensu sample code to try the agent
Clone the repository:
- sample programs: script.py and script_with_kensu.py
- data files in: data
- config file:conf.ini
You need to create a Python virtual environment. This is because on UNIX-based systems, like Mac and Ubuntu, Python 2.x is part of the operating system. So you might get conflicts installing Python packages into that. A virtual environment means one created in the logged-in user's directories instead of system directories.
See below for notes on setting up a virtual environment on Windows
First, you need to install Python 3. On Mac and Windows systems you can just download that from https://www.python.org/downloads/. On Ubuntu 20.04 and greater, it is already installed. If it is not installed the which python command will say nothing.
Install it with:
Check the version with this:
On Linux systems, like Ubuntu and Debian, you also need to install:
Then create a virtual environment using the command below. Do this in your home directory as it will put it there. In this example, we use the name py38, but you can use any name.
Now activate the environment:
To deactivate the environment just type deactivate.
Open the DOS command prompt by running cmd. Create and activate a Python virtual environment like shown below. Here we use the name py310, but you can use any name you like. If it works, the prompt will change to (py310).
After you have sourced the environment created above, add these three Python packages. Kensu is the Kensu-py package. Since it extends Pandas we will install that as well.
For M1 Mac users: if Pandas is not already installed, we advise you to use conda instead of pip.