コード例 #1
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2019 tribe29 GmbH - License: GNU General Public License v2
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
# conditions defined in the file COPYING, which is part of this source code package.

from cmk.gui.watolib.activate_changes import execute_activation_cleanup_background_job
from cmk.gui.plugins.cron import register_job

register_job(execute_activation_cleanup_background_job)
コード例 #2
0
ファイル: user_sync.py プロジェクト: petrows/checkmk
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2019 tribe29 GmbH - License: GNU General Public License v2
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
# conditions defined in the file COPYING, which is part of this source code package.

import cmk.gui.userdb as userdb
from cmk.gui.plugins.cron import register_job

register_job(userdb.execute_userdb_job)
register_job(userdb.execute_user_profile_cleanup_job)
コード例 #3
0
ファイル: gui_background_job.py プロジェクト: surajrb/checkmk
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2019 tribe29 GmbH - License: GNU General Public License v2
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
# conditions defined in the file COPYING, which is part of this source code package.

import cmk.gui.background_job

import cmk.gui.gui_background_job as gui_background_job
from cmk.gui.log import logger

from cmk.gui.plugins.cron import register_job


def housekeeping():
    # type: () -> None
    housekeep_classes = list(gui_background_job.job_registry.values())
    cmk.gui.background_job.BackgroundJobManager(logger).do_housekeeping(
        housekeep_classes)


register_job(housekeeping)
コード例 #4
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2019 tribe29 GmbH - License: GNU General Public License v2
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
# conditions defined in the file COPYING, which is part of this source code package.

import cmk.gui.wato as wato

from cmk.gui.plugins.cron import register_job

register_job(wato.execute_network_scan_job)
コード例 #5
0
ファイル: user_sync.py プロジェクト: TheAlex88/checkmk
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2019 tribe29 GmbH - License: GNU General Public License v2
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
# conditions defined in the file COPYING, which is part of this source code package.

import cmk.gui.userdb as userdb
from cmk.gui.plugins.cron import register_job

register_job(userdb.execute_userdb_job)
コード例 #6
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2019 tribe29 GmbH - License: GNU General Public License v2
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
# conditions defined in the file COPYING, which is part of this source code package.

import cmk.gui.inventory
from cmk.gui.plugins.cron import register_job

register_job(cmk.gui.inventory.InventoryHousekeeping().run)
コード例 #7
0
ファイル: network_scan.py プロジェクト: stefan7018/checkmk
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2019 tribe29 GmbH - License: GNU General Public License v2
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
# conditions defined in the file COPYING, which is part of this source code package.

from cmk.gui.watolib.network_scan import execute_network_scan_job
from cmk.gui.plugins.cron import register_job

register_job(execute_network_scan_job)
コード例 #8
0
# conditions defined in the file COPYING, which is part of this source code package.

import time
from pathlib import Path

from cmk.gui.plugins.cron import register_job
from cmk.gui.watolib.hosts_and_folders import Folder


def rebuild_folder_lookup_cache():
    """Rebuild folder lookup cache around ~5AM
    This needs to be done, since the cachefile might include outdated/vanished hosts"""

    localtime = time.localtime()
    if not (localtime.tm_hour == 5 and localtime.tm_min < 5):
        return

    cache_path = Path(Folder.host_lookup_cache_path())
    if cache_path.exists() and time.time() - cache_path.stat().st_mtime < 300:
        return

    # Touch the file. The cronjob interval might be faster than the file creation
    # Note: If this takes longer than the RequestTimeout -> Problem
    #       On very big configurations, e.g. 300MB this might take 30-50 seconds
    cache_path.parent.mkdir(parents=True, exist_ok=True)  # pylint: disable=no-member
    cache_path.touch()
    Folder.build_host_lookup_cache(str(cache_path))


register_job(rebuild_folder_lookup_cache)