txt2cql
txt2cql
is a command-line tool designed to convert input text into a valid Centreon Query Language (CQL) request. The generated CQL is automatically copied to your clipboard, ready to be pasted into the research bar of the resource status page in Centreon.
Installation
Installing pipx
From their documentation:
On macOS:
brew install pipx
pipx ensurepath
sudo pipx ensurepath --global
On Linux:
Ubuntu 23.04 or above
sudo apt update
sudo apt install pipx
pipx ensurepath
sudo pipx ensurepath --global
Fedora:
sudo dnf install pipx
pipx ensurepath
sudo pipx ensurepath --global
Using pip on other distributions:
python3 -m pip install --user pipx
python3 -m pipx ensurepath
sudo pipx ensurepath --global
On Windows:
Install via Scoop:
scoop install pipx
pipx ensurepath
Install via pip (requires pip 19.0 or later)
py -m pip install --user pipx
py -m pipx ensurepath
It is possible (even most likely) the above finishes with a WARNING looking similar to this:
WARNING: The script pipx.exe is installed in `<USER folder>\AppData\Roaming\Python\Python3x\Scripts` which is not on PATH
If so, go to the mentioned folder, allowing you to run the pipx executable directly. Enter the following line (even if you did not get the warning):
.\pipx.exe ensurepath
This will add both the above mentioned path and the %USERPROFILE%.local\bin folder to your search path. Restart your terminal session and verify pipx does run.
Installing txt2cql
pipx install git+https://github.com/CentreonLabs/txt2cql
Export OpenAI API key
For the tool to work, you need to export your OpenAI API key as an environment variable. You can do this by adding the following line to your shell configuration file (e.g., ~/.bashrc
, ~/.zshrc
, etc.):
export OPENAI_API_KEY="your-api-key"
Usage
txt2cql all ping services for all linux hosts
> s.description:ping h.name:linux