{"action":"created","comment":{"url":"https://api.github.com/repos/innogames/igmonplugins/pulls/comments/195461865","pull_request_review_id":128836098,"id":195461865,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NTQ2MTg2NQ==","diff_hunk":"@@ -0,0 +1,224 @@\n+#!/usr/bin/env python\n+#\n+# Nagios systemd timers check\n+#\n+# This is a Nagios script to check all or some timers of \"systemd\".\n+# It checks for anomalies of those timers, i.e. unloaded, long term\n+# unexecuted or problems in related service\n+#\n+# * critical when a timer unit is inactive of service unit is stoped\n+# * warning for long term unexecuted\n+#\n+# Copyright (c) 2018, InnoGames GmbH\n+#\n+\n+from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter\n+from datetime import datetime\n+# python2/3 compatibility\n+from time import time\n+from systemd_dbus.manager import Manager\n+from systemd_dbus.exceptions import SystemdError\n+import sys\n+import logging\n+\n+logging.basicConfig(\n+    format='%(levelname)-8s [%(filename)s:%(lineno)d] %(message)s'\n+)\n+logger = logging.getLogger(__name__)\n+\n+\n+class CheckTimers(object):\n+    \"\"\"\n+    Check timers for status, last executed service time, service status\n+    \"\"\"\n+    CODES = dict(\n+        OK=0,\n+        WARNING=1,\n+        CRITICAL=2,\n+        UNKNOWN=3,\n+    )\n+    REV_CODES = dict(map(reversed, CODES.items()))\n+\n+    def __init__(self, check_all, crit_threshold, ignored_timers, timer_units,\n+                 warn_threshold, **kwargs):\n+        self._crit_threshold = crit_threshold\n+        self._warn_threshold = warn_threshold\n+        try:\n+            s_manager = Manager()\n+            timers = s_manager.list_timers()\n+            logger.debug(\n+                'Timers in system are: {}'\n+                .format([t.properties.Id for t in timers])\n+            )\n+            if check_all:\n+                self.timers = {\n+                    str(t.properties.Id): t for t in timers\n+                    if str(t.properties.Id) not in ignored_timers\n+                }\n+            else:\n+                self.timers = {\n+                    str(t.properties.Id): t for t in timers\n+                    if str(t.properties.Id) in timer_units\n+                }","path":"src/check_systemd_timers.py","position":62,"original_position":62,"commit_id":"148e0347020e4b5a9c99811c60280d723eed4285","original_commit_id":"148e0347020e4b5a9c99811c60280d723eed4285","user":{"login":"hasegeli","id":237941,"node_id":"MDQ6VXNlcjIzNzk0MQ==","avatar_url":"https://avatars3.githubusercontent.com/u/237941?v=4","gravatar_id":"","url":"https://api.github.com/users/hasegeli","html_url":"https://github.com/hasegeli","followers_url":"https://api.github.com/users/hasegeli/followers","following_url":"https://api.github.com/users/hasegeli/following{/other_user}","gists_url":"https://api.github.com/users/hasegeli/gists{/gist_id}","starred_url":"https://api.github.com/users/hasegeli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hasegeli/subscriptions","organizations_url":"https://api.github.com/users/hasegeli/orgs","repos_url":"https://api.github.com/users/hasegeli/repos","events_url":"https://api.github.com/users/hasegeli/events{/privacy}","received_events_url":"https://api.github.com/users/hasegeli/received_events","type":"User","site_admin":false},"body":"No need to iterate the same list 2 times.\r\n","created_at":"2018-06-14T15:11:56Z","updated_at":"2018-06-14T15:21:38Z","html_url":"https://github.com/innogames/igmonplugins/pull/100#discussion_r195461865","pull_request_url":"https://api.github.com/repos/innogames/igmonplugins/pulls/100","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/innogames/igmonplugins/pulls/comments/195461865"},"html":{"href":"https://github.com/innogames/igmonplugins/pull/100#discussion_r195461865"},"pull_request":{"href":"https://api.github.com/repos/innogames/igmonplugins/pulls/100"}}},"pull_request":{"url":"https://api.github.com/repos/innogames/igmonplugins/pulls/100","id":194809959,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk0ODA5OTU5","html_url":"https://github.com/innogames/igmonplugins/pull/100","diff_url":"https://github.com/innogames/igmonplugins/pull/100.diff","patch_url":"https://github.com/innogames/igmonplugins/pull/100.patch","issue_url":"https://api.github.com/repos/innogames/igmonplugins/issues/100","number":100,"state":"open","locked":false,"title":"Tech 19984 systemd timers","user":{"login":"Felixoid","id":3025537,"node_id":"MDQ6VXNlcjMwMjU1Mzc=","avatar_url":"https://avatars1.githubusercontent.com/u/3025537?v=4","gravatar_id":"","url":"https://api.github.com/users/Felixoid","html_url":"https://github.com/Felixoid","followers_url":"https://api.github.com/users/Felixoid/followers","following_url":"https://api.github.com/users/Felixoid/following{/other_user}","gists_url":"https://api.github.com/users/Felixoid/gists{/gist_id}","starred_url":"https://api.github.com/users/Felixoid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Felixoid/subscriptions","organizations_url":"https://api.github.com/users/Felixoid/orgs","repos_url":"https://api.github.com/users/Felixoid/repos","events_url":"https://api.github.com/users/Felixoid/events{/privacy}","received_events_url":"https://api.github.com/users/Felixoid/received_events","type":"User","site_admin":false},"body":"Implemented check for systemd.timer","created_at":"2018-06-14T08:08:59Z","updated_at":"2018-06-14T15:21:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"40a29263727d228dd20d91eaee529cc88a9ad495","assignee":null,"assignees":[],"requested_reviewers":[{"login":"TuxPowered42","id":4185055,"node_id":"MDQ6VXNlcjQxODUwNTU=","avatar_url":"https://avatars0.githubusercontent.com/u/4185055?v=4","gravatar_id":"","url":"https://api.github.com/users/TuxPowered42","html_url":"https://github.com/TuxPowered42","followers_url":"https://api.github.com/users/TuxPowered42/followers","following_url":"https://api.github.com/users/TuxPowered42/following{/other_user}","gists_url":"https://api.github.com/users/TuxPowered42/gists{/gist_id}","starred_url":"https://api.github.com/users/TuxPowered42/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TuxPowered42/subscriptions","organizations_url":"https://api.github.com/users/TuxPowered42/orgs","repos_url":"https://api.github.com/users/TuxPowered42/repos","events_url":"https://api.github.com/users/TuxPowered42/events{/privacy}","received_events_url":"https://api.github.com/users/TuxPowered42/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/innogames/igmonplugins/pulls/100/commits","review_comments_url":"https://api.github.com/repos/innogames/igmonplugins/pulls/100/comments","review_comment_url":"https://api.github.com/repos/innogames/igmonplugins/pulls/comments{/number}","comments_url":"https://api.github.com/repos/innogames/igmonplugins/issues/100/comments","statuses_url":"https://api.github.com/repos/innogames/igmonplugins/statuses/148e0347020e4b5a9c99811c60280d723eed4285","head":{"label":"innogames:TECH-19984_systemd-timers","ref":"TECH-19984_systemd-timers","sha":"148e0347020e4b5a9c99811c60280d723eed4285","user":{"login":"innogames","id":1314968,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzMTQ5Njg=","avatar_url":"https://avatars2.githubusercontent.com/u/1314968?v=4","gravatar_id":"","url":"https://api.github.com/users/innogames","html_url":"https://github.com/innogames","followers_url":"https://api.github.com/users/innogames/followers","following_url":"https://api.github.com/users/innogames/following{/other_user}","gists_url":"https://api.github.com/users/innogames/gists{/gist_id}","starred_url":"https://api.github.com/users/innogames/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/innogames/subscriptions","organizations_url":"https://api.github.com/users/innogames/orgs","repos_url":"https://api.github.com/users/innogames/repos","events_url":"https://api.github.com/users/innogames/events{/privacy}","received_events_url":"https://api.github.com/users/innogames/received_events","type":"Organization","site_admin":false},"repo":{"id":51774308,"node_id":"MDEwOlJlcG9zaXRvcnk1MTc3NDMwOA==","name":"igmonplugins","full_name":"innogames/igmonplugins","owner":{"login":"innogames","id":1314968,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzMTQ5Njg=","avatar_url":"https://avatars2.githubusercontent.com/u/1314968?v=4","gravatar_id":"","url":"https://api.github.com/users/innogames","html_url":"https://github.com/innogames","followers_url":"https://api.github.com/users/innogames/followers","following_url":"https://api.github.com/users/innogames/following{/other_user}","gists_url":"https://api.github.com/users/innogames/gists{/gist_id}","starred_url":"https://api.github.com/users/innogames/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/innogames/subscriptions","organizations_url":"https://api.github.com/users/innogames/orgs","repos_url":"https://api.github.com/users/innogames/repos","events_url":"https://api.github.com/users/innogames/events{/privacy}","received_events_url":"https://api.github.com/users/innogames/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/innogames/igmonplugins","description":"Nagios plugins from InnoGames","fork":false,"url":"https://api.github.com/repos/innogames/igmonplugins","forks_url":"https://api.github.com/repos/innogames/igmonplugins/forks","keys_url":"https://api.github.com/repos/innogames/igmonplugins/keys{/key_id}","collaborators_url":"https://api.github.com/repos/innogames/igmonplugins/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/innogames/igmonplugins/teams","hooks_url":"https://api.github.com/repos/innogames/igmonplugins/hooks","issue_events_url":"https://api.github.com/repos/innogames/igmonplugins/issues/events{/number}","events_url":"https://api.github.com/repos/innogames/igmonplugins/events","assignees_url":"https://api.github.com/repos/innogames/igmonplugins/assignees{/user}","branches_url":"https://api.github.com/repos/innogames/igmonplugins/branches{/branch}","tags_url":"https://api.github.com/repos/innogames/igmonplugins/tags","blobs_url":"https://api.github.com/repos/innogames/igmonplugins/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/innogames/igmonplugins/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/innogames/igmonplugins/git/refs{/sha}","trees_url":"https://api.github.com/repos/innogames/igmonplugins/git/trees{/sha}","statuses_url":"https://api.github.com/repos/innogames/igmonplugins/statuses/{sha}","languages_url":"https://api.github.com/repos/innogames/igmonplugins/languages","stargazers_url":"https://api.github.com/repos/innogames/igmonplugins/stargazers","contributors_url":"https://api.github.com/repos/innogames/igmonplugins/contributors","subscribers_url":"https://api.github.com/repos/innogames/igmonplugins/subscribers","subscription_url":"https://api.github.com/repos/innogames/igmonplugins/subscription","commits_url":"https://api.github.com/repos/innogames/igmonplugins/commits{/sha}","git_commits_url":"https://api.github.com/repos/innogames/igmonplugins/git/commits{/sha}","comments_url":"https://api.github.com/repos/innogames/igmonplugins/comments{/number}","issue_comment_url":"https://api.github.com/repos/innogames/igmonplugins/issues/comments{/number}","contents_url":"https://api.github.com/repos/innogames/igmonplugins/contents/{+path}","compare_url":"https://api.github.com/repos/innogames/igmonplugins/compare/{base}...{head}","merges_url":"https://api.github.com/repos/innogames/igmonplugins/merges","archive_url":"https://api.github.com/repos/innogames/igmonplugins/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/innogames/igmonplugins/downloads","issues_url":"https://api.github.com/repos/innogames/igmonplugins/issues{/number}","pulls_url":"https://api.github.com/repos/innogames/igmonplugins/pulls{/number}","milestones_url":"https://api.github.com/repos/innogames/igmonplugins/milestones{/number}","notifications_url":"https://api.github.com/repos/innogames/igmonplugins/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/innogames/igmonplugins/labels{/name}","releases_url":"https://api.github.com/repos/innogames/igmonplugins/releases{/id}","deployments_url":"https://api.github.com/repos/innogames/igmonplugins/deployments","created_at":"2016-02-15T17:55:51Z","updated_at":"2018-06-07T12:05:45Z","pushed_at":"2018-06-14T14:56:39Z","git_url":"git://github.com/innogames/igmonplugins.git","ssh_url":"git@github.com:innogames/igmonplugins.git","clone_url":"https://github.com/innogames/igmonplugins.git","svn_url":"https://github.com/innogames/igmonplugins","homepage":null,"size":336,"stargazers_count":11,"watchers_count":11,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"archived":false,"open_issues_count":5,"license":null,"forks":12,"open_issues":5,"watchers":11,"default_branch":"master"}},"base":{"label":"innogames:master","ref":"master","sha":"1d66297aba3e79485bbf4adbc76ac34c7fc36397","user":{"login":"innogames","id":1314968,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzMTQ5Njg=","avatar_url":"https://avatars2.githubusercontent.com/u/1314968?v=4","gravatar_id":"","url":"https://api.github.com/users/innogames","html_url":"https://github.com/innogames","followers_url":"https://api.github.com/users/innogames/followers","following_url":"https://api.github.com/users/innogames/following{/other_user}","gists_url":"https://api.github.com/users/innogames/gists{/gist_id}","starred_url":"https://api.github.com/users/innogames/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/innogames/subscriptions","organizations_url":"https://api.github.com/users/innogames/orgs","repos_url":"https://api.github.com/users/innogames/repos","events_url":"https://api.github.com/users/innogames/events{/privacy}","received_events_url":"https://api.github.com/users/innogames/received_events","type":"Organization","site_admin":false},"repo":{"id":51774308,"node_id":"MDEwOlJlcG9zaXRvcnk1MTc3NDMwOA==","name":"igmonplugins","full_name":"innogames/igmonplugins","owner":{"login":"innogames","id":1314968,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzMTQ5Njg=","avatar_url":"https://avatars2.githubusercontent.com/u/1314968?v=4","gravatar_id":"","url":"https://api.github.com/users/innogames","html_url":"https://github.com/innogames","followers_url":"https://api.github.com/users/innogames/followers","following_url":"https://api.github.com/users/innogames/following{/other_user}","gists_url":"https://api.github.com/users/innogames/gists{/gist_id}","starred_url":"https://api.github.com/users/innogames/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/innogames/subscriptions","organizations_url":"https://api.github.com/users/innogames/orgs","repos_url":"https://api.github.com/users/innogames/repos","events_url":"https://api.github.com/users/innogames/events{/privacy}","received_events_url":"https://api.github.com/users/innogames/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/innogames/igmonplugins","description":"Nagios plugins from InnoGames","fork":false,"url":"https://api.github.com/repos/innogames/igmonplugins","forks_url":"https://api.github.com/repos/innogames/igmonplugins/forks","keys_url":"https://api.github.com/repos/innogames/igmonplugins/keys{/key_id}","collaborators_url":"https://api.github.com/repos/innogames/igmonplugins/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/innogames/igmonplugins/teams","hooks_url":"https://api.github.com/repos/innogames/igmonplugins/hooks","issue_events_url":"https://api.github.com/repos/innogames/igmonplugins/issues/events{/number}","events_url":"https://api.github.com/repos/innogames/igmonplugins/events","assignees_url":"https://api.github.com/repos/innogames/igmonplugins/assignees{/user}","branches_url":"https://api.github.com/repos/innogames/igmonplugins/branches{/branch}","tags_url":"https://api.github.com/repos/innogames/igmonplugins/tags","blobs_url":"https://api.github.com/repos/innogames/igmonplugins/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/innogames/igmonplugins/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/innogames/igmonplugins/git/refs{/sha}","trees_url":"https://api.github.com/repos/innogames/igmonplugins/git/trees{/sha}","statuses_url":"https://api.github.com/repos/innogames/igmonplugins/statuses/{sha}","languages_url":"https://api.github.com/repos/innogames/igmonplugins/languages","stargazers_url":"https://api.github.com/repos/innogames/igmonplugins/stargazers","contributors_url":"https://api.github.com/repos/innogames/igmonplugins/contributors","subscribers_url":"https://api.github.com/repos/innogames/igmonplugins/subscribers","subscription_url":"https://api.github.com/repos/innogames/igmonplugins/subscription","commits_url":"https://api.github.com/repos/innogames/igmonplugins/commits{/sha}","git_commits_url":"https://api.github.com/repos/innogames/igmonplugins/git/commits{/sha}","comments_url":"https://api.github.com/repos/innogames/igmonplugins/comments{/number}","issue_comment_url":"https://api.github.com/repos/innogames/igmonplugins/issues/comments{/number}","contents_url":"https://api.github.com/repos/innogames/igmonplugins/contents/{+path}","compare_url":"https://api.github.com/repos/innogames/igmonplugins/compare/{base}...{head}","merges_url":"https://api.github.com/repos/innogames/igmonplugins/merges","archive_url":"https://api.github.com/repos/innogames/igmonplugins/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/innogames/igmonplugins/downloads","issues_url":"https://api.github.com/repos/innogames/igmonplugins/issues{/number}","pulls_url":"https://api.github.com/repos/innogames/igmonplugins/pulls{/number}","milestones_url":"https://api.github.com/repos/innogames/igmonplugins/milestones{/number}","notifications_url":"https://api.github.com/repos/innogames/igmonplugins/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/innogames/igmonplugins/labels{/name}","releases_url":"https://api.github.com/repos/innogames/igmonplugins/releases{/id}","deployments_url":"https://api.github.com/repos/innogames/igmonplugins/deployments","created_at":"2016-02-15T17:55:51Z","updated_at":"2018-06-07T12:05:45Z","pushed_at":"2018-06-14T14:56:39Z","git_url":"git://github.com/innogames/igmonplugins.git","ssh_url":"git@github.com:innogames/igmonplugins.git","clone_url":"https://github.com/innogames/igmonplugins.git","svn_url":"https://github.com/innogames/igmonplugins","homepage":null,"size":336,"stargazers_count":11,"watchers_count":11,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"archived":false,"open_issues_count":5,"license":null,"forks":12,"open_issues":5,"watchers":11,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/innogames/igmonplugins/pulls/100"},"html":{"href":"https://github.com/innogames/igmonplugins/pull/100"},"issue":{"href":"https://api.github.com/repos/innogames/igmonplugins/issues/100"},"comments":{"href":"https://api.github.com/repos/innogames/igmonplugins/issues/100/comments"},"review_comments":{"href":"https://api.github.com/repos/innogames/igmonplugins/pulls/100/comments"},"review_comment":{"href":"https://api.github.com/repos/innogames/igmonplugins/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/innogames/igmonplugins/pulls/100/commits"},"statuses":{"href":"https://api.github.com/repos/innogames/igmonplugins/statuses/148e0347020e4b5a9c99811c60280d723eed4285"}},"author_association":"NONE"}}
{"actor":{"display_login":"hasegeli"}}