{"action":"created","comment":{"url":"https://api.github.com/repos/zalando/zmon-worker/pulls/comments/64021901","id":64021901,"diff_hunk":"@@ -0,0 +1,157 @@\n+#!/usr/bin/env python\n+# -*- coding: utf-8 -*-\n+import os\n+import sys\n+import logging\n+\n+import requests\n+\n+from zmon_worker_monitor.zmon_worker.errors import HttpError\n+from zmon_worker_monitor.zmon_worker.common.http import get_user_agent\n+\n+from zmon_worker_monitor.adapters.ifunctionfactory_plugin import IFunctionFactoryPlugin, propartial\n+\n+logger = logging.getLogger('zmon-worker.appdynamics-function')\n+\n+\n+BEFORE_NOW = 'BEFORE_NOW'\n+BEFORE_TIME = 'BEFORE_TIME'\n+AFTER_TIME = 'AFTER_TIME'\n+BETWEEN_TIMES = 'BETWEEN_TIMES'\n+\n+CRITICAL = 'CRITICAL'\n+WARNING = 'WARNING'\n+\n+TIME_RANGE_TYPES = (\n+    BEFORE_NOW,\n+    BEFORE_TIME,\n+    AFTER_TIME,\n+    BETWEEN_TIMES,\n+)\n+\n+SEVERITIES = (\n+    WARNING,\n+    CRITICAL,\n+)\n+\n+\n+class AppdynamicsFactory(IFunctionFactoryPlugin):\n+    def __init__(self):\n+        super(AppdynamicsFactory, self).__init__()\n+        # Fields should be fetched from config\n+        self._user = None\n+        self._pass = None\n+\n+    def configure(self, conf):\n+        \"\"\"\n+        Called after plugin is loaded to pass the [configuration] section in their plugin info file\n+        :param conf: configuration dictionary\n+        \"\"\"\n+        self._user = conf['user']\n+        self._pass = conf['pass']\n+\n+    def create(self, factory_ctx):\n+        \"\"\"\n+        Automatically called to create the check function's object\n+        :param factory_ctx: (dict) names available for Function instantiation\n+        :return: an object that implements a check function\n+        \"\"\"\n+        return propartial(AppdynamicsWrapper, username=self._user, password=self._pass)\n+\n+\n+class AppdynamicsWrapper(object):\n+    def __init__(self, url, username=None, password=None):","path":"zmon_worker_monitor/builtins/plugins/appdynamics.py","position":63,"original_position":63,"commit_id":"4b1d95956c522f2ca2d418b8db8fb26d003e96d6","original_commit_id":"4b1d95956c522f2ca2d418b8db8fb26d003e96d6","user":{"login":"Jan-M","id":1443395,"avatar_url":"https://avatars.githubusercontent.com/u/1443395?v=3","gravatar_id":"","url":"https://api.github.com/users/Jan-M","html_url":"https://github.com/Jan-M","followers_url":"https://api.github.com/users/Jan-M/followers","following_url":"https://api.github.com/users/Jan-M/following{/other_user}","gists_url":"https://api.github.com/users/Jan-M/gists{/gist_id}","starred_url":"https://api.github.com/users/Jan-M/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jan-M/subscriptions","organizations_url":"https://api.github.com/users/Jan-M/orgs","repos_url":"https://api.github.com/users/Jan-M/repos","events_url":"https://api.github.com/users/Jan-M/events{/privacy}","received_events_url":"https://api.github.com/users/Jan-M/received_events","type":"User","site_admin":false},"body":"We can continue to have the credentials implemented, but for Z it will never be used imho.","created_at":"2016-05-20T10:42:12Z","updated_at":"2016-05-20T10:42:12Z","html_url":"https://github.com/zalando/zmon-worker/pull/48#discussion_r64021901","pull_request_url":"https://api.github.com/repos/zalando/zmon-worker/pulls/48","_links":{"self":{"href":"https://api.github.com/repos/zalando/zmon-worker/pulls/comments/64021901"},"html":{"href":"https://github.com/zalando/zmon-worker/pull/48#discussion_r64021901"},"pull_request":{"href":"https://api.github.com/repos/zalando/zmon-worker/pulls/48"}}},"pull_request":{"url":"https://api.github.com/repos/zalando/zmon-worker/pulls/48","id":70830611,"html_url":"https://github.com/zalando/zmon-worker/pull/48","diff_url":"https://github.com/zalando/zmon-worker/pull/48.diff","patch_url":"https://github.com/zalando/zmon-worker/pull/48.patch","issue_url":"https://api.github.com/repos/zalando/zmon-worker/issues/48","number":48,"state":"open","locked":false,"title":"Implement AppDynamics plugin","user":{"login":"mohabusama","id":488406,"avatar_url":"https://avatars.githubusercontent.com/u/488406?v=3","gravatar_id":"","url":"https://api.github.com/users/mohabusama","html_url":"https://github.com/mohabusama","followers_url":"https://api.github.com/users/mohabusama/followers","following_url":"https://api.github.com/users/mohabusama/following{/other_user}","gists_url":"https://api.github.com/users/mohabusama/gists{/gist_id}","starred_url":"https://api.github.com/users/mohabusama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mohabusama/subscriptions","organizations_url":"https://api.github.com/users/mohabusama/orgs","repos_url":"https://api.github.com/users/mohabusama/repos","events_url":"https://api.github.com/users/mohabusama/events{/privacy}","received_events_url":"https://api.github.com/users/mohabusama/received_events","type":"User","site_admin":false},"body":"+ Healthrule violations check\r\n+ Filter by severity\r\n\r\nAPI used: https://docs.appdynamics.com/display/PRO41/Use+the+AppDynamics+REST+API#UsetheAppDynamicsRESTAPI-Retrieveallhealthruleviolationsinaparticularbusinessapplication\r\n\r\nNot sure if we will need to implement Events API as well:\r\nhttps://docs.appdynamics.com/display/PRO41/Use+the+AppDynamics+REST+API#UsetheAppDynamicsRESTAPI-Retrieveeventdata","created_at":"2016-05-20T10:07:01Z","updated_at":"2016-05-20T10:42:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4c16643e9da2613254eef65ea1b9ebc543e5fd6f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/zalando/zmon-worker/pulls/48/commits","review_comments_url":"https://api.github.com/repos/zalando/zmon-worker/pulls/48/comments","review_comment_url":"https://api.github.com/repos/zalando/zmon-worker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zalando/zmon-worker/issues/48/comments","statuses_url":"https://api.github.com/repos/zalando/zmon-worker/statuses/4b1d95956c522f2ca2d418b8db8fb26d003e96d6","head":{"label":"zalando:feature/appdynamics-plugin","ref":"feature/appdynamics-plugin","sha":"4b1d95956c522f2ca2d418b8db8fb26d003e96d6","user":{"login":"zalando","id":1564818,"avatar_url":"https://avatars.githubusercontent.com/u/1564818?v=3","gravatar_id":"","url":"https://api.github.com/users/zalando","html_url":"https://github.com/zalando","followers_url":"https://api.github.com/users/zalando/followers","following_url":"https://api.github.com/users/zalando/following{/other_user}","gists_url":"https://api.github.com/users/zalando/gists{/gist_id}","starred_url":"https://api.github.com/users/zalando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zalando/subscriptions","organizations_url":"https://api.github.com/users/zalando/orgs","repos_url":"https://api.github.com/users/zalando/repos","events_url":"https://api.github.com/users/zalando/events{/privacy}","received_events_url":"https://api.github.com/users/zalando/received_events","type":"Organization","site_admin":false},"repo":{"id":28918578,"name":"zmon-worker","full_name":"zalando/zmon-worker","owner":{"login":"zalando","id":1564818,"avatar_url":"https://avatars.githubusercontent.com/u/1564818?v=3","gravatar_id":"","url":"https://api.github.com/users/zalando","html_url":"https://github.com/zalando","followers_url":"https://api.github.com/users/zalando/followers","following_url":"https://api.github.com/users/zalando/following{/other_user}","gists_url":"https://api.github.com/users/zalando/gists{/gist_id}","starred_url":"https://api.github.com/users/zalando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zalando/subscriptions","organizations_url":"https://api.github.com/users/zalando/orgs","repos_url":"https://api.github.com/users/zalando/repos","events_url":"https://api.github.com/users/zalando/events{/privacy}","received_events_url":"https://api.github.com/users/zalando/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zalando/zmon-worker","description":"ZMON Python Worker","fork":false,"url":"https://api.github.com/repos/zalando/zmon-worker","forks_url":"https://api.github.com/repos/zalando/zmon-worker/forks","keys_url":"https://api.github.com/repos/zalando/zmon-worker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zalando/zmon-worker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zalando/zmon-worker/teams","hooks_url":"https://api.github.com/repos/zalando/zmon-worker/hooks","issue_events_url":"https://api.github.com/repos/zalando/zmon-worker/issues/events{/number}","events_url":"https://api.github.com/repos/zalando/zmon-worker/events","assignees_url":"https://api.github.com/repos/zalando/zmon-worker/assignees{/user}","branches_url":"https://api.github.com/repos/zalando/zmon-worker/branches{/branch}","tags_url":"https://api.github.com/repos/zalando/zmon-worker/tags","blobs_url":"https://api.github.com/repos/zalando/zmon-worker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zalando/zmon-worker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zalando/zmon-worker/git/refs{/sha}","trees_url":"https://api.github.com/repos/zalando/zmon-worker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zalando/zmon-worker/statuses/{sha}","languages_url":"https://api.github.com/repos/zalando/zmon-worker/languages","stargazers_url":"https://api.github.com/repos/zalando/zmon-worker/stargazers","contributors_url":"https://api.github.com/repos/zalando/zmon-worker/contributors","subscribers_url":"https://api.github.com/repos/zalando/zmon-worker/subscribers","subscription_url":"https://api.github.com/repos/zalando/zmon-worker/subscription","commits_url":"https://api.github.com/repos/zalando/zmon-worker/commits{/sha}","git_commits_url":"https://api.github.com/repos/zalando/zmon-worker/git/commits{/sha}","comments_url":"https://api.github.com/repos/zalando/zmon-worker/comments{/number}","issue_comment_url":"https://api.github.com/repos/zalando/zmon-worker/issues/comments{/number}","contents_url":"https://api.github.com/repos/zalando/zmon-worker/contents/{+path}","compare_url":"https://api.github.com/repos/zalando/zmon-worker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zalando/zmon-worker/merges","archive_url":"https://api.github.com/repos/zalando/zmon-worker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zalando/zmon-worker/downloads","issues_url":"https://api.github.com/repos/zalando/zmon-worker/issues{/number}","pulls_url":"https://api.github.com/repos/zalando/zmon-worker/pulls{/number}","milestones_url":"https://api.github.com/repos/zalando/zmon-worker/milestones{/number}","notifications_url":"https://api.github.com/repos/zalando/zmon-worker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zalando/zmon-worker/labels{/name}","releases_url":"https://api.github.com/repos/zalando/zmon-worker/releases{/id}","deployments_url":"https://api.github.com/repos/zalando/zmon-worker/deployments","created_at":"2015-01-07T14:47:02Z","updated_at":"2016-05-12T12:39:46Z","pushed_at":"2016-05-20T10:07:02Z","git_url":"git://github.com/zalando/zmon-worker.git","ssh_url":"git@github.com:zalando/zmon-worker.git","clone_url":"https://github.com/zalando/zmon-worker.git","svn_url":"https://github.com/zalando/zmon-worker","homepage":"https://zmon.io/","size":588,"stargazers_count":7,"watchers_count":7,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":15,"forks":6,"open_issues":15,"watchers":7,"default_branch":"master"}},"base":{"label":"zalando:master","ref":"master","sha":"44c018eb7387c94437a873d27241f3868a40b9d0","user":{"login":"zalando","id":1564818,"avatar_url":"https://avatars.githubusercontent.com/u/1564818?v=3","gravatar_id":"","url":"https://api.github.com/users/zalando","html_url":"https://github.com/zalando","followers_url":"https://api.github.com/users/zalando/followers","following_url":"https://api.github.com/users/zalando/following{/other_user}","gists_url":"https://api.github.com/users/zalando/gists{/gist_id}","starred_url":"https://api.github.com/users/zalando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zalando/subscriptions","organizations_url":"https://api.github.com/users/zalando/orgs","repos_url":"https://api.github.com/users/zalando/repos","events_url":"https://api.github.com/users/zalando/events{/privacy}","received_events_url":"https://api.github.com/users/zalando/received_events","type":"Organization","site_admin":false},"repo":{"id":28918578,"name":"zmon-worker","full_name":"zalando/zmon-worker","owner":{"login":"zalando","id":1564818,"avatar_url":"https://avatars.githubusercontent.com/u/1564818?v=3","gravatar_id":"","url":"https://api.github.com/users/zalando","html_url":"https://github.com/zalando","followers_url":"https://api.github.com/users/zalando/followers","following_url":"https://api.github.com/users/zalando/following{/other_user}","gists_url":"https://api.github.com/users/zalando/gists{/gist_id}","starred_url":"https://api.github.com/users/zalando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zalando/subscriptions","organizations_url":"https://api.github.com/users/zalando/orgs","repos_url":"https://api.github.com/users/zalando/repos","events_url":"https://api.github.com/users/zalando/events{/privacy}","received_events_url":"https://api.github.com/users/zalando/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zalando/zmon-worker","description":"ZMON Python Worker","fork":false,"url":"https://api.github.com/repos/zalando/zmon-worker","forks_url":"https://api.github.com/repos/zalando/zmon-worker/forks","keys_url":"https://api.github.com/repos/zalando/zmon-worker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zalando/zmon-worker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zalando/zmon-worker/teams","hooks_url":"https://api.github.com/repos/zalando/zmon-worker/hooks","issue_events_url":"https://api.github.com/repos/zalando/zmon-worker/issues/events{/number}","events_url":"https://api.github.com/repos/zalando/zmon-worker/events","assignees_url":"https://api.github.com/repos/zalando/zmon-worker/assignees{/user}","branches_url":"https://api.github.com/repos/zalando/zmon-worker/branches{/branch}","tags_url":"https://api.github.com/repos/zalando/zmon-worker/tags","blobs_url":"https://api.github.com/repos/zalando/zmon-worker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zalando/zmon-worker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zalando/zmon-worker/git/refs{/sha}","trees_url":"https://api.github.com/repos/zalando/zmon-worker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zalando/zmon-worker/statuses/{sha}","languages_url":"https://api.github.com/repos/zalando/zmon-worker/languages","stargazers_url":"https://api.github.com/repos/zalando/zmon-worker/stargazers","contributors_url":"https://api.github.com/repos/zalando/zmon-worker/contributors","subscribers_url":"https://api.github.com/repos/zalando/zmon-worker/subscribers","subscription_url":"https://api.github.com/repos/zalando/zmon-worker/subscription","commits_url":"https://api.github.com/repos/zalando/zmon-worker/commits{/sha}","git_commits_url":"https://api.github.com/repos/zalando/zmon-worker/git/commits{/sha}","comments_url":"https://api.github.com/repos/zalando/zmon-worker/comments{/number}","issue_comment_url":"https://api.github.com/repos/zalando/zmon-worker/issues/comments{/number}","contents_url":"https://api.github.com/repos/zalando/zmon-worker/contents/{+path}","compare_url":"https://api.github.com/repos/zalando/zmon-worker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zalando/zmon-worker/merges","archive_url":"https://api.github.com/repos/zalando/zmon-worker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zalando/zmon-worker/downloads","issues_url":"https://api.github.com/repos/zalando/zmon-worker/issues{/number}","pulls_url":"https://api.github.com/repos/zalando/zmon-worker/pulls{/number}","milestones_url":"https://api.github.com/repos/zalando/zmon-worker/milestones{/number}","notifications_url":"https://api.github.com/repos/zalando/zmon-worker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zalando/zmon-worker/labels{/name}","releases_url":"https://api.github.com/repos/zalando/zmon-worker/releases{/id}","deployments_url":"https://api.github.com/repos/zalando/zmon-worker/deployments","created_at":"2015-01-07T14:47:02Z","updated_at":"2016-05-12T12:39:46Z","pushed_at":"2016-05-20T10:07:02Z","git_url":"git://github.com/zalando/zmon-worker.git","ssh_url":"git@github.com:zalando/zmon-worker.git","clone_url":"https://github.com/zalando/zmon-worker.git","svn_url":"https://github.com/zalando/zmon-worker","homepage":"https://zmon.io/","size":588,"stargazers_count":7,"watchers_count":7,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":15,"forks":6,"open_issues":15,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zalando/zmon-worker/pulls/48"},"html":{"href":"https://github.com/zalando/zmon-worker/pull/48"},"issue":{"href":"https://api.github.com/repos/zalando/zmon-worker/issues/48"},"comments":{"href":"https://api.github.com/repos/zalando/zmon-worker/issues/48/comments"},"review_comments":{"href":"https://api.github.com/repos/zalando/zmon-worker/pulls/48/comments"},"review_comment":{"href":"https://api.github.com/repos/zalando/zmon-worker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zalando/zmon-worker/pulls/48/commits"},"statuses":{"href":"https://api.github.com/repos/zalando/zmon-worker/statuses/4b1d95956c522f2ca2d418b8db8fb26d003e96d6"}}}}
{"actor":{"display_login":"Jan-M"}}