[rt-users] Custom Condition To Send Email on Resolve if No Article Sent as Part of Resolve

2014-08-02 Thread Foggi, Nicola
Version : RT-4.0.19

Hey All,

Running into a slight problem with a new queue I'm attempting to roll out a new 
queue that uses some pre-canned template responses using Articles from the 
integrated RTFM system in 4.0.19 now.  I've changed the lifecycle to make the 
open - resolve a default RESPOND vs COMMENT and that's working.  However, I 
want to send a default template response if the admin forgets to choose an 
article to respond with.  I came up with the following code below for the 
custom codition.  I'm detecting if the ticket has a ReferTo set and then if it 
doesn't return code 1 to that the scrip executes which sends the template, 
otherwise, sets it to 0 so it skips the scrip.

The problem I'm running into is it appears the run the scrip prior to linking 
the article to ticket, so it always thinks the admin hasn't attached an article 
when they actually have.  Is there anything I can do to execute the scrip post 
process of attaching the article (I tried setting it to Transaction Batch).

Any ideas would be greatly appreciated.

Thanks

Nicola

[custom condition below]

my $RefersToTickets = $self-TicketObj-RefersTo;
my $FirstRefersToTicketLink = $RefersToTickets-Next;

my $returncode = 0;

my $txn = $self-TransactionObj;#
my $type = $txn-Type;
return 0 unless $type eq Status
|| ( $type eq 'Set'  $txn-Field eq 'Status');

