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
Hashes for robotframework_listener_icinga-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff397df1c3d40cce48c358a2a428741b9401b05675f58415d09a45c7c4332c60 |
|
MD5 | 0fec53dc807de3c2b8733b0f418e8380 |
|
BLAKE2b-256 | 63770e8604c98d1e3834d5c718f5680221fa8bbc9d15bc351d51a5002a8c15f4 |
Hashes for robotframework_listener_icinga-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9352ced0db3255549399f47dca310d8b884c01614e1ce6e3ee2df9208035bfc8 |
|
MD5 | 2eee21ed0e11aa78697eb1c40c88bfc7 |
|
BLAKE2b-256 | b039d98c851217879d8548a8c8daf0af9ec8dae2174fd59b23fd1df31bf7c6c8 |