Exemple #1
0
def test_check3() -> None:
    assert list(
        check_mssql_jobs(
            "aller 2h",
            {
                "ignore_db_status": True,
                "status_disabled_jobs": 0,
                "status_missing_jobs": 2,
                "run_duration": (1800, 2400),
            },
            parse_mssql_jobs(INFO2),
        )
    ) == [
        Result(state=State.OK, summary="Last duration: 12 minutes 45 seconds"),
        Metric("database_job_duration", 765.0, levels=(1800.0, 2400.0)),
        Result(state=State.OK, summary="MSSQL status: Succeed"),
        Result(state=State.OK, summary="Last run: 2020-09-28 15:05:01"),
        Result(state=State.OK, summary="Next run: 2020-09-28 17:05:00"),
        Result(
            state=State.OK,
            notice=
            ("Outcome message: The job succeeded.  The Job was invoked by Schedule 48 (Mo-"
             "Sa 07:00 aller 2h).  The last step to run was step 2 (Magicinfo_Device_IP)."
             ),
        ),
    ]
Exemple #2
0
def test_check2() -> None:
    assert list(
        check_mssql_jobs(
            "Wartung Stündlich",
            {
                "ignore_db_status": False,
                "status_disabled_jobs": 0,
                "status_missing_jobs": 2,
                "run_duration": (1800, 2400),
            },
            parse_mssql_jobs(INFO2),
        )
    ) == [
        Result(state=State.OK, summary="Last duration: 9 seconds"),
        Metric("database_job_duration", 9.0, levels=(1800.0, 2400.0)),
        Result(state=State.CRIT, summary="MSSQL status: Fail"),
        Result(state=State.OK, summary="Last run: 2020-09-28 15:15:00"),
        Result(state=State.OK, summary="Next run: 2020-09-28 16:15:00"),
        Result(
            state=State.OK,
            notice=
            ("Outcome message: The job failed.  JobManager tried to run a non-existent"
             " step (3) for job Wartung Stündlich."),
        ),
    ]
Exemple #3
0
def test_check1() -> None:
    assert list(
        check_mssql_jobs(
            "teststsssss",
            {
                "ignore_db_status": True,
                "status_disabled_jobs": 0,
                "status_missing_jobs": 2,
                "run_duration": None,
            },
            parse_mssql_jobs(INFO1),
        )) == [
            Result(state=State.OK, summary="Last duration: 0 seconds"),
            Metric("database_job_duration", 0.0),
            Result(state=State.OK, summary="MSSQL status: Unknown"),
            Result(state=State.OK, summary="Last run: N/A"),
            Result(state=State.OK, summary="Schedule is disabled"),
            Result(state=State.OK, notice="Outcome message: "),
        ]
Exemple #4
0
def test_discovery2() -> None:
    assert list(discover_mssql_jobs(parse_mssql_jobs(INFO2))) == [
        Service(item="täglich 00:03"),
        Service(item="4x Täglich Infomanagement"),
        Service(item="Wartung Stündlich"),
        Service(item="1x Täglich"),
        Service(item="aller 2h"),
        Service(item="Wartung Täglich"),
        Service(item="1x Täglich 6:00 Uhr"),
        Service(item="1x Täglich Infomanagement"),
        Service(item="Sonntag"),
        Service(item="SSIS Server Maintenance Job"),
        Service(item="aller 1h"),
        Service(item="1 x täglich 01:00 Uhr"),
        Service(item="1x täglich ttCall"),
        Service(item="aller 15 min"),
        Service(item="aller 5 min"),
        Service(item="SSRS BO-Tool Report DL"),
        Service(item="SSRS AIC Report DL"),
        Service(item="14 Uhr"),
    ]
Exemple #5
0
def test_discovery1() -> None:
    assert list(discover_mssql_jobs(parse_mssql_jobs(INFO1))) == [
        Service(item="teststsssss"),
    ]