if ($txn-NewValue eq resolved) {

   eval {$FirstRefersToTicketLink-TargetURI-URI};
   my $results = $@;
   $RT::Logger-info('219 - ' . $results);
   if ($results =~ qr{^Can't call method}) {
  $RT::Logger-info('UNDEFINED');
  $returncode = 1;
   } else {
  $returncode = 0;
   };

};
  
$RT::Logger-info('Return Code: ' . $returncode); 
return $returncode;
-- 
RT Training - Boston, September 9-10
http://bestpractical.com/training


Re: [rt-users] Custom Condition To Send Email on Resolve if No Article Sent as Part of Resolve

2014-08-02 Thread Foggi, Nicola

I'm thinking this comment in Ticket.pm might be related to what I'm seeing:

# Deal with setting up links

# TODO: Adding link may fire scrips on other end and those scrips
# could create transactions on this ticket before 'Create' transaction.
#
# We should implement different lifecycle: record 'Create' transaction,
# create links and only then fire create transaction's scrips.
#
# Ideal variant: add all links without firing scrips, record create
# transaction and only then fire scrips on the other ends of links.
#
# //RUZ

Looks like that comment still exists in the 4.2 code?  Any ideas on a 
workaround if this is indeed what I'm running into?

Nicola


From: Foggi, Nicola
Sent: Saturday, August 02, 2014 7:45 PM
To: rt-users@lists.bestpractical.com
Subject: Custom Condition To Send Email on Resolve if No Article Sent as Part 
of Resolve

Version : RT-4.0.19

Hey All,

Running into a slight problem with a new queue I'm attempting to roll out a new 
queue that uses some pre-canned template responses using Articles from the 
integrated RTFM system in 4.0.19 now.  I've changed the lifecycle to make the 
open - resolve a default RESPOND vs COMMENT and that's working.  However, I 
want to send a default template response if the admin forgets to choose an 
article to respond with.  I came up with the following code below for the 
custom codition.  I'm detecting if the ticket has a ReferTo set and then if it 
doesn't return code 1 to that the scrip executes which sends the template, 
otherwise, sets it to 0 so it skips the scrip.

The problem I'm running into is it appears the run the scrip prior to linking 
the article to ticket, so it always thinks the admin hasn't attached an article 
when they actually have.  Is there anything I can do to execute the scrip post 
process of attaching the article (I tried setting it to Transaction Batch).

Any ideas would be greatly appreciated.

Thanks

Nicola

[custom condition below]

my $RefersToTickets = $self-TicketObj-RefersTo;
my $FirstRefersToTicketLink = $RefersToTickets-Next;

my $returncode = 0;

my $txn = $self-TransactionObj;#
my $type = $txn-Type;
return 0 unless $type eq Status
|| ( $type eq 'Set'  $txn-Field eq 'Status');

if ($txn-NewValue eq resolved) {

   eval {$FirstRefersToTicketLink-TargetURI-URI};
   my $results = $@;
   $RT::Logger-info('219 - ' . $results);
   if ($results =~ qr{^Can't call method}) {
  $RT::Logger-info('UNDEFINED');
  $returncode = 1;
   } else {
  $returncode = 0;
   };

};

$RT::Logger-info('Return Code: ' . $returncode);
return $returncode;
-- 
RT Training - Boston, September 9-10
http://bestpractical.com/training


Re: [rt-users] Custom Condition To Send Email on Resolve if No Article Sent as Part of Resolve

2014-08-02 Thread Foggi, Nicola

Thanks Alex,

That code with some modification worked for me, I only want the scip to 
apply IF Status changed - resolved AND NOT if RefersTo link is added (I 
can ignore the correspondence I think safely as the significant event is 
the addlink to the article (that it's set already to send out via a 
lifecycle setting)  I guess feasibly the user could change it to be a 
comment vs correspondence, so I'll have to think about that.  I modified 
your code to the follow for the list if anyone else needs it (just a 
slight change on the logic of the return codes.  I didn't kill the 
correspondence yet incase I end up using it.

Thanks for your help!

Nicola

[final code used for now]

my ($found_correspondence, $found_resolved, $found_refersto);
my @txns = @{ $self-TicketObj-TransactionBatch };
for my $txn (@txns) {

 # look for correspondence
 if ($txn-Type eq 'Correspond') {
 RT::Logger-debug('this operation involves correspondence');
 $found_correspondence++;
 next;
 }

 # look for status change to resolved
 if (
 (
 $txn-Type eq 'Status'
 or ($txn-Type eq 'Set' and $txn-Field eq 'Status')
 )
 and $txn-NewValue eq 'resolved'
 ) {
 RT::Logger-debug('this operation involves resolution');
 $found_resolved++;
 next;
 }

 # look for addition of RefersTo link
 if ($txn-Type eq 'AddLink' and $txn-Field eq 'RefersTo') {
 RT::Logger-debug('this operation involves adding a RefersTo 
link');
 $found_refersto++;
 next;
 }

}

if ($found_resolved) {

 return 1 if not ($found_correspondence  $found_refersto);
 return 0;

}

return 0;
-- 
RT Training - Boston, September 9-10
http://bestpractical.com/training


Re: [rt-users] Slow MySQL after upgrade from 3.8.6 to 3.8.8

2010-08-18 Thread Foggi, Nicola

I had the same problem and ended up dropping the Groups2 index and performance 
went back to normal

Nicola

-Original Message-
From: rt-users-boun...@lists.bestpractical.com on behalf of Alex Young
Sent: Wed 8/18/2010 6:07 AM
To: rt-users@lists.bestpractical.com
Subject: [rt-users] Slow MySQL after upgrade from 3.8.6 to 3.8.8
 
Hi,

Since upgrading from 3.8.6 to 3.8.8 our RT system has
been very slow to return any pages containing ticket data such as the
home page, searches and tickets themselves.

 

I enabled the MySQL slow running query log and this was at the top of
the list:

 

mysqldumpslow -t 10 /var/log/mysql/mysql-slow.log

Reading mysql slow query log from /var/log/mysql/mysql-slow.log

Count: 47  Time=10.12s (475s)  Lock=0.00s (0s)  Rows=1.0 (47),
rtuser[rtus...@*

  SELECT GET_LOCK('S', N)

 

Any ideas?

 

Thanks.



RT Training in Washington DC, USA on Oct 25  26 2010
Last one this year -- Learn how to get the most out of RT!

Re: [rt-users] Approvals not working

2010-07-29 Thread Foggi, Nicola

i spent a good few weeks playing with it before, and i just resorted to using 
the __Approvals queue... but i remember seeing inconsistencies in some of the 
docs about how to setup approvals under older version and what i was seeing in 
3.8... if i remember correctly, some of the approval stuff was done via scrips 
before, those are now no longer there and are handled within the DB/APP, but 
not just a simple scrip anymore...

Nicola

-Original Message-
From: rt-users-boun...@lists.bestpractical.com on behalf of Michael James
Sent: Thu 7/29/2010 3:43 PM
To: RT Users
Subject: Re: [rt-users] Approvals not working
 
I queried the rt3 MySQL database to see what I could see vis-a-vis the approval 
process. In points 1, 2, 3, and 4, I'm building a case to prove I'm not crazy. 
If you can explain the results of Quick search in #5, I would be highly 
appreciative!

1. SELECT * FROM `rt3`.`Queues` where Name = 'ChangeApproval'
1 row fetched: 22, 'ChangeApproval', 'Queue to hold templates for Change Mgmt 
approval', '', '', 0, 0, 0, 28, '2007-01-04 19:42:12', 28, '2007-01-04 
19:42:12', 0

2. SELECT * FROM `rt3`.`Tickets` where Queue = '22'
19 rows fetched. Here are some columns of data. Sorry I can't show all. 

id  EffectiveId Status
11571157new
28492849new
74587458new
74617461new
74647464new
74667466new
820 820 resolved
822 822 resolved
824 824 resolved
26572657resolved
28512851resolved
28762876resolved
28782878resolved
28802880resolved
28822882resolved
28842884resolved
28862886resolved
28882888resolved
29172917resolved


3. Now, note the headers below for ticket #7461, which confirms Queue = 
ChangeApproval. 

Wed Jul 28 13:59:08 2010: Request 7461 was acted upon.
Transaction: Ticket created by RT_System
   Queue: ChangeApproval
 Subject: Approve Change Request for another test
   Owner: Nobody
  Requestors: 
  Status: new
Ticket URL: http://tracker.stonebridgebank.com/rt/Ticket/Display.html?id=7461 

Someone has created a Change Request.  Please review.

4. SELECT * FROM `rt3`.`Tickets` where id = '7461'

id  EffectiveId Queue   Type
7461746122  approval

5. From my RT at a Glance page, when I click on the quick search for 
ChangeApproval queue - returns 0 hits. 

http://tracker.stonebridgebank.com/rt/Search/Results.html?Query=Queue = 
'ChangeApproval' AND (Status = 'new' OR Status = 'open' OR Status = 'stalled')

Why don't any of the approvals with status=new show in the results screen? Any 
ideas what is going on here?

Mike



 Michael James mja...@stonebridgebank.com 7/28/2010 4:57 PM 
It worked on 3.4.6, which is the version we were using before 3.8.8.

 Foggi, Nicola nfo...@depaul.edu 7/28/2010 4:48 PM 


I was never able to get a queue working with approvals other than the default 
__Approvals queue, if you use that does it work?

Nicola

-Original Message-
From: rt-users-boun...@lists.bestpractical.com on behalf of Michael James
Sent: Wed 7/28/2010 3:38 PM
To: RT Users rt-users@lists.bestpractical.com 
Subject: [rt-users] Approvals not working

Hi, I used example code on the wiki to create a PO-Request type approval in 
RT3.8.8 http://wiki.bestpractical.com/view/ApprovalCreation The process creates 
new ticket(s) but isn't quite right yet.

I created 2 queues: ChangeRequest and ChangeApproval and both are enabled.

ChangeRequest queue has 1 scrip:

On Create, Create Tickets with template CreateApproval, stage 
TransactionCreate. with no User defined conditions.

The CreateApproval template is pretty much cut-n-paste from the wiki:

===Create-Ticket: poreq
Subject: Approve Change Request for {$Tickets{'TOP'}-Subject}
Depended-On-By: TOP
Queue: ChangeApproval
Type: approval
Owner: username-of-owner   #note this is so that notifications work properly
Content: Someone has created a Change Request.  Please review.
ENDOFCONTENT

For the ChangeApproval queue, I copied/pasted all of the scrips and templates 
from the default __Approvals queue. 

When I create a new ticket in the ChangeRequest queue, a 2nd ticket is created 
and notifications are sent to the watchers that a new ticket is awaiting 
approval. However, the approvals don't show up in My Approvals. Nor do they 
show up in the ChangeApproval queue when I search for them. The 
tickets/approvals exist, I can see them in the Tickets table with type=approval.

I can't sort out what I've done wrong. Any ideas?

Mike




The information in this message may be proprietary and/or confidential, and 
protected from disclosure. If the reader of this message is not the intended 
recipient, or an employee or agent responsible for delivering this message to 
the intended recipient, you are hereby

Re: [rt-users] Mysql queries slow

2010-07-21 Thread Foggi, Nicola


with no real mysql tweaking on RT 3.8.8 I get:

mysql select count(id) from Attachments;
+---+
| count(id) |
+---+
| 41636 | 
+---+
1 row in set (0.62 sec)

while significantly less that yours, .62 seconds isn't too shabby... 

-Original Message-
From: rt-users-boun...@lists.bestpractical.com on behalf of William Graboyes
Sent: Wed 7/21/2010 8:19 PM
To: rt-users
Subject: [rt-users] Mysql queries slow
 
Hi List,

As an example of what I  am talking about the query `select count(id) from
Attachments;`  The returned result is 174039, but it takes 39.1549 seconds
to return that simple query.  The Transactions table returns 343259 in .4358
seconds.  Does anyone have some optimization tips beyond what is already on
the wiki.

After a little more of my own tweaking I have the Attachments query down to
24.9559 seconds.

Has anyone successfully integrated RT3 with memcached?  Would I be better
off moving the mysql server to it's own server?

Running version:
RT 3.8.7
MySQL 5.0.67

Total tickets as of this writing:
7282

Total time on RT:
1yr 3m

Thanks in advance for any help that can be provided.


Thanks,
Bill


Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Re: [rt-users] RT 3.8.8 - Can a superuser reset a users password?

2010-07-10 Thread Foggi, Nicola

yeah i definitely didn't notice that... wonder if there is another way to word 
it/display it, i got a couple emails from a few different people telling me 
they thought the same thing and realized it was asking them for there own 
password not the users password they were trying to change.

-Original Message-
From: rt-users-boun...@lists.bestpractical.com on behalf of Kevin Falcone
Sent: Sat 7/10/2010 3:17 PM
To: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] RT 3.8.8 - Can a superuser reset a users password?
 
On Fri, Jul 09, 2010 at 09:22:58PM -0500, Foggi, Nicola wrote:
So under 3.8.8 you need to know the old password for the user.  If a user 
 forgets the
password, and an admin needs to reset it, it appears the admin has to also 
 know the old
password (as when i left it blank it told me to enter my current password).
 
Maybe i'm missing something simple?

It says Your current password not The user's current password

-kevin

winmail.dat
Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Re: [rt-users] Slow Ticket History 3.8.8

2010-06-29 Thread Foggi, Nicola

I did just have a problem with 3.8.8 and one of the indexes (didn't have the 
problem on 3.8.6 or below).  It turned out to be the index GROUPS2 on the 
Groups table... dropped the index, and performance was back to normal (pre 
3.8.8)

Nicola

-Original Message-
From: rt-users-boun...@lists.bestpractical.com on behalf of Justin Hayes
Sent: Tue 6/29/2010 9:28 AM
To: Jason Doran
Cc: rt Users
Subject: Re: [rt-users] Slow Ticket History 3.8.8
 
Thanks Jason - I'll give that a go as well. We have got a large DB (~10gb) so 
keeping it tuned is definitely important.

However as stated the time seems to be lost in code, after I'd have thought it 
had run the query for the ticket (though I may be wrong in that assumption).

Cheers,

Justin

-
Justin Hayes
OpenBet Support Manager
justin.ha...@openbet.com

On 29 Jun 2010, at 15:22, Jason Doran wrote:

 Hi,
 If you are using mysqld have a look at mysqltuner.pl perl script (google)
 This has fixed quickly many performance issues on both RT and other
 web-based software we use. I run this every few weeks and apply suggested
 changes and then simply restart mysqld when things are quite.
 
 Regards,
 Jason Doran
 Computer Centre
 NUI, Maynooth
 
 On 29 Jun 2010, at 14:09, Justin Hayes wrote:
 
 Hi everyone,
 
 I've raised this before, but we've had another look at it and still can't 
 see how to improve things.
 
 We put a lot of comments/replies in our tickets. Often there can be 50-100 
 entries in a ticket, mostly plain text. Loading such a ticket can take 
 10-20secs.
 
 We don't have any slow queries - all the time seems to be in the code 
 rendering the history of the ticket.
 We've had a go at stripping functions out of ShowHistory, ShowTransaction 
 and ShowTransactionAttachmments but not had much success.
 
 FWIW our RT runs on quad 3ghz Xeons with 8gb of ram.
 
 I'd like to try and determine if we're just slow, or if this is just how 
 long RT takes. Maybe perl is just slow.
 
 Can anyone shed any light on how long it takes them to render long tickets 
 in their systems? If you look at the page source it gives you a value e.g.
 
 spanTime to display: 24.996907/span
 
 Can anyone share some numbers from theirs for longer tickets? It would be 
 really appreciated.
 
 
 Thanks,
 
 Justin
 
 -
 Justin Hayes
 OpenBet Support Manager
 justin.ha...@openbet.com
 
 
 Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
 Buy a copy at http://rtbook.bestpractical.com
 



Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Re: [rt-users] slow mysql query after upgrade from 3.8.6 to 3.8.8

2010-06-25 Thread Foggi, Nicola

I forgot to include the top part with the query stats:

# Time: 100624 22:44:19
# u...@host: rt_user[rt_user] @ rt.internal [10.12.10.72]
# Query_time: 12  Lock_time: 0  Rows_sent: 8  Rows_examined: 3314678
use rt3;
SELECT DISTINCT main.* FROM Users main JOIN Principals Principals_1  ON ( 
Principals_1.id = main.id ) JOIN CachedGroupMembers CachedGroupMem
bers_2  ON ( CachedGroupMembers_2.MemberId = Principals_1.id ) JOIN Groups 
Groups_3  ON ( Groups_3.id = CachedGroupMembers_2.GroupId )  WHER
E (Principals_1.Disabled = '0') AND (Principals_1.id != '1') AND 
(Principals_1.PrincipalType = 'User') AND ((Groups_3.Domain = 'RT::Queue-Ro
le' AND Groups_3.Instance = '3') OR (Groups_3.Domain = 'RT::System-Role')) AND 
(Groups_3.Type = 'AdminCc')  ORDER BY main.Name ASC;

Is there a reason it's looking at 3314678 rows for what returns the user 
listing?

Nicola

2010/6/25 Foggi, Nicola nfo...@depaul.edu


 hey everyone,

 after upgrading from 3.8.6 to 3.8.8 we're getting a slow query on this
 query:

 use rt3;
 SELECT DISTINCT main.* FROM Users main JOIN Principals Principals_1  ON (
 Principals_1.id = main.id ) JOIN CachedGroupMembers CachedGroupMembers_2
 ON ( CachedGroupMembers_2.MemberId = Principals_1.id ) JOIN Groups Groups_3
 ON ( Groups_3.id = CachedGroupMembers_2.GroupId )  WHERE
 (Principals_1.Disabled = '0') AND (Principals_1.id != '1') AND
 (Principals_1.PrincipalType = 'User') AND ((Groups_3.Domain =
 'RT::Queue-Role' AND Groups_3.Instance = '3') OR (Groups_3.Domain =
 'RT::System-Role')) AND (Groups_3.Type = 'AdminCc')  ORDER BY main.Name ASC;
 # Time: 100624 22:44:20
 # u...@host: rt_user[rt_user] @ rt.internal [10.12.10.72]
 # Query_time: 13  Lock_time: 0  Rows_sent: 1  Rows_examined: 0
 SELECT GET_LOCK('Apache-Session-dc95ab57bb8d19e23fa6fa70314e3c0e', 3600);
 # Time: 100624 22:49:28

 when loading any ticket page.  I've verified the cachedgroupmembers3 index
 is in place:

 show index from CachedGroupMembers;
 ...
 | CachedGroupMembers |  1 | CachedGroupMembers3 |1 |
 MemberId  | A |   36038 | NULL | NULL   | YES  |
 BTREE  | NULL|
 | CachedGroupMembers |  1 | CachedGroupMembers3 |2 |
 ImmediateParentId | A |   36038 | NULL | NULL   | YES  |
 BTREE  | NULL|


 but still extremely slow... any ideas?  it's pretty bad...

 Nicola


 Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
 Buy a copy at http://rtbook.bestpractical.com



Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Re: [rt-users] slow mysql query after upgrade from 3.8.6 to 3.8.8

2010-06-25 Thread Foggi, Nicola

UseSQLForACLChecks is set as the default under RT_Config.pm to 
Set($UseSQLForACLChecks, undef);

here is the explain:

EXPLAIN SELECT DISTINCT main.* FROM Users main JOIN Principals Principals_1  ON 
( Principals_1.id = main.id ) JOIN CachedGroupMembers CachedGroupMembers_2  ON 
( CachedGroupMembers_2.MemberId = Principals_1.id ) JOIN Groups Groups_3  ON ( 
Groups_3.id = CachedGroupMembers_2.GroupId )  WHERE (Principals_1.Disabled = 
'0') AND (Principals_1.id != '1') AND (Principals_1.PrincipalType = 'User') AND 
((Groups_3.Domain = 'RT::Queue-Role' AND Groups_3.Instance = '3') OR 
(Groups_3.Domain = 'RT::System-Role')) AND (Groups_3.Type = 'AdminCc')  ORDER 
BY main.Name ASC;
++-+--++++-+-+--+--+
| id | select_type | table| type   | possible_keys  
| key| key_len | ref | rows | Extra 
   |
++-+--++++-+-+--+--+
|  1 | SIMPLE  | main | range  | PRIMARY
| PRIMARY| 4   | NULL|  316 | Using 
where; Using temporary; Using filesort | 
|  1 | SIMPLE  | Groups_3 | ref| PRIMARY,Groups1,Groups2
| Groups2| 67  | const   | 3992 | Using 
where; Distinct| 
|  1 | SIMPLE  | Principals_1 | eq_ref | PRIMARY
| PRIMARY| 4   | rt3.main.id |1 | Using 
where; Distinct| 
|  1 | SIMPLE  | CachedGroupMembers_2 | ref| 
DisGrouMem,CachedGroupMembers3 | DisGrouMem | 10  | 
rt3.Groups_3.id,rt3.Principals_1.id |1 | Using where; Using index; Distinct 
  | 
++-+--++++-+-+--+--+
4 rows in set (0.00 sec)

here is the indexes:

mysql show index from Groups;
+++--+--+-+---+-+--++--++-+
| Table  | Non_unique | Key_name | Seq_in_index | Column_name | Collation | 
Cardinality | Sub_part | Packed | Null | Index_type | Comment |
+++--+--+-+---+-+--++--++-+
| Groups |  0 | PRIMARY  |1 | id  | A | 
  21563 | NULL | NULL   |  | BTREE  | NULL| 
| Groups |  1 | Groups1  |1 | Domain  | A | 
 31 | NULL | NULL   | YES  | BTREE  | NULL| 
| Groups |  1 | Groups1  |2 | Instance| A | 
  21563 | NULL | NULL   | YES  | BTREE  | NULL| 
| Groups |  1 | Groups1  |3 | Type| A | 
  21563 | NULL | NULL   | YES  | BTREE  | NULL| 
| Groups |  1 | Groups1  |4 | id  | A | 
  21563 | NULL | NULL   |  | BTREE  | NULL| 
| Groups |  1 | Groups2  |1 | Type| A | 
 10 | NULL | NULL   | YES  | BTREE  | NULL| 
| Groups |  1 | Groups2  |2 | Instance| A | 
  21563 | NULL | NULL   | YES  | BTREE  | NULL| 
+++--+--+-+---+-+--++--++-+
7 rows in set (0.00 sec)

I did find in some trial and error testing if I drop the  OR (Groups_3.Domain 
= 'RT::System-Role') from the query it gives the same results in under 1 
second vs 11-12 seconds, but bot sure what that OR is adding into the mix.  
That query is what is performed when I display a ticket through the web 
interface.

Any help is appreciated!

Nicola

-Original Message-
From: ruslan.zaki...@gmail.com on behalf of Ruslan Zakirov
Sent: Fri 6/25/2010 11:05 AM
To: Foggi, Nicola
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] slow mysql query after upgrade from 3.8.6 to 3.8.8
 
Hello,

Do you use SQLForACLChecks option?
Where is EXPLAIN for this query?
Show indexes from Groups table.

On Fri, Jun 25, 2010 at 8:04 AM, Foggi, Nicola nfo...@depaul.edu wrote:

 hey everyone,

 after upgrading from 3.8.6 to 3.8.8 we're getting a slow query on this
 query:

 use rt3;
 SELECT DISTINCT main.* FROM Users main JOIN Principals Principals_1  ON (
 Principals_1.id = main.id ) JOIN CachedGroupMembers

Re: [rt-users] slow mysql query after upgrade from 3.8.6 to 3.8.8

2010-06-25 Thread Foggi, Nicola

I think i've tracked it down to:

commit  932a5a25a3520f42471e

for Users_Overlay.pm, when I back Users_Overlay back up to the version 
previous, no problems with a slow query, but whatever query this is building is 
the problem.  I'm going to try and dig into the code to see if I can tell where 
it goes wrong, but any ideas on where to start?  My guess is something around 
the IncludeSystemRights logic somewhere in WhoHaveRight or WhoHaveRoleRight?

Nicola

-Original Message-
From: ruslan.zaki...@gmail.com on behalf of Ruslan Zakirov
Sent: Fri 6/25/2010 11:05 AM
To: Foggi, Nicola
Cc: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] slow mysql query after upgrade from 3.8.6 to 3.8.8
 
Hello,

Do you use SQLForACLChecks option?
Where is EXPLAIN for this query?
Show indexes from Groups table.

On Fri, Jun 25, 2010 at 8:04 AM, Foggi, Nicola nfo...@depaul.edu wrote:

 hey everyone,

 after upgrading from 3.8.6 to 3.8.8 we're getting a slow query on this
 query:

 use rt3;
 SELECT DISTINCT main.* FROM Users main JOIN Principals Principals_1  ON (
 Principals_1.id = main.id ) JOIN CachedGroupMembers CachedGroupMembers_2  ON
 ( CachedGroupMembers_2.MemberId = Principals_1.id ) JOIN Groups Groups_3  ON
 ( Groups_3.id = CachedGroupMembers_2.GroupId )  WHERE (Principals_1.Disabled
 = '0') AND (Principals_1.id != '1') AND (Principals_1.PrincipalType =
 'User') AND ((Groups_3.Domain = 'RT::Queue-Role' AND Groups_3.Instance =
 '3') OR (Groups_3.Domain = 'RT::System-Role')) AND (Groups_3.Type =
 'AdminCc')  ORDER BY main.Name ASC;
 # Time: 100624 22:44:20
 # u...@host: rt_user[rt_user] @ rt.internal [10.12.10.72]
 # Query_time: 13  Lock_time: 0  Rows_sent: 1  Rows_examined: 0
 SELECT GET_LOCK('Apache-Session-dc95ab57bb8d19e23fa6fa70314e3c0e', 3600);
 # Time: 100624 22:49:28

 when loading any ticket page.  I've verified the cachedgroupmembers3 index
 is in place:

 show index from CachedGroupMembers;
 ...
 | CachedGroupMembers |  1 | CachedGroupMembers3 |    1 |
 MemberId  | A |   36038 | NULL | NULL   | YES  |
 BTREE  | NULL    |
 | CachedGroupMembers |  1 | CachedGroupMembers3 |    2 |
 ImmediateParentId | A |   36038 | NULL | NULL   | YES  |
 BTREE  | NULL    |


 but still extremely slow... any ideas?  it's pretty bad...

 Nicola

 Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
 Buy a copy at http://rtbook.bestpractical.com




-- 
Best regards, Ruslan.


Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

[rt-users] slow mysql query after upgrade from 3.8.6 to 3.8.8

2010-06-24 Thread Foggi, Nicola

hey everyone,

after upgrading from 3.8.6 to 3.8.8 we're getting a slow query on this query:

use rt3;
SELECT DISTINCT main.* FROM Users main JOIN Principals Principals_1  ON ( 
Principals_1.id = main.id ) JOIN CachedGroupMembers CachedGroupMembers_2  ON ( 
CachedGroupMembers_2.MemberId = Principals_1.id ) JOIN Groups Groups_3  ON ( 
Groups_3.id = CachedGroupMembers_2.GroupId )  WHERE (Principals_1.Disabled = 
'0') AND (Principals_1.id != '1') AND (Principals_1.PrincipalType = 'User') AND 
((Groups_3.Domain = 'RT::Queue-Role' AND Groups_3.Instance = '3') OR 
(Groups_3.Domain = 'RT::System-Role')) AND (Groups_3.Type = 'AdminCc')  ORDER 
BY main.Name ASC;
# Time: 100624 22:44:20
# u...@host: rt_user[rt_user] @ rt.internal [10.12.10.72]
# Query_time: 13  Lock_time: 0  Rows_sent: 1  Rows_examined: 0
SELECT GET_LOCK('Apache-Session-dc95ab57bb8d19e23fa6fa70314e3c0e', 3600);
# Time: 100624 22:49:28

when loading any ticket page.  I've verified the cachedgroupmembers3 index is 
in place:

show index from CachedGroupMembers;
...
| CachedGroupMembers |  1 | CachedGroupMembers3 |1 | 
MemberId  | A |   36038 | NULL | NULL   | YES  | BTREE  
| NULL| 
| CachedGroupMembers |  1 | CachedGroupMembers3 |2 | 
ImmediateParentId | A |   36038 | NULL | NULL   | YES  | BTREE  
| NULL| 


but still extremely slow... any ideas?  it's pretty bad...

Nicola

Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

[rt-users] Ticket Status Change on Final Chained Approval

2010-03-23 Thread Foggi, Nicola

Hey Everyone,

So we have implemented approvals under RT 3.8.6 basically to track and approval 
purchase requests.  The request has to go through 2 levels of approvals, at 
which point i have it setup to email our purchasing department the information 
to complete the purchase.  In researching how to do this, I came up with a 
scrip custom condition of:

my $newstatus = $self-TicketObj-Status;
my $oldstatus = $self-TransactionObj-OldValue;
my $dependencies = $self-TicketObj-HasUnresolvedDependencies;

$RT::Logger-crit(qq(New Status $newstatus Old Status $oldstatus Dependencies 
$dependencies));

if (($newstatus eq 'open')  ($dependencies eq '')) {

  return 1;

}

which seemed to do the trick until today, when a ticket accidentally got 
re-opened after it had been rejected.  So I modified the check to be:

if (($newstatus eq 'open')  ($dependencies eq '')  ($oldstatus ne 
'rejected')  ($oldstatus ne 'resolved')) {

which seems to work, but is there an event to actually check the status when it 
leaves a Pending Approval state to Open.  It appears to go to an Open 
state after the first approver approvals it, though the GUI still shows it 
pending approval, since it has the second approval that has to pass, and only 
when that one passes does it move to a visable state of Open, but in the 
backend, rt will log this on the initial approval:

RT: New Status open Old Status  Dependencies 1 ((eval 1909):5) 

so there is no Old Status as seen by my log message.  Should I maybe modify 
it to only run this scrip when oldstatus = '', newstatus = 'open' and 
depenedencies = ''? would that be the best check? or is there a way to actually 
check the approval state?

Thanks!

Nicola

Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Re: [rt-users] Approval Queue Approved/Rejected Templates and Parent Request Correspondence

2010-03-03 Thread Foggi, Nicola

Oh good idea!  So if the template is blank it essentially won't do anything?

I'll give that a try!

Thanks!

Nicola

-Original Message-
From: rt-users-boun...@lists.bestpractical.com on behalf of Kevin Falcone
Sent: Wed 3/3/2010 9:13 AM
To: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] Approval Queue Approved/Rejected Templates and Parent 
Request Correspondence
 
On Tue, Mar 02, 2010 at 11:33:24PM -0600, Foggi, Nicola wrote:
Hey Everyone,
 
So we're utilizing approvals, and when an approver approvals or rejects a 
 request, the owner
of the parent request gets double notifications.  The first is from the 
 templates:
 
Approval Passed
All Approvals Passed
Approval Rejected
 
the 2nd email is the fact that it puts the notes from the approver as 
 correspondence on the
original request.  It looks like the template names are hard coded into 
 the code, so if I were
to rename them (as to not delete them) what would that break?
 
or is there a way to filter the and id that it's correspondence from the 
 approval system and
not send that email notification out but send others out?  we want to be 
 able to receive
correspondence updated, i might be able to filter on the subject since 
 that's defined from the
approval template?
 
thoughts?  or am I missing a simple fix?

I suspect you actually just want a blank Correspondence or Admin
Correspondence template in the ___Approvals queue, so that the normal
On Correspond Notify Foo scrip won't send mail for that queue

-kevin


___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com

2010 RT Training Sessions!
San Francisco, CA, USA - Feb 22  23
Dublin, Ireland - Mar 15  16
Boston, MA, USA - April 5  6
Washington DC, USA - Oct 25  26

Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com

[rt-users] Approval Queue Approved/Rejected Templates and Parent Request Correspondence

2010-03-02 Thread Foggi, Nicola

Hey Everyone,

So we're utilizing approvals, and when an approver approvals or rejects a 
request, the owner of the parent request gets double notifications.  The 
first is from the templates:

Approval Passed
All Approvals Passed
Approval Rejected

the 2nd email is the fact that it puts the notes from the approver as 
correspondence on the original request.  It looks like the template names are 
hard coded into the code, so if I were to rename them (as to not delete them) 
what would that break?

or is there a way to filter the and id that it's correspondence from the 
approval system and not send that email notification out but send others out?  
we want to be able to receive correspondence updated, i might be able to filter 
on the subject since that's defined from the approval template?

thoughts?  or am I missing a simple fix?

Nicola
___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com

2010 RT Training Sessions!
San Francisco, CA, USA - Feb 22  23
Dublin, Ireland - Mar 15  16
Boston, MA, USA - April 5  6
Washington DC, USA - Oct 25  26

Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com

Re: [rt-users] Approval Queue Approved/Rejected Templates and ParentRequest Correspondence

2010-03-02 Thread Foggi, Nicola

I should of mentioned it's 3.8.6... 

-Original Message-
From: rt-users-boun...@lists.bestpractical.com on behalf of Foggi, Nicola
Sent: Tue 3/2/2010 11:33 PM
To: rt-users@lists.bestpractical.com
Subject: [rt-users] Approval Queue Approved/Rejected Templates and 
ParentRequest Correspondence
 

Hey Everyone,

So we're utilizing approvals, and when an approver approvals or rejects a 
request, the owner of the parent request gets double notifications.  The 
first is from the templates:

Approval Passed
All Approvals Passed
Approval Rejected

the 2nd email is the fact that it puts the notes from the approver as 
correspondence on the original request.  It looks like the template names are 
hard coded into the code, so if I were to rename them (as to not delete them) 
what would that break?

or is there a way to filter the and id that it's correspondence from the 
approval system and not send that email notification out but send others out?  
we want to be able to receive correspondence updated, i might be able to filter 
on the subject since that's defined from the approval template?

thoughts?  or am I missing a simple fix?

Nicola


___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com

2010 RT Training Sessions!
San Francisco, CA, USA - Feb 22  23
Dublin, Ireland - Mar 15  16
Boston, MA, USA - April 5  6
Washington DC, USA - Oct 25  26

Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com

Re: [rt-users] ExternalAuth TLS to Active DirectoryLDAP_OPERATIONS_ERROR 1 on Bind

2009-11-18 Thread Foggi, Nicola

Looking at a tcpdump, as soon as the ldap server returns Server Hello Done 
the RT server sends a FIN/ACK to close the connection, this all happens prior 
to the bind attempt, so when the bind attempt happens, it fails.

I have verify='none' set in the start_tls command, but still nothing...

Thoughts?

Nicola

-Original Message-
From: rt-users-boun...@lists.bestpractical.com on behalf of Foggi, Nicola
Sent: Wed 11/18/2009 1:41 PM
To: rt-users@lists.bestpractical.com
Subject: [rt-users] ExternalAuth TLS to Active DirectoryLDAP_OPERATIONS_ERROR 1 
on Bind
 

Hey Everyone,

So I got the ExternalAuth module working to Active Directory NON TLS enabled, 
however, when I set it to use TLS I get a:

LDAP_OPERATIONS_ERROR

returned on the bind.  I'm looking at ways to troubleshoot it, i have tls set 
to verify=none so it shouldn't be a certificate problem, but i'm at a loss of 
other ways to troubleshoot/track down the problem.

A stand alone perl script that i wrote to test with that calls Net::LDAP and 
start_tls binds ok from the box, so that even made it more confusing.

Any thoughts?  

Nicola

___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com

[rt-users] RTx::WorkFlowBuilder Depends On Question

2009-11-17 Thread Foggi, Nicola

Hey Everyone,

I'm working on setting up RTx::WorkFlowBuilder, I have the following in my 
RT_SiteConfig:


Set($WorkflowBuilderStages,
{ 'approver1-approval' =
  { content = 'content',
subject = 'Architect Approval for Request: {$Approving-Id} - 
{$Approving-Subject}',
owner = 'approver1'
},
  'approver2-approval' =
  { content = 'content',
subject = 'Architect Approval for Request: {$Approving-Id} - 
{$Approving-Subject}',
owner = 'approver2'
},
  'director-approval' =
  { content = 'content',
subject = 'Director Approval for  Request: {$Approving-Id} - 
{$Approving-Subject}',
owner = 'director'},
}
   );

Set( $WorkflowBuilderRules,
   { 'nti-test-approval' = [ ['approver1-approval', 'approver2-approval'] 
= 'director-approval'] }
   );


which generates the following template:


===Create-Ticket: workflow-approver1-approval
Subject: Architect Approval for Request: {$Tickets{TOP}-Id} - 
{$Tickets{TOP}-Subject}
Refers-To: TOP
Queue: ___Approvals
Owner: approver1
Requestors: {$Tickets{TOP}-Requestors}
Type: approval
Content-Type: text/plain
Due: {time + 86400}
Content: content
ENDOFCONTENT
===Create-Ticket: workflow-approver2-approval
Subject: Architect Approval for Request: {$Tickets{TOP}-Id} - 
{$Tickets{TOP}-Subject}
Refers-To: TOP
Queue: ___Approvals
Owner: approver2
Requestors: {$Tickets{TOP}-Requestors}
Type: approval
Depends-On: workflow-approver1-approval
Content-Type: text/plain
Due: {time + 86400}
Content: content
ENDOFCONTENT
===Create-Ticket: workflow-director-approval
Subject: Director Approval for  Request: {$Tickets{TOP}-Id} - 
{$Tickets{TOP}-Subject}
Refers-To: TOP
Queue: ___Approvals
Owner: director
Requestors: {$Tickets{TOP}-Requestors}
Depended-On-By: TOP
Type: approval
Depends-On: workflow-ARRAY(0x996b490)
Content-Type: text/plain
Due: {time + 86400}
Content: content
ENDOFCONTENT


we're seeing a few problems:

1.  the approver2 child ticket isn't notifying the approver2 that they have a 
pending approval, that specific ticket is in the new status vs the open 
status that the other 2 are

2.  the director is getting notified of pending approval before an approver1 
(or approver2) approves the ticket

3.  if approver1 denies the request, the ticket does not get closed (didn't 
test approver2).. if the director does, it closes like it should

is anyone using it in production with a dual approval for the 1st step?  I 
found the Depends-On: workflow-ARRAY(0x996b490) of the child ticket for the 
director a little interesting.  Also, the doc doesn't specify, but do I need to 
add RTx::WorkFlowBuilder to the list of plugins in RT_SiteConfig?

Nicola
___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com

[rt-users] Upgrade from RT 3.8.4 to 3.8.6 Required Newer Mod_Perl 1.x under Apache 1.3.41

2009-11-05 Thread Foggi, Nicola

Just in case anyone else runs into this, not sure if it was supposed to be this 
way or not, but after upgrading to RT 3.8.6 from 3.8.4 we were getting an:

[error] Can't call method get on an undefined value at 
perl-home-dir/5.8.6/HTML/Mason/ApacheHandler.pm line 563.\nCompilation failed 
in require at rt-home-dir/bin/../lib/RT/Interface/Web/Handler.pm line 140.\n

in the apache error logs.  We were running Apache 1.3.41 with mod_perl 1.29.. 
after thinking it was a perl module problem, and making sure i had all the 
latest of those, still the same problem.  Finally, i upgraded to mod_perl 1.31 
and everything is running smoothly.

I didn't see this mentioned anywere, maybe i missed it, but i thought i'd pass 
it along in case anyone else runs into it and searches for the error...
___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com

[rt-users] Upgrade from RT 3.8.4 to 3.8.6 Required Newer Mod_Perl 1.x under Apache 1.3.41

2009-11-05 Thread Foggi, Nicola

Just in case anyone else runs into this, not sure if it was supposed to be this 
way or not, but after upgrading to RT 3.8.6 from 3.8.4 we were getting an:

[error] Can't call method get on an undefined value at 
perl-home-dir/5.8.6/HTML/Mason/ApacheHandler.pm line 563.\nCompilation failed 
in require at rt-home-dir/bin/../lib/RT/Interface/Web/Handler.pm line 140.\n

in the apache error logs.  We were running Apache 1.3.41 with mod_perl 1.29.. 
after thinking it was a perl module problem, and making sure i had all the 
latest of those, still the same problem.  Finally, i upgraded to mod_perl 1.31 
and everything is running smoothly.

I didn't see this mentioned anywere, maybe i missed it, but i thought i'd pass 
it along in case anyone else runs into it and searches for the error...
___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com

[rt-users] Approvals on 3.8.4 not going to ___Approvals Queue and Attachments

2009-11-03 Thread Foggi, Nicola

Hey Everyone,

So I've been looking at ways to create approvals, and initially i created my 
own approval queue called po-approvals, created the template to create the 
approval ticket in it, that all worked, however, i wasn't getting notified of 
the pending approval (though i could see it waiting approval) and if i denied 
it or approved it, it wouldn't update the ticket.  Looking further into it, i 
see there was a major re-do of the approvals in 3.8.2 from previous versions.

I switched my template to create the approval ticket in ___Approvals and 
everything then started working, email notifications, updates to the parent 
tickets, etc.

Is there any way to get this functionality across multiple queues?

I found:

use constant _Queue = '___Approvals';

under /lib/RT/Approval/Rule.pm, can i list multiple queues?  will the 
workflowbuilder extension do anything for me?

Also, since it's PO's, there are attachments coming in on the original ticket, 
is there anyway to actually include that attachment in the notification to the 
approver?  There doesn't seem to be a way to get in in using the template, but 
i thought i'd ask.  I saw talk of adding a link, which may work also, but had 
problems with that.  It was all on old versions, so maybe something has changed?

Any help is greatly appreciated!

Thanks!

Nicola
___
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com