A Robot Framework listener for reporting via Icinga2 API.
Project description
A Robot Framework listener for reporting via Icinga2 API.
Free software: Apache Software License 2.0
Installation
If used with rcc.exe see conda.yaml below. Else just install the regular way like this:
pip install robotframework-listener-icinga
You can also install the in-development version with:
pip install https://gitlab.com/dominik.riva/robotframework-listener-icinga/-/archive/main/robotframework-listener-icinga-main.zip
Documentation
The following example uses the rcc.exe from robocorp as a stable platform to run your robot framework scenarios. The robot scenario below is a simple test based on the example-windows-calculator (switched to python in newest commit).
conda.yaml (see - robotframework-listener-icinga)
channels:
# Define conda channels here.
- conda-forge
dependencies:
# Define conda packages here.
# If available, always prefer the conda version of a package, installation will be faster and more efficient.
# https://anaconda.org/search
- python=3.9.13 # https://pyreadiness.org/3.9/
- pip=22.2.2 # https://pip.pypa.io/en/stable/news/
- pip:
# Define pip packages here.
# https://pypi.org/
- rpaframework==26.1.0 # https://rpaframework.org/releasenotes.html
- pip-system-certs==4.0 # required to access system cert store
- robotframework-listener-icinga==1.0.0
robot.yaml (see –listener icinga)
tasks:
Id Based Calculator Demo:
command:
- python
- -m
- robot
- --report
- NONE
- --outputdir
- output
- --logtitle
- Task log
- --listener
- icinga
- tasks.robot
condaConfigFile: conda.yaml
ignoreFiles:
- .gitignore
artifactsDir: output
PATH:
- .
PYTHONPATH:
- .
Robots can be build with robot framework keywords or straight up Python.
tasks.robot (noting about the listener in this file)
*** Settings ***
Library String
Library RPA.Windows
Library Collections
Task Teardown Close Window name:Rechner
*** Keywords ***
Open the Rechner
Windows Search Rechner
#Foreground Window Rechner
Compare result
[Arguments] ${first}
${result}= Get Attribute id:CalculatorResults Name
Should Contain ${result} ${first}
Add two numbers using app ids
[Arguments] ${first} ${second} ${third}
Click id:clearEntryButton
Click id:num${first}Button
Click id:plusButton
Click id:num${second}Button
Click id:equalButton
Log results
Compare result ${third}
Approximate pi
[Arguments] ${first} ${second} ${third}
Click id:clearEntryButton
Send Keys Rechner ${first}
Click id:divideButton
Send Keys Rechner ${second}
Click id:equalButton
Log results
Compare result ${third}
Log results
${result}= Get Attribute id:CalculatorResults Name
Log ${result}
Screenshot Rechner %{ROBOT_ARTIFACTS}${/}${TEST_NAME}id-based-result.png
*** Tasks ***
Addition
Open the Rechner
Add two numbers using app ids 9 5 14
Division
Open the Rechner
Approximate pi 355 113 3.14159292035
devdata\env.json (see ICINGA_* variables)
{
"RPA_SECRET_MANAGER": "RPA.Robocorp.Vault.FileSecrets",
"RPA_SECRET_FILE": "C:\\Users\\USER\\vault.json",
"ICINGA_FQDN": "icinga.example.com",
"ICINGA_HOST_NAME": "testrobot.example.com",
"ICINGA_SERVICE_NAME": "Passive - Robot Framework - example-windows-calculator - Id-Based",
"ICINGA_TTL": "900"
}
C:\Users\USER\vault.json (must match preconfigured Icinga2 API user - pull request for certificate based auth are welcomed)
{
"icinga": {
"api_user": "robotframework",
"api_pass": "ADD_STRONG_PASSWORD"
}
}
Icinga DSL generated by director preview of the host object. The Service “Passive - Robot Framework - example-windows-calculator - Id-Based” the above robot scenario listener is targeting. The variable “robot_framework_thresholds” allows to set thresholds and overwrite robot framework status.
zones.d/master/hosts.conf
object Host "vd418164.example.com" {
import "tpl-host-windows"
import "116-tpl-host-agent"
display_name = "VD418164"
address = "10.6.160.71"
notes = "Robot Framework Entwicklungsroboter"
groups = [ "Monitoring", "Robot Framework Robots" ]
vars["_override_servicevars"] = {
"Icingacli vSphereDB - VM Status" = {
"116_check_icingacli_vspheredb_name" = "VD418164"
}
"Passive - Robot Framework - example-windows-calculator - Id-Based" = {
robot_framework_thresholds = "{\"Tasks.Addition\": {\"warning\": \"0:14000\", \"critical\": \"0:16000\", \"status\": \"PASS\"}, \"Tasks.Division\": {\"warning\": \"0:15000\", \"critical\": \"0:18000\", \"status\": \"PASS\"}, \"Tasks\": {\"warning\": \"0:24000\", \"critical\": \"0:25000\", \"status\": \"PASS\"}}"
}
"Service - MSDTC" = {
service_windows_starttype = "manual"
}
"Service - W32Time" = {
service_windows_starttype = "manual"
}
}
vars.custom_tags = [
"robot-framework_sap",
"robot-framework_isop",
"vspheredb-vm",
"robot-framework_kda",
"robot-framework_meona-pflege",
"robot-framework_meona-arzt",
"robot-framework_patientenportal",
"robot-framework_cardioapp",
"robot-framework_patientenarchivviewer",
"robot-framework_example-windows-calculator"
]
vars.robot_framework_thresholds = "{\"Addition\": {\"warning\": \"0:12\", \"critical\": \"0:15\"}, \"Division\": {\"warning\": \"0:15\", \"critical\": \"0:18\"}, \"Tasks\": {\"warning\": \"0:20\", \"critical\": \"0:25\"}}"
vars.tags = [ "windows" ]
vars.teams = [ "Entwicklung_Monitoring" ]
}
zones.d/master/agent_endpoints.conf
object Endpoint "vd418164.example.com" {
host = "10.6.160.71"
log_duration = 0s
}
zones.d/master/agent_zones.conf
object Zone "vd418164.example.com" {
parent = "master"
endpoints = [ "vd418164.ms.uhbs.ch" ]
}
Screenshots
With ignore keywords set to True:
With ignore keywords set ot False:
Development
Pull request for Tox and pytest very welcomed!
To run all the tests run:
tox
Note, to combine the coverage data from all the tox environments run:
Windows |
set PYTEST_ADDOPTS=--cov-append tox |
---|---|
Other |
PYTEST_ADDOPTS=--cov-append tox |
Changelog
0.0.0 (2023-07-07)
First release on PyPI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file robotframework_listener_icinga-1.0.3.tar.gz
.
File metadata
- Download URL: robotframework_listener_icinga-1.0.3.tar.gz
- Upload date:
- Size: 18.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3514263b39189ccc2ec39d510b4c3bef5e37e035ec4d69537ebbcd9ee63a32f |
|
MD5 | 29ce85e4a7cc75b7cf819317c39e7975 |
|
BLAKE2b-256 | 48b1f2f7ec7e6e6e35583b885aad71547762b4a25e12e85feccdd81e1b352a89 |
File details
Details for the file robotframework_listener_icinga-1.0.3-py3-none-any.whl
.
File metadata
- Download URL: robotframework_listener_icinga-1.0.3-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | daf687bf42cd5169717e503170ca28bdd985f4c91bf40ce34c99f8e25f98bfce |
|
MD5 | b842b467264a2cef0d81ee1bdcb61432 |
|
BLAKE2b-256 | 59d48f5e40c567fc81311b1229b02e599c291935d66d82d8080a59ae22d220ae |