Re: [rt-users] RES: Generate end of the day report and email
Hi Diaulas, can you tell me the user name that the rt command is looking for since I put root (of rt) and tried some and other rt account as well, but I am getting below error Query:Status!='resolved' and Status!='rejected' rt: Server error: Forbidden (403) Thank you and Best Regards From: Diaulas Castro diaulas.cas...@intersolution.inf.br To: rt-users@lists.bestpractical.com rt-users@lists.bestpractical.com Sent: Friday, 10 May 2013, 21:42 Subject: [rt-users] RES: Generate end of the day report and email Made this bash script to accomplish using RT CLI. Just customize “From:”, To:” and “Status” search in rt ls command and schedule on crontab. This script will list all tickets and mail fields to temp file after that a while loop will add html tags (tables and rows) trough command sed, so I got a nice looking mail report. (http://postimg.org/image/yfmlp9307/) If you want to color the rows use this before sendmail command: sed -i -e '/Nobody/s/D2EAF1/CC/g' $MAIL sed -i -e '/diaulas.castro/s/D2EAF1/6FCCFF/g' $MAIL This will change all tickets by nobody to gray and Diaulas.castro to light blue PS: I know! RT-CRONTOOL exist, but I m not perl expert.. =( export RTORDERBY=owner MAIL=/tmp/rel_todos_tickets_abertos.sh.mail echo From: MY_TICKET@MY_DOMAIN.COM $MAIL echo To: direct...@mydomain.com $MAIL echo MIME-Version: 1.0 $MAIL echo 'Content-type: text/html; charset=iso-8859-1' $MAIL echo boundary=`date +%s`/rt.MY.DOMAIN.COM $MAIL echo Subject: All open Tickets:$(date +%d/%m/%y) $MAIL echo $MAIL echo html $MAIL echo HEAD $MAIL echo /HEAD $MAIL echo BODY $MAIL echo span style=\'font-size:11.0pt;font-family:Calibri,sans-serif;color:#1F497D\' $MAIL echo table $MAIL /usr/bin/rt ls Status != resolved AND Status != report AND Status != plantao AND Status != stalled -f id,subject,queue,status,owner,lastupdated |iconv -f UTF-8 -t ISO8859-1 /tmp/rel.tmp while read line ; do echo span style='color:#00'TRTD style='background:#D2EAF1;padding:0cm 5.4pt 0cm 5.4pt'$line/TD/TR/span | sed s/ /TD style='background:#D2EAF1'/g done /tmp/rel.tmp $MAIL echo /table $MAIL echo /BODY $MAIL echo /html $MAIL /usr/sbin/sendmail -t $MAIL De:rt-users-boun...@lists.bestpractical.com [mailto:rt-users-boun...@lists.bestpractical.com] Em nome de Asanka Gunasekera Enviada em: sexta-feira, 10 de maio de 2013 05:48 Para: rt-users@lists.bestpractical.com Assunto: [rt-users] Generate end of the day report and email Hi, is there any way to auto generate end of the day report and emal this to management (all open, all new etc) I am using RT4 and oracle database on redhat Thanks and Regards -- RT Training in Seattle, June 19-20: http://bestpractical.com/training -- RT Training in Seattle, June 19-20: http://bestpractical.com/training
[rt-users] RES: Generate end of the day report and email
Made this bash script to accomplish using RT CLI. Just customize “From:”, To:” and “Status” search in rt ls command and schedule on crontab. This script will list all tickets and mail fields to temp file after that a while loop will add html tags (tables and rows) trough command sed, so I got a nice looking mail report. (http://postimg.org/image/yfmlp9307/) If you want to color the rows use this before sendmail command: sed -i -e '/Nobody/s/D2EAF1/CC/g' $MAIL sed -i -e '/diaulas.castro/s/D2EAF1/6FCCFF/g' $MAIL This will change all tickets by nobody to gray and Diaulas.castro to light blue PS: I know! RT-CRONTOOL exist, but I m not perl expert.. =( export RTORDERBY=owner MAIL=/tmp/rel_todos_tickets_abertos.sh.mail echo From: MY_TICKET@MY_DOMAIN.COM $MAIL echo To: direct...@mydomain.com $MAIL echo MIME-Version: 1.0 $MAIL echo 'Content-type: text/html; charset=iso-8859-1' $MAIL echo boundary=`date +%s`/rt.MY.DOMAIN.COM $MAIL echo Subject: All open Tickets:$(date +%d/%m/%y)$MAIL echo $MAIL echo html$MAIL echo HEAD$MAIL echo /HEAD $MAIL echo BODY$MAIL echo span style=\'font-size:11.0pt;font-family:Calibri,sans-serif;color:#1F497D\' $MAIL echo table$MAIL /usr/bin/rt ls Status != resolved AND Status != report AND Status != plantao AND Status != stalled -f id,subject,queue,status,owner,lastupdated |iconv -f UTF-8 -t ISO8859-1 /tmp/rel.tmp while read line ; do echo span style='color:#00'TRTD style='background:#D2EAF1;padding:0cm 5.4pt 0cm 5.4pt'$line/TD/TR/span | sed s//TD style='background:#D2EAF1'/g done /tmp/rel.tmp $MAIL echo /table $MAIL echo /BODY $MAIL echo /html $MAIL /usr/sbin/sendmail -t $MAIL De: rt-users-boun...@lists.bestpractical.com [mailto:rt-users-boun...@lists.bestpractical.com] Em nome de Asanka Gunasekera Enviada em: sexta-feira, 10 de maio de 2013 05:48 Para: rt-users@lists.bestpractical.com Assunto: [rt-users] Generate end of the day report and email Hi, is there any way to auto generate end of the day report and emal this to management (all open, all new etc) I am using RT4 and oracle database on redhat Thanks and Regards -- RT Training in Seattle, June 19-20: http://bestpractical.com/training
Re: [rt-users] RES: Generate end of the day report and email
On 05/10/2013 09:12 AM, Diaulas Castro wrote: Made this bash script to accomplish using RT CLI. Just customize “From:”, To:” and “Status” search in rt ls command and schedule on crontab. You really want to look at dashboards and dashboard subscriptions in RT's web interface. -- RT Training in Seattle, June 19-20: http://bestpractical.com/training
Re: [rt-users] RES: Generate end of the day report and email
Thank you Diaulas, this looks neet Bet Regards From: Diaulas Castro diaulas.cas...@intersolution.inf.br To: rt-users@lists.bestpractical.com rt-users@lists.bestpractical.com Sent: Friday, 10 May 2013, 21:42 Subject: [rt-users] RES: Generate end of the day report and email Made this bash script to accomplish using RT CLI. Just customize “From:”, To:” and “Status” search in rt ls command and schedule on crontab. This script will list all tickets and mail fields to temp file after that a while loop will add html tags (tables and rows) trough command sed, so I got a nice looking mail report. (http://postimg.org/image/yfmlp9307/) If you want to color the rows use this before sendmail command: sed -i -e '/Nobody/s/D2EAF1/CC/g' $MAIL sed -i -e '/diaulas.castro/s/D2EAF1/6FCCFF/g' $MAIL This will change all tickets by nobody to gray and Diaulas.castro to light blue PS: I know! RT-CRONTOOL exist, but I m not perl expert.. =( export RTORDERBY=owner MAIL=/tmp/rel_todos_tickets_abertos.sh.mail echo From: MY_TICKET@MY_DOMAIN.COM $MAIL echo To: direct...@mydomain.com $MAIL echo MIME-Version: 1.0 $MAIL echo 'Content-type: text/html; charset=iso-8859-1' $MAIL echo boundary=`date +%s`/rt.MY.DOMAIN.COM $MAIL echo Subject: All open Tickets:$(date +%d/%m/%y) $MAIL echo $MAIL echo html $MAIL echo HEAD $MAIL echo /HEAD $MAIL echo BODY $MAIL echo span style=\'font-size:11.0pt;font-family:Calibri,sans-serif;color:#1F497D\' $MAIL echo table $MAIL /usr/bin/rt ls Status != resolved AND Status != report AND Status != plantao AND Status != stalled -f id,subject,queue,status,owner,lastupdated |iconv -f UTF-8 -t ISO8859-1 /tmp/rel.tmp while read line ; do echo span style='color:#00'TRTD style='background:#D2EAF1;padding:0cm 5.4pt 0cm 5.4pt'$line/TD/TR/span | sed s/ /TD style='background:#D2EAF1'/g done /tmp/rel.tmp $MAIL echo /table $MAIL echo /BODY $MAIL echo /html $MAIL /usr/sbin/sendmail -t $MAIL De:rt-users-boun...@lists.bestpractical.com [mailto:rt-users-boun...@lists.bestpractical.com] Em nome de Asanka Gunasekera Enviada em: sexta-feira, 10 de maio de 2013 05:48 Para: rt-users@lists.bestpractical.com Assunto: [rt-users] Generate end of the day report and email Hi, is there any way to auto generate end of the day report and emal this to management (all open, all new etc) I am using RT4 and oracle database on redhat Thanks and Regards -- RT Training in Seattle, June 19-20: http://bestpractical.com/training -- RT Training in Seattle, June 19-20: http://bestpractical.com/training