Ottomata has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/54478


Change subject: Fixing email blog pageviews job
......................................................................

Fixing email blog pageviews job

Change-Id: I2c9ceee294108d6a44f07716ccfe722e8ee5f586
---
M manifests/misc/statistics.pp
M templates/misc/email-blog-pageviews.erb
2 files changed, 16 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/78/54478/1

diff --git a/manifests/misc/statistics.pp b/manifests/misc/statistics.pp
index bb711dc..529316d 100644
--- a/manifests/misc/statistics.pp
+++ b/manifests/misc/statistics.pp
@@ -676,21 +676,25 @@
 # Sets up daily cron jobs to run a script which
 # groups blog pageviews by url and emails them
 class misc::statistics::cron_blog_pageviews {
-       $script = "/usr/local/bin/blog.sh"
+       $script          = '/usr/local/bin/blog.sh'
+       $recipient_email = 'tba...@wikimedia.org'
 
-       file {
-               "$script":
-                       mode    => 0755,
-                       content => template("misc/email-blog-pageviews.erb");
+       $db_host         = 'db1047.eqiad.wmnet'
+       $db_user         = $passwords::mysql::research::user
+       $db_pass         = $passwords::mysql::research::pass
+
+       file { $script:
+               mode    => 0755,
+               content => template('misc/email-blog-pageviews.erb'),
        }
 
        # Create a daily cron job to run the blog script
        # This requires that the $misc::statistics::user::username
        # user is installed on the source host.
-       cron { "rsync_${name}_logs":
-               command => "$script",
-               user    => "$misc::statistics::user::username",
-               hour    => 8,
+       cron { 'blog_pageviews_email':
+               command => $script,
+               user    => $misc::statistics::user::username,
+               hour    => 2,
                minute  => 0,
        }
 }
diff --git a/templates/misc/email-blog-pageviews.erb 
b/templates/misc/email-blog-pageviews.erb
index d2dfcd2..f05e77e 100644
--- a/templates/misc/email-blog-pageviews.erb
+++ b/templates/misc/email-blog-pageviews.erb
@@ -1,8 +1,8 @@
 DATE=`date '+%Y-%m-%d'`;
 OUTPUT=/tmp/blog_$DATE.tsv
 
-mysql log -h db1047.eqiad.wmnet -p<%= 
scope.lookupvar('passwords::mysql::research::pass') %>
- -u<%= scope.lookupvar('passwords::mysql::research::user') %> -e "select 
count(event_requestUrl) as count, date(timestamp), event_requestUrl from 
WikimediaBlogVisit_5308166 where date(timestamp)=date('$DATE') group by 
event_requestUrl order by date(timestamp) desc, count desc;" > $OUTPUT
+mysql log -h <%= db_host %> -p<%= db_pass %>
+ -u<%= db_user %> -e "select count(event_requestUrl) as count, 
date(timestamp), event_requestUrl from WikimediaBlogVisit_5308166 where 
date(timestamp)=date('$DATE') group by event_requestUrl order by 
date(timestamp) desc, count desc;" > $OUTPUT
 
-cat $OUTPUT | mailx -s "Daily Blog Pageviews" tba...@wikimedia.org
+cat $OUTPUT | mailx -s "Daily Blog Pageviews" <%= recipient_email %>
 rm $OUTPUT

-- 
To view, visit https://gerrit.wikimedia.org/r/54478
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2c9ceee294108d6a44f07716ccfe722e8ee5f586
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ottomata <o...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to