Exemplo n.º 1
0
def test_check_master_item(section: jn.Section) -> None:
    assert list(
        jn.check_jenkins_nodes("master", {"jenkins_offline": 2}, section)) == [
            jn.Result(state=jn.State.OK,
                      summary="Description: The Master Jenkins Node"),
            jn.Result(state=jn.State.OK, summary="Is JNLP agent: no"),
            jn.Result(state=jn.State.OK, summary="Is idle: no"),
            jn.Result(state=jn.State.OK,
                      summary="Total number of executors: 20"),
            Metric("jenkins_num_executors", 20),
            jn.Result(state=jn.State.OK,
                      summary="Number of busy executors: 3"),
            Metric("jenkins_busy_executors", 3),
            jn.Result(state=jn.State.OK,
                      summary="Number of idle executors: 17"),
            Metric("jenkins_idle_executors", 17),
            jn.Result(state=jn.State.OK, summary="Mode: Exclusive "),
            jn.Result(state=jn.State.OK, summary="Offline: no"),
            jn.Result(state=jn.State.OK,
                      summary="Average response time: 0 seconds"),
            Metric("avg_response_time", 0.0),
            jn.Result(state=jn.State.OK,
                      summary="Clock difference: 0 seconds"),
            Metric("jenkins_clock", 0.0),
            jn.Result(state=jn.State.OK, summary="Free temp space: 30.3 GiB"),
            Metric("jenkins_temp", 32569888768),
        ]
Exemplo n.º 2
0
def test_check_foo_item(section: jn.Section) -> None:
    assert list(
        jn.check_jenkins_nodes(
            "foo",
            {
                "jenkins_offline": 2,
                "avg_response_time": (1.0, 2.0),
                "jenkins_clock": (3.0, 4.0),
            },
            section,
        )
    ) == [
        jn.Result(state=jn.State.OK,
                  summary="Description: Name: Myname, Ip-Address: 1.1.1.1"),
        jn.Result(state=jn.State.OK, summary="Is JNLP agent: yes"),
        jn.Result(state=jn.State.OK, summary="Is idle: yes"),
        jn.Result(state=jn.State.OK, summary="Total number of executors: 1"),
        Metric("jenkins_num_executors", 1),
        jn.Result(state=jn.State.OK, summary="Number of busy executors: 0"),
        Metric("jenkins_busy_executors", 0),
        jn.Result(state=jn.State.OK, summary="Number of idle executors: 1"),
        Metric("jenkins_idle_executors", 1),
        jn.Result(state=jn.State.OK, summary="Mode: Exclusive "),
        jn.Result(state=jn.State.OK, summary="Offline: no"),
        jn.Result(
            state=jn.State.WARN,
            summary=
            "Average response time: 1 second (warn/crit at 1 second/2 seconds)",
        ),
        Metric("avg_response_time", 1.337, levels=(1.0, 2.0)),
        jn.Result(
            state=jn.State.CRIT,
            summary=
            "Clock difference: 5 seconds (warn/crit at 3 seconds/4 seconds)",
        ),
        Metric("jenkins_clock", 5.000, levels=(3.0, 4.0)),
        jn.Result(state=jn.State.OK, summary="Free temp space: 14.0 GiB"),
        Metric("jenkins_temp", 15085674496),
    ]
Exemplo n.º 3
0
def test_check_windows_item(section: jn.Section) -> None:
    assert list(
        jn.check_jenkins_nodes(
            "Windows", {"jenkins_offline": 2}, section)) == [
                jn.Result(
                    state=jn.State.OK,
                    summary="Description: Name: Myname, Ip-Address: 1.1.1.1"),
                jn.Result(state=jn.State.OK, summary="Is JNLP agent: yes"),
                jn.Result(state=jn.State.OK, summary="Is idle: yes"),
                jn.Result(state=jn.State.OK,
                          summary="Total number of executors: 1"),
                Metric("jenkins_num_executors", 1),
                jn.Result(state=jn.State.OK,
                          summary="Number of busy executors: 0"),
                Metric("jenkins_busy_executors", 0),
                jn.Result(state=jn.State.OK,
                          summary="Number of idle executors: 1"),
                Metric("jenkins_idle_executors", 1),
                jn.Result(state=jn.State.OK, summary="Mode: Exclusive "),
                jn.Result(state=jn.State.OK, summary="Offline: no"),
                jn.Result(state=jn.State.OK,
                          summary="Average response time: 35 milliseconds"),
                Metric("avg_response_time", 0.035),
                jn.Result(state=jn.State.OK,
                          summary="Clock difference: 8 milliseconds"),
                Metric("jenkins_clock", 0.008),
                jn.Result(state=jn.State.OK,
                          summary="Free temp space: 14.0 GiB"),
                Metric("jenkins_temp", 15085674496),
            ]