{"action":"created","comment":{"url":"https://api.github.com/repos/munin-monitoring/contrib/pulls/comments/86337542","pull_request_review_id":6996544,"id":86337542,"diff_hunk":"@@ -3,50 +3,102 @@\n # Plugin to show Postfix statistics - needs pflogsumm\n #\n # Contributed by David Obando (david@cryptix.de) - 16.04.2007\n+# Rewrited by Cristian Deluxe (me@cristiandeluxe.com) - 02.11.2016\n+#\n+#\n+# Example config for Ubuntu (You need: apt-get install pflogsumm)\n+#\n+# [postfix_stats]\n+# env.logfile /var/log/syslog\n+# env.logfile2 /var/log/syslog.1\n+# env.pflogsumm pflogsumm\n #\n #\n # Magic markers - optional - used by installation scripts and\n # munin-config:\n #\n-#%# family=manual\n+#%# family=contrib\n #%# capabilities=autoconf\n \n #set -xv\n+SYS_LOG=${logfile:-/var/log/syslog}\n+SYS_LOG2=${logfile2:-/var/log/syslog.0}\n+PFLOGSUMM=${pflogsumm:-pflogsumm.pl}\n+\n+# Fields (Array to avoid code duplication)\n+declare -a FIELDS_ARR=(\"received\" \"delivered\" \"forwarded\" \"deferred\" \"bounced\" \"rejected\" \"held\" \"discarded\")\n+\n+#\n+# Autoconf Section\n+#\n+if [ \"$1\" = 'autoconf' ]; then\n+\t# Try to find pflogsumm with default name\n+\tPFLOG_EXIST=$(command -v pflogsumm.pl)\n+\n+\t# Try to find pflogsumm without any extension\n+\tif [[ -z \"${PFLOG_EXIST}\" ]]\n+\t\tthen\n+\t\tPFLOG_EXIST=$(command -v pflogsumm)\n+\tfi\n+\n+\tif [[ -z \"${PFLOG_EXIST}\" ]]\n+\t\tthen\n+\t\techo 'no';\n+\telse\n+\t\techo 'yes'\n+\tfi\n+\texit 0;\n+fi\n+\n+#\n+# Config Section\n+#\n+if [ \"$1\" = 'config' ]; then\n+\techo 'graph_title Postfix statistics'\n+\techo 'graph_vlabel Postfix statistics'\n+\techo 'graph_category mail'\n+\techo 'graph_scale no'\n+\techo 'graph_period minute'\n+\techo 'graph_total Total'\n+\n+\t# Generate config for each field\n+\tfor i in \"${FIELDS_ARR[@]}\"\n+\tdo\n+\t\techo \"${i}.label ${i}\"\n+\t\techo \"${i}.type DERIVE\"\n+\t\techo \"${i}.min 0\"\n+\t\techo \"${i}.draw AREASTACK\"\n+\tdone\n+\n+\texit 0\n+fi\n+\n+#\n+# Plugin Script\n+#\n+\n+# Variable to store the pflogsumm result.\n+TMP_RAW=$(\"${PFLOGSUMM}\" -d today --detail 0 --zero-fill \"${SYS_LOG}\" \"${SYS_LOG2}\")\n+\n+# Parse value from Raw result\n+# \n+# Return digit if regex are parsed correctly\n+#\n+# Return -1 if any error occurs\n+#\n+parseValue() {\n+\tTMP_RETURN=$(echo \"${TMP_RAW}\" | grep -Ei '^[[:space:]]+[[:digit:]]+[[:space:]]+'\"${1}\"'.*$' | grep -oEi '[[:digit:]]+[[:space:]]+' | head -n 1 | sed 's: ::g')\n+\tif [[ -z \"${TMP_RETURN}\" ]]","path":"plugins/mail/postfix_stats","position":90,"original_position":90,"commit_id":"87a6a775b35fe31a4887497059c908e4efe8b8f6","original_commit_id":"87a6a775b35fe31a4887497059c908e4efe8b8f6","user":{"login":"sumpfralle","id":1474141,"avatar_url":"https://avatars.githubusercontent.com/u/1474141?v=3","gravatar_id":"","url":"https://api.github.com/users/sumpfralle","html_url":"https://github.com/sumpfralle","followers_url":"https://api.github.com/users/sumpfralle/followers","following_url":"https://api.github.com/users/sumpfralle/following{/other_user}","gists_url":"https://api.github.com/users/sumpfralle/gists{/gist_id}","starred_url":"https://api.github.com/users/sumpfralle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sumpfralle/subscriptions","organizations_url":"https://api.github.com/users/sumpfralle/orgs","repos_url":"https://api.github.com/users/sumpfralle/repos","events_url":"https://api.github.com/users/sumpfralle/events{/privacy}","received_events_url":"https://api.github.com/users/sumpfralle/received_events","type":"User","site_admin":false},"body":"bashism `[[ .. ]]`","created_at":"2016-11-03T13:08:22Z","updated_at":"2016-11-03T13:15:34Z","html_url":"https://github.com/munin-monitoring/contrib/pull/765#discussion_r86337542","pull_request_url":"https://api.github.com/repos/munin-monitoring/contrib/pulls/765","_links":{"self":{"href":"https://api.github.com/repos/munin-monitoring/contrib/pulls/comments/86337542"},"html":{"href":"https://github.com/munin-monitoring/contrib/pull/765#discussion_r86337542"},"pull_request":{"href":"https://api.github.com/repos/munin-monitoring/contrib/pulls/765"}}},"pull_request":{"url":"https://api.github.com/repos/munin-monitoring/contrib/pulls/765","id":91895828,"html_url":"https://github.com/munin-monitoring/contrib/pull/765","diff_url":"https://github.com/munin-monitoring/contrib/pull/765.diff","patch_url":"https://github.com/munin-monitoring/contrib/pull/765.patch","issue_url":"https://api.github.com/repos/munin-monitoring/contrib/issues/765","number":765,"state":"open","locked":false,"title":"Postfix stats - Rewrited plugin","user":{"login":"CristianDeluxe","id":156531,"avatar_url":"https://avatars.githubusercontent.com/u/156531?v=3","gravatar_id":"","url":"https://api.github.com/users/CristianDeluxe","html_url":"https://github.com/CristianDeluxe","followers_url":"https://api.github.com/users/CristianDeluxe/followers","following_url":"https://api.github.com/users/CristianDeluxe/following{/other_user}","gists_url":"https://api.github.com/users/CristianDeluxe/gists{/gist_id}","starred_url":"https://api.github.com/users/CristianDeluxe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CristianDeluxe/subscriptions","organizations_url":"https://api.github.com/users/CristianDeluxe/orgs","repos_url":"https://api.github.com/users/CristianDeluxe/repos","events_url":"https://api.github.com/users/CristianDeluxe/events{/privacy}","received_events_url":"https://api.github.com/users/CristianDeluxe/received_events","type":"User","site_admin":false},"body":"Hi, i've followed all your suggestions from previous pull request, unfortunately i can't remove merges and finally i've created another pull request 😐 \r\n\r\nPrevious pull:\r\nhttps://github.com/munin-monitoring/contrib/pull/711\r\n\r\nPlugin has been completely rewritten:\r\n\r\n- No use of TMP files 👍 \r\n- Much faster because \"pflogsumm\" command has been tuned\r\n- More efficient \"parsing\" now it use grep and regexp, and is more \"failsafe\"\r\n- Added autoconf\r\n- Script more documented\r\n- Removed duplicated code as far as possible\r\n- Removed backticks\r\n\r\nI hope everything is fine!","created_at":"2016-11-02T01:42:38Z","updated_at":"2016-11-03T13:15:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"22458119c05cc9005dffbc7857ad2d3467364cef","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/munin-monitoring/contrib/pulls/765/commits","review_comments_url":"https://api.github.com/repos/munin-monitoring/contrib/pulls/765/comments","review_comment_url":"https://api.github.com/repos/munin-monitoring/contrib/pulls/comments{/number}","comments_url":"https://api.github.com/repos/munin-monitoring/contrib/issues/765/comments","statuses_url":"https://api.github.com/repos/munin-monitoring/contrib/statuses/87a6a775b35fe31a4887497059c908e4efe8b8f6","head":{"label":"CristianDeluxe:postfix_stats","ref":"postfix_stats","sha":"87a6a775b35fe31a4887497059c908e4efe8b8f6","user":{"login":"CristianDeluxe","id":156531,"avatar_url":"https://avatars.githubusercontent.com/u/156531?v=3","gravatar_id":"","url":"https://api.github.com/users/CristianDeluxe","html_url":"https://github.com/CristianDeluxe","followers_url":"https://api.github.com/users/CristianDeluxe/followers","following_url":"https://api.github.com/users/CristianDeluxe/following{/other_user}","gists_url":"https://api.github.com/users/CristianDeluxe/gists{/gist_id}","starred_url":"https://api.github.com/users/CristianDeluxe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CristianDeluxe/subscriptions","organizations_url":"https://api.github.com/users/CristianDeluxe/orgs","repos_url":"https://api.github.com/users/CristianDeluxe/repos","events_url":"https://api.github.com/users/CristianDeluxe/events{/privacy}","received_events_url":"https://api.github.com/users/CristianDeluxe/received_events","type":"User","site_admin":false},"repo":{"id":55496558,"name":"contrib","full_name":"CristianDeluxe/contrib","owner":{"login":"CristianDeluxe","id":156531,"avatar_url":"https://avatars.githubusercontent.com/u/156531?v=3","gravatar_id":"","url":"https://api.github.com/users/CristianDeluxe","html_url":"https://github.com/CristianDeluxe","followers_url":"https://api.github.com/users/CristianDeluxe/followers","following_url":"https://api.github.com/users/CristianDeluxe/following{/other_user}","gists_url":"https://api.github.com/users/CristianDeluxe/gists{/gist_id}","starred_url":"https://api.github.com/users/CristianDeluxe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CristianDeluxe/subscriptions","organizations_url":"https://api.github.com/users/CristianDeluxe/orgs","repos_url":"https://api.github.com/users/CristianDeluxe/repos","events_url":"https://api.github.com/users/CristianDeluxe/events{/privacy}","received_events_url":"https://api.github.com/users/CristianDeluxe/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/CristianDeluxe/contrib","description":"Contributed stuff for munin (plugins, tools, etc...)","fork":true,"url":"https://api.github.com/repos/CristianDeluxe/contrib","forks_url":"https://api.github.com/repos/CristianDeluxe/contrib/forks","keys_url":"https://api.github.com/repos/CristianDeluxe/contrib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CristianDeluxe/contrib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CristianDeluxe/contrib/teams","hooks_url":"https://api.github.com/repos/CristianDeluxe/contrib/hooks","issue_events_url":"https://api.github.com/repos/CristianDeluxe/contrib/issues/events{/number}","events_url":"https://api.github.com/repos/CristianDeluxe/contrib/events","assignees_url":"https://api.github.com/repos/CristianDeluxe/contrib/assignees{/user}","branches_url":"https://api.github.com/repos/CristianDeluxe/contrib/branches{/branch}","tags_url":"https://api.github.com/repos/CristianDeluxe/contrib/tags","blobs_url":"https://api.github.com/repos/CristianDeluxe/contrib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CristianDeluxe/contrib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CristianDeluxe/contrib/git/refs{/sha}","trees_url":"https://api.github.com/repos/CristianDeluxe/contrib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CristianDeluxe/contrib/statuses/{sha}","languages_url":"https://api.github.com/repos/CristianDeluxe/contrib/languages","stargazers_url":"https://api.github.com/repos/CristianDeluxe/contrib/stargazers","contributors_url":"https://api.github.com/repos/CristianDeluxe/contrib/contributors","subscribers_url":"https://api.github.com/repos/CristianDeluxe/contrib/subscribers","subscription_url":"https://api.github.com/repos/CristianDeluxe/contrib/subscription","commits_url":"https://api.github.com/repos/CristianDeluxe/contrib/commits{/sha}","git_commits_url":"https://api.github.com/repos/CristianDeluxe/contrib/git/commits{/sha}","comments_url":"https://api.github.com/repos/CristianDeluxe/contrib/comments{/number}","issue_comment_url":"https://api.github.com/repos/CristianDeluxe/contrib/issues/comments{/number}","contents_url":"https://api.github.com/repos/CristianDeluxe/contrib/contents/{+path}","compare_url":"https://api.github.com/repos/CristianDeluxe/contrib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CristianDeluxe/contrib/merges","archive_url":"https://api.github.com/repos/CristianDeluxe/contrib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CristianDeluxe/contrib/downloads","issues_url":"https://api.github.com/repos/CristianDeluxe/contrib/issues{/number}","pulls_url":"https://api.github.com/repos/CristianDeluxe/contrib/pulls{/number}","milestones_url":"https://api.github.com/repos/CristianDeluxe/contrib/milestones{/number}","notifications_url":"https://api.github.com/repos/CristianDeluxe/contrib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CristianDeluxe/contrib/labels{/name}","releases_url":"https://api.github.com/repos/CristianDeluxe/contrib/releases{/id}","deployments_url":"https://api.github.com/repos/CristianDeluxe/contrib/deployments","created_at":"2016-04-05T09:51:23Z","updated_at":"2016-04-05T09:51:28Z","pushed_at":"2016-11-02T06:06:56Z","git_url":"git://github.com/CristianDeluxe/contrib.git","ssh_url":"git@github.com:CristianDeluxe/contrib.git","clone_url":"https://github.com/CristianDeluxe/contrib.git","svn_url":"https://github.com/CristianDeluxe/contrib","homepage":"http://munin-monitoring.org","size":5915,"stargazers_count":0,"watchers_count":0,"language":"Perl","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"munin-monitoring:master","ref":"master","sha":"e0f6a97af7f9b3c397b1b510d5c8a9ed32faa0c8","user":{"login":"munin-monitoring","id":909917,"avatar_url":"https://avatars.githubusercontent.com/u/909917?v=3","gravatar_id":"","url":"https://api.github.com/users/munin-monitoring","html_url":"https://github.com/munin-monitoring","followers_url":"https://api.github.com/users/munin-monitoring/followers","following_url":"https://api.github.com/users/munin-monitoring/following{/other_user}","gists_url":"https://api.github.com/users/munin-monitoring/gists{/gist_id}","starred_url":"https://api.github.com/users/munin-monitoring/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/munin-monitoring/subscriptions","organizations_url":"https://api.github.com/users/munin-monitoring/orgs","repos_url":"https://api.github.com/users/munin-monitoring/repos","events_url":"https://api.github.com/users/munin-monitoring/events{/privacy}","received_events_url":"https://api.github.com/users/munin-monitoring/received_events","type":"Organization","site_admin":false},"repo":{"id":2035393,"name":"contrib","full_name":"munin-monitoring/contrib","owner":{"login":"munin-monitoring","id":909917,"avatar_url":"https://avatars.githubusercontent.com/u/909917?v=3","gravatar_id":"","url":"https://api.github.com/users/munin-monitoring","html_url":"https://github.com/munin-monitoring","followers_url":"https://api.github.com/users/munin-monitoring/followers","following_url":"https://api.github.com/users/munin-monitoring/following{/other_user}","gists_url":"https://api.github.com/users/munin-monitoring/gists{/gist_id}","starred_url":"https://api.github.com/users/munin-monitoring/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/munin-monitoring/subscriptions","organizations_url":"https://api.github.com/users/munin-monitoring/orgs","repos_url":"https://api.github.com/users/munin-monitoring/repos","events_url":"https://api.github.com/users/munin-monitoring/events{/privacy}","received_events_url":"https://api.github.com/users/munin-monitoring/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/munin-monitoring/contrib","description":"Contributed stuff for munin (plugins, tools, etc...)","fork":false,"url":"https://api.github.com/repos/munin-monitoring/contrib","forks_url":"https://api.github.com/repos/munin-monitoring/contrib/forks","keys_url":"https://api.github.com/repos/munin-monitoring/contrib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/munin-monitoring/contrib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/munin-monitoring/contrib/teams","hooks_url":"https://api.github.com/repos/munin-monitoring/contrib/hooks","issue_events_url":"https://api.github.com/repos/munin-monitoring/contrib/issues/events{/number}","events_url":"https://api.github.com/repos/munin-monitoring/contrib/events","assignees_url":"https://api.github.com/repos/munin-monitoring/contrib/assignees{/user}","branches_url":"https://api.github.com/repos/munin-monitoring/contrib/branches{/branch}","tags_url":"https://api.github.com/repos/munin-monitoring/contrib/tags","blobs_url":"https://api.github.com/repos/munin-monitoring/contrib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/munin-monitoring/contrib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/munin-monitoring/contrib/git/refs{/sha}","trees_url":"https://api.github.com/repos/munin-monitoring/contrib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/munin-monitoring/contrib/statuses/{sha}","languages_url":"https://api.github.com/repos/munin-monitoring/contrib/languages","stargazers_url":"https://api.github.com/repos/munin-monitoring/contrib/stargazers","contributors_url":"https://api.github.com/repos/munin-monitoring/contrib/contributors","subscribers_url":"https://api.github.com/repos/munin-monitoring/contrib/subscribers","subscription_url":"https://api.github.com/repos/munin-monitoring/contrib/subscription","commits_url":"https://api.github.com/repos/munin-monitoring/contrib/commits{/sha}","git_commits_url":"https://api.github.com/repos/munin-monitoring/contrib/git/commits{/sha}","comments_url":"https://api.github.com/repos/munin-monitoring/contrib/comments{/number}","issue_comment_url":"https://api.github.com/repos/munin-monitoring/contrib/issues/comments{/number}","contents_url":"https://api.github.com/repos/munin-monitoring/contrib/contents/{+path}","compare_url":"https://api.github.com/repos/munin-monitoring/contrib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/munin-monitoring/contrib/merges","archive_url":"https://api.github.com/repos/munin-monitoring/contrib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/munin-monitoring/contrib/downloads","issues_url":"https://api.github.com/repos/munin-monitoring/contrib/issues{/number}","pulls_url":"https://api.github.com/repos/munin-monitoring/contrib/pulls{/number}","milestones_url":"https://api.github.com/repos/munin-monitoring/contrib/milestones{/number}","notifications_url":"https://api.github.com/repos/munin-monitoring/contrib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/munin-monitoring/contrib/labels{/name}","releases_url":"https://api.github.com/repos/munin-monitoring/contrib/releases{/id}","deployments_url":"https://api.github.com/repos/munin-monitoring/contrib/deployments","created_at":"2011-07-12T10:12:34Z","updated_at":"2016-10-26T22:00:22Z","pushed_at":"2016-11-02T06:06:56Z","git_url":"git://github.com/munin-monitoring/contrib.git","ssh_url":"git@github.com:munin-monitoring/contrib.git","clone_url":"https://github.com/munin-monitoring/contrib.git","svn_url":"https://github.com/munin-monitoring/contrib","homepage":"http://munin-monitoring.org","size":7566,"stargazers_count":916,"watchers_count":916,"language":"Perl","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":558,"mirror_url":null,"open_issues_count":49,"forks":558,"open_issues":49,"watchers":916,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/munin-monitoring/contrib/pulls/765"},"html":{"href":"https://github.com/munin-monitoring/contrib/pull/765"},"issue":{"href":"https://api.github.com/repos/munin-monitoring/contrib/issues/765"},"comments":{"href":"https://api.github.com/repos/munin-monitoring/contrib/issues/765/comments"},"review_comments":{"href":"https://api.github.com/repos/munin-monitoring/contrib/pulls/765/comments"},"review_comment":{"href":"https://api.github.com/repos/munin-monitoring/contrib/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/munin-monitoring/contrib/pulls/765/commits"},"statuses":{"href":"https://api.github.com/repos/munin-monitoring/contrib/statuses/87a6a775b35fe31a4887497059c908e4efe8b8f6"}}}}
{"actor":{"display_login":"sumpfralle"}}