Skip to main content

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:

screenshot_with_ignore_keywords_ok.png screenshot_with_ignore_keywords_warn.png screenshot_with_ignore_keywords.png screenshot_with_ignore_keywords_performancedata.png

With ignore keywords set ot False:

screenshot_with_keywords.png screenshot_with_keywords_performancedata.png

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.

Metadata

Release files for robotframework-listener-icinga 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for robotframework-listener-icinga 1.0.4
File Size Uploaded
robotframework_listener_icinga-1.0.4.tar.gz 18.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for robotframework-listener-icinga 1.0.4
File Interpreter ABI Platform
robotframework_listener_icinga-1.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 27.1 kB

Release files / robotframework_listener_icinga-1.0.4.tar.gz

Download URL robotframework_listener_icinga-1.0.4.tar.gz
Size 18.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b0f5daa6c5ad7cb79a5f1a9e4218512c37c5f94af8bdd9a666bfa9cb15d7deef
BLAKE2b-256 checksum
How to use checksums
7e209df662310f31d0e73f5b7c95db95877fa9e581b0f254146aefda06fcc0ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release files / robotframework_listener_icinga-1.0.4-py3-none-any.whl

Download URL robotframework_listener_icinga-1.0.4-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
23972a84d105f171bde92509e19a4799110780b67df3bbfa1c2176701be78bf2
BLAKE2b-256 checksum
How to use checksums
c5adbf28a6c7e6fe02cb56f54b38aec59e9e1985a6c98ca76168d004697d835f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.0.12

2 release files

0.0.10

2 release files

0.0.6

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page