[rt-users] help in creating Scrips (Nagios autoclose)

2009-11-02 Thread Rodolphe ALT
Hi all,

I am trying create a scrip in RT3 for close automaticly the tickets from
Nagios alert.

I am working from the scrips AutoCloseOnNagiosRecoveryMessages - RT
Integration from website

http://exchange.nagios.org/directory/Addons/Helpdesk-and-Ticketing/RT/AutoCloseOnNagiosRecoveryMessages-%252D-RT-Integration/details

http://wiki.bestpractical.com/view/AutoCloseOnNagiosRecoveryMessages

goog_1257158193783

https://wiki.koumbit.net/RequestTracker/NagiosBridge



But with RT3 3.8.6 and Nagios 3.2, The subject of the email is not analyzed
correctly.

I mean when I have enabled debug log and this is a log messages like :
[Mon Nov  2 10:30:33 2009] [debug]: Committing scrip #14 on txn #397 of
ticket #46 (/opt/rt3/bin/../lib/RT/Scrips_Overlay.pm:190)
[Mon Nov  2 10:30:33 2009] [debug]: Message Lancement Scrip 14 ((eval
2528):12)
[Mon Nov  2 10:30:33 2009] [debug]: Found a recovery msg:  ((eval 2528):21)
[Mon Nov  2 10:30:33 2009] [debug]: Boucle 14 : 45 ((eval 2528):36)
[Mon Nov  2 10:30:33 2009] [debug]: Boucle 14 : 46 ((eval 2528):36)
[Mon Nov  2 10:30:33 2009] [debug]: Boucle 14 : 27 ((eval 2528):36)

And that' all. not Merging ticket !


in scrip, I think this is the line who detect not the ticket :
if ( $ticket-Subject =~ /\*\* PROBLEM (\w+(?:\s*\d+)?) - (.*) is (\w+)
\*\*/ ) {

I have tested also without success :
if ( $ticket-Subject =~ /\*\* PROBLEM (\w+) - (.*) (\w+) \*\*/ ) {


And the email subject is like :
** PROBLEM Service Alert: srv08.athome.local/Portail is CRITICAL **
** RECOVERY Service Alert: srv08.athome.local/Portail is OK **


Can you help me to resolve this code ?


Thanks,

Regards,

Rodolphe





ALL CODE of actual scrip is here :

# If the subject of the ticket matches a pattern suggesting
# that this is a Nagios RECOVERY message  AND there is
# an existing ticket (open or new) in the General queue with a matching
# problem description, (that is not this ticket)
# merge this ticket into that ticket
#
# Based on http://marc.free.net.ph/message/20040319.180325.27528377.en.html

my $problem_desc = undef;
my $report_type = undef;

$RT::Logger-debug(Message Lancement Scrip 14);

my $Transaction = $self-TransactionObj;
my $subject = $Transaction-Attachments-First-GetHeader('Subject');
if ($subject =~ /\*\* RECOVERY (.*) OK \*\*/) {
# This looks like a nagios recovery message
$report_type = $1;
$problem_desc = $3;

$RT::Logger-debug(Found a recovery msg: $problem_desc);
} else {
$RT::Logger-debug(Not a recovery msg: $problem_desc);
return 1;
}

# Ok, now let's merge this ticket with it's PROBLEM msg.
my $search = RT::Tickets-new($RT::SystemUser);
$search-LimitQueue(VALUE = 'General');
$search-LimitStatus(VALUE = 'new', OPERATOR = '=', ENTRYAGGREGATOR =
'or');
$search-LimitStatus(VALUE = 'open', OPERATOR = '=');

if ($search-Count == 0) { return 1; }
my $id = undef;
while (my $ticket = $search-Next) {
$RT::Logger-debug(Boucle 14 : .($ticket-Id));
# Ignore the ticket that opened this transation (the recovery one...)
next if $self-TicketObj-Id == $ticket-Id;
# Look for nagios PROBLEM warning messages...
if ( $ticket-Subject =~ /\*\* PROBLEM (\w+(?:\s*\d+)?) - (.*) is (\w+)
\*\*/ ) {
if ($2 eq $problem_desc){
# Aha! Found the Problem TICKET corresponding to this RECOVERY
# ticket
$id = $ticket-Id;
# Nagios may send more then one PROBLEM message, right?
$RT::Logger-debug(Merging ticket  . $self-TicketObj-Id . 
into $id because of OA number match.);
$self-TicketObj-MergeInto($id);
# Keep looking for more PROBLEM tickets...
$RT::Logger-debug(Scrip 14 : 1 ticket trouvé $ticket-Id  avec
la régle 1!);

}
}

   if ( $ticket-Subject =~ /\*\* PROBLEM (\w+) - (.*) (\w+) \*\*/ ) {
$RT::Logger-debug(Scrip 14 : 1 ticket trouvé $ticket-Id  avec la
régle 2!);
   }
}

$id || return 1;

if ($report_type eq RECOVERY) {
  # Auto-close/resolve this whole thing
  $self-TicketObj-SetStatus( resolved );
#$Ticket-_Set(Field = 'Status', Value = 'resolved', RecordTransaction =
0);

}
1;










___
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] help in creating Scrips (Nagios autoclose)

2009-11-02 Thread Rodolphe A.
Hi all,

I am trying create a scrip in RT3 for close automaticly the tickets from
Nagios alert.

I am working from the scrips AutoCloseOnNagiosRecoveryMessages - RT
Integration from website

http://exchange.nagios.org/directory/Addons/Helpdesk-and-Ticketing/RT/AutoCloseOnNagiosRecoveryMessages-%252D-RT-Integration/details

http://wiki.bestpractical.com/view/AutoCloseOnNagiosRecoveryMessages

 http://goog_1257158193783

https://wiki.koumbit.net/RequestTracker/NagiosBridge



But with RT3 3.8.6 and Nagios 3.2, The subject of the email is not analyzed
correctly.

I mean when I have enabled debug log and this is a log messages like :
[Mon Nov  2 10:30:33 2009] [debug]: Committing scrip #14 on txn #397 of
ticket #46 (/opt/rt3/bin/../lib/RT/Scrips_Overlay.pm:190)
[Mon Nov  2 10:30:33 2009] [debug]: Message Lancement Scrip 14 ((eval
2528):12)
[Mon Nov  2 10:30:33 2009] [debug]: Found a recovery msg:  ((eval 2528):21)
[Mon Nov  2 10:30:33 2009] [debug]: Boucle 14 : 45 ((eval 2528):36)
[Mon Nov  2 10:30:33 2009] [debug]: Boucle 14 : 46 ((eval 2528):36)
[Mon Nov  2 10:30:33 2009] [debug]: Boucle 14 : 27 ((eval 2528):36)

And that' all. not Merging ticket !


in scrip, I think this is the line who detect not the ticket :
if ( $ticket-Subject =~ /\*\* PROBLEM (\w+(?:\s*\d+)?) - (.*) is (\w+)
\*\*/ ) {

I have tested also without success :
if ( $ticket-Subject =~ /\*\* PROBLEM (\w+) - (.*) (\w+) \*\*/ ) {


And the email subject is like :
** PROBLEM Service Alert: srv08.athome.local/Portail is CRITICAL **
** RECOVERY Service Alert: srv08.athome.local/Portail is OK **


Can you help me to resolve this code ?


Thanks,

Regards,

Rodolphe





ALL CODE of actual scrip is here :

# If the subject of the ticket matches a pattern suggesting
# that this is a Nagios RECOVERY message  AND there is
# an existing ticket (open or new) in the General queue with a matching
# problem description, (that is not this ticket)
# merge this ticket into that ticket
#
# Based on http://marc.free.net.ph/message/20040319.180325.27528377.en.html

my $problem_desc = undef;
my $report_type = undef;

$RT::Logger-debug(Message Lancement Scrip 14);

my $Transaction = $self-TransactionObj;
my $subject = $Transaction-Attachments-First-GetHeader('Subject');
if ($subject =~ /\*\* RECOVERY (.*) OK \*\*/) {
# This looks like a nagios recovery message
$report_type = $1;
$problem_desc = $3;

$RT::Logger-debug(Found a recovery msg: $problem_desc);
} else {
$RT::Logger-debug(Not a recovery msg: $problem_desc);
return 1;
}

# Ok, now let's merge this ticket with it's PROBLEM msg.
my $search = RT::Tickets-new($RT::SystemUser);
$search-LimitQueue(VALUE = 'General');
$search-LimitStatus(VALUE = 'new', OPERATOR = '=', ENTRYAGGREGATOR =
'or');
$search-LimitStatus(VALUE = 'open', OPERATOR = '=');

if ($search-Count == 0) { return 1; }
my $id = undef;
while (my $ticket = $search-Next) {
$RT::Logger-debug(Boucle 14 : .($ticket-Id));
# Ignore the ticket that opened this transation (the recovery one...)
next if $self-TicketObj-Id == $ticket-Id;
# Look for nagios PROBLEM warning messages...
if ( $ticket-Subject =~ /\*\* PROBLEM (\w+(?:\s*\d+)?) - (.*) is (\w+)
\*\*/ ) {
if ($2 eq $problem_desc){
# Aha! Found the Problem TICKET corresponding to this RECOVERY
# ticket
$id = $ticket-Id;
# Nagios may send more then one PROBLEM message, right?
$RT::Logger-debug(Merging ticket  . $self-TicketObj-Id . 
into $id because of OA number match.);
$self-TicketObj-MergeInto($id);
# Keep looking for more PROBLEM tickets...
$RT::Logger-debug(Scrip 14 : 1 ticket trouvé $ticket-Id  avec
la régle 1!);

}
}

   if ( $ticket-Subject =~ /\*\* PROBLEM (\w+) - (.*) (\w+) \*\*/ ) {
$RT::Logger-debug(Scrip 14 : 1 ticket trouvé $ticket-Id  avec la
régle 2!);
   }
}

$id || return 1;

if ($report_type eq RECOVERY) {
  # Auto-close/resolve this whole thing
  $self-TicketObj-SetStatus( resolved );
#$Ticket-_Set(Field = 'Status', Value = 'resolved', RecordTransaction =
0);

}
1;










___
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

Re: [rt-users] help in creating Scrips (Nagios autoclose)

2009-11-02 Thread Richard Foley
You've got a dash (-) character in your regex which doesn't appear in the 
subject line of the mail.

Subject =~ /\*\* PROBLEM (\w+(?:\s*\d+)?) - (.*) is (\w+) \*\*/
  ^
Which might have something to do with it?

--
Richard Foley
Ciao - shorter than aufwiedersehen

http://www.rfi.net/

On Monday 02 November 2009 12:00:07 Rodolphe ALT wrote:
 Hi all,
 
 I am trying create a scrip in RT3 for close automaticly the tickets from
 Nagios alert.
 
 I am working from the scrips AutoCloseOnNagiosRecoveryMessages - RT
 Integration from website
 
 
http://exchange.nagios.org/directory/Addons/Helpdesk-and-Ticketing/RT/AutoCloseOnNagiosRecoveryMessages-%252D-RT-Integration/details
 
 http://wiki.bestpractical.com/view/AutoCloseOnNagiosRecoveryMessages
 
 goog_1257158193783
 
 https://wiki.koumbit.net/RequestTracker/NagiosBridge
 
 
 
 But with RT3 3.8.6 and Nagios 3.2, The subject of the email is not analyzed
 correctly.
 
 I mean when I have enabled debug log and this is a log messages like :
 [Mon Nov  2 10:30:33 2009] [debug]: Committing scrip #14 on txn #397 of
 ticket #46 (/opt/rt3/bin/../lib/RT/Scrips_Overlay.pm:190)
 [Mon Nov  2 10:30:33 2009] [debug]: Message Lancement Scrip 14 ((eval
 2528):12)
 [Mon Nov  2 10:30:33 2009] [debug]: Found a recovery msg:  ((eval 2528):21)
 [Mon Nov  2 10:30:33 2009] [debug]: Boucle 14 : 45 ((eval 2528):36)
 [Mon Nov  2 10:30:33 2009] [debug]: Boucle 14 : 46 ((eval 2528):36)
 [Mon Nov  2 10:30:33 2009] [debug]: Boucle 14 : 27 ((eval 2528):36)
 
 And that' all. not Merging ticket !
 
 
 in scrip, I think this is the line who detect not the ticket :
 if ( $ticket-Subject =~ /\*\* PROBLEM (\w+(?:\s*\d+)?) - (.*) is (\w+)
 \*\*/ ) {
 
 I have tested also without success :
 if ( $ticket-Subject =~ /\*\* PROBLEM (\w+) - (.*) (\w+) \*\*/ ) {
 
 
 And the email subject is like :
 ** PROBLEM Service Alert: srv08.athome.local/Portail is CRITICAL **
 ** RECOVERY Service Alert: srv08.athome.local/Portail is OK **
 
 
 Can you help me to resolve this code ?
 
 
 Thanks,
 
 Regards,
 
 Rodolphe
 
 
 
 
 
 ALL CODE of actual scrip is here :
 
 # If the subject of the ticket matches a pattern suggesting
 # that this is a Nagios RECOVERY message  AND there is
 # an existing ticket (open or new) in the General queue with a matching
 # problem description, (that is not this ticket)
 # merge this ticket into that ticket
 #
 # Based on http://marc.free.net.ph/message/20040319.180325.27528377.en.html
 
 my $problem_desc = undef;
 my $report_type = undef;
 
 $RT::Logger-debug(Message Lancement Scrip 14);
 
 my $Transaction = $self-TransactionObj;
 my $subject = $Transaction-Attachments-First-GetHeader('Subject');
 if ($subject =~ /\*\* RECOVERY (.*) OK \*\*/) {
 # This looks like a nagios recovery message
 $report_type = $1;
 $problem_desc = $3;
 
 $RT::Logger-debug(Found a recovery msg: $problem_desc);
 } else {
 $RT::Logger-debug(Not a recovery msg: $problem_desc);
 return 1;
 }
 
 # Ok, now let's merge this ticket with it's PROBLEM msg.
 my $search = RT::Tickets-new($RT::SystemUser);
 $search-LimitQueue(VALUE = 'General');
 $search-LimitStatus(VALUE = 'new', OPERATOR = '=', ENTRYAGGREGATOR =
 'or');
 $search-LimitStatus(VALUE = 'open', OPERATOR = '=');
 
 if ($search-Count == 0) { return 1; }
 my $id = undef;
 while (my $ticket = $search-Next) {
 $RT::Logger-debug(Boucle 14 : .($ticket-Id));
 # Ignore the ticket that opened this transation (the recovery one...)
 next if $self-TicketObj-Id == $ticket-Id;
 # Look for nagios PROBLEM warning messages...
 if ( $ticket-Subject =~ /\*\* PROBLEM (\w+(?:\s*\d+)?) - (.*) is (\w+)
 \*\*/ ) {
 if ($2 eq $problem_desc){
 # Aha! Found the Problem TICKET corresponding to this RECOVERY
 # ticket
 $id = $ticket-Id;
 # Nagios may send more then one PROBLEM message, right?
 $RT::Logger-debug(Merging ticket  . $self-TicketObj-Id . 
 into $id because of OA number match.);
 $self-TicketObj-MergeInto($id);
 # Keep looking for more PROBLEM tickets...
 $RT::Logger-debug(Scrip 14 : 1 ticket trouvé $ticket-Id  avec
 la régle 1!);
 
 }
 }
 
if ( $ticket-Subject =~ /\*\* PROBLEM (\w+) - (.*) (\w+) \*\*/ ) {
 $RT::Logger-debug(Scrip 14 : 1 ticket trouvé $ticket-Id  avec la
 régle 2!);
}
 }
 
 $id || return 1;
 
 if ($report_type eq RECOVERY) {
   # Auto-close/resolve this whole thing
   $self-TicketObj-SetStatus( resolved );
 #$Ticket-_Set(Field = 'Status', Value = 'resolved', RecordTransaction =
 0);
 
 }
 1;
 
 
 
 
 
 
 
 
 
 
 


___
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 

Re: [rt-users] help in creating Scrips (Nagios autoclose)

2009-11-02 Thread sunnavy
Hi Rodolphe

Maybe you're interested in the RT extension attached, which is based on the 
wiki you read.
I'm thinking of publishing it to CPAN soon.

best wishes
sunnavy

On 09-11-02 12:00, Rodolphe ALT wrote:
 Hi all,
 
 I am trying create a scrip in RT3 for close automaticly the tickets from
 Nagios alert.
 
 I am working from the scrips AutoCloseOnNagiosRecoveryMessages - RT
 Integration from website
 
 http://exchange.nagios.org/directory/Addons/Helpdesk-and-Ticketing/RT/AutoCloseOnNagiosRecoveryMessages-%252D-RT-Integration/details
 
 http://wiki.bestpractical.com/view/AutoCloseOnNagiosRecoveryMessages
 
 goog_1257158193783
 
 https://wiki.koumbit.net/RequestTracker/NagiosBridge
 
 
 
 But with RT3 3.8.6 and Nagios 3.2, The subject of the email is not analyzed
 correctly.
 
 I mean when I have enabled debug log and this is a log messages like :
 [Mon Nov  2 10:30:33 2009] [debug]: Committing scrip #14 on txn #397 of
 ticket #46 (/opt/rt3/bin/../lib/RT/Scrips_Overlay.pm:190)
 [Mon Nov  2 10:30:33 2009] [debug]: Message Lancement Scrip 14 ((eval
 2528):12)
 [Mon Nov  2 10:30:33 2009] [debug]: Found a recovery msg:  ((eval 2528):21)
 [Mon Nov  2 10:30:33 2009] [debug]: Boucle 14 : 45 ((eval 2528):36)
 [Mon Nov  2 10:30:33 2009] [debug]: Boucle 14 : 46 ((eval 2528):36)
 [Mon Nov  2 10:30:33 2009] [debug]: Boucle 14 : 27 ((eval 2528):36)
 
 And that' all. not Merging ticket !
 
 
 in scrip, I think this is the line who detect not the ticket :
 if ( $ticket-Subject =~ /\*\* PROBLEM (\w+(?:\s*\d+)?) - (.*) is (\w+)
 \*\*/ ) {
 
 I have tested also without success :
 if ( $ticket-Subject =~ /\*\* PROBLEM (\w+) - (.*) (\w+) \*\*/ ) {
 
 
 And the email subject is like :
 ** PROBLEM Service Alert: srv08.athome.local/Portail is CRITICAL **
 ** RECOVERY Service Alert: srv08.athome.local/Portail is OK **
 
 
 Can you help me to resolve this code ?
 
 
 Thanks,
 
 Regards,
 
 Rodolphe
 
 
 
 
 
 ALL CODE of actual scrip is here :
 
 # If the subject of the ticket matches a pattern suggesting
 # that this is a Nagios RECOVERY message  AND there is
 # an existing ticket (open or new) in the General queue with a matching
 # problem description, (that is not this ticket)
 # merge this ticket into that ticket
 #
 # Based on http://marc.free.net.ph/message/20040319.180325.27528377.en.html
 
 my $problem_desc = undef;
 my $report_type = undef;
 
 $RT::Logger-debug(Message Lancement Scrip 14);
 
 my $Transaction = $self-TransactionObj;
 my $subject = $Transaction-Attachments-First-GetHeader('Subject');
 if ($subject =~ /\*\* RECOVERY (.*) OK \*\*/) {
 # This looks like a nagios recovery message
 $report_type = $1;
 $problem_desc = $3;
 
 $RT::Logger-debug(Found a recovery msg: $problem_desc);
 } else {
 $RT::Logger-debug(Not a recovery msg: $problem_desc);
 return 1;
 }
 
 # Ok, now let's merge this ticket with it's PROBLEM msg.
 my $search = RT::Tickets-new($RT::SystemUser);
 $search-LimitQueue(VALUE = 'General');
 $search-LimitStatus(VALUE = 'new', OPERATOR = '=', ENTRYAGGREGATOR =
 'or');
 $search-LimitStatus(VALUE = 'open', OPERATOR = '=');
 
 if ($search-Count == 0) { return 1; }
 my $id = undef;
 while (my $ticket = $search-Next) {
 $RT::Logger-debug(Boucle 14 : .($ticket-Id));
 # Ignore the ticket that opened this transation (the recovery one...)
 next if $self-TicketObj-Id == $ticket-Id;
 # Look for nagios PROBLEM warning messages...
 if ( $ticket-Subject =~ /\*\* PROBLEM (\w+(?:\s*\d+)?) - (.*) is (\w+)
 \*\*/ ) {
 if ($2 eq $problem_desc){
 # Aha! Found the Problem TICKET corresponding to this RECOVERY
 # ticket
 $id = $ticket-Id;
 # Nagios may send more then one PROBLEM message, right?
 $RT::Logger-debug(Merging ticket  . $self-TicketObj-Id . 
 into $id because of OA number match.);
 $self-TicketObj-MergeInto($id);
 # Keep looking for more PROBLEM tickets...
 $RT::Logger-debug(Scrip 14 : 1 ticket trouvé $ticket-Id  avec
 la régle 1!);
 
 }
 }
 
if ( $ticket-Subject =~ /\*\* PROBLEM (\w+) - (.*) (\w+) \*\*/ ) {
 $RT::Logger-debug(Scrip 14 : 1 ticket trouvé $ticket-Id  avec la
 régle 2!);
}
 }
 
 $id || return 1;
 
 if ($report_type eq RECOVERY) {
   # Auto-close/resolve this whole thing
   $self-TicketObj-SetStatus( resolved );
 #$Ticket-_Set(Field = 'Status', Value = 'resolved', RecordTransaction =
 0);
 
 }
 1;
 
 
 
 
 
 
 
 
 
 

 ___
 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-Extension-Nagios-0.01.tar.gz
Description: application/tar-gz
___

Re: [rt-users] Languages in RT

2009-11-02 Thread Rui Vitor Figueiras Meireles

Can anyone help me with this? Thanks.


-Original Message-
From: Rui Vitor Figueiras Meireles 
Sent: quarta-feira, 28 de Outubro de 2009 18:22
To: 'rt-users@lists.bestpractical.com'
Subject: Languages in RT


Hi. I'm using RT 3.6, and I'm Portuguese.

I would like to give users the option of changing the language, default being 
English.

However, if I keep this line in RT_SiteConfig.pm:
@LexiconLanguages = qw(*) unless (@LexiconLanguages);
... then users that use Internet Explorer will get the default language 
Spanish! (why?) Firefox defaults to English.


So I changed the line to:
@LexiconLanguages = qw(en pt) unless (@LexiconLanguages);
Result: now the default is English, but Portuguese is no longer an option to 
choose from... (why?)


How can I set Default = English, BUT give users the power to choose? And can 
Non-staff users choose too?


Thanks,
Rui Meireles
___
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] Start ticket ID in 2000

2009-11-02 Thread Rui Vitor Figueiras Meireles

Is there any easy way to make ticket IDs start in a number (eg: 2000), instead 
of starting in 1?
If I manually change the ID of a ticket to 2000 will that do the trick?


Thank you

___
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


Re: [rt-users] Start ticket ID in 2000

2009-11-02 Thread Emmanuel Lacour
On Mon, Nov 02, 2009 at 12:40:12PM +, Rui Vitor Figueiras Meireles wrote:
 
 Is there any easy way to make ticket IDs start in a number (eg: 2000), 
 instead of starting in 1?
 If I manually change the ID of a ticket to 2000 will that do the trick?
 
 

here are some tips for this:

http://wiki.bestpractical.com/view/SetStartingId

___
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


Re: [rt-users] Unable to Upgrade RT 3.6.6 to 3.8.x using MySQL 5.0.77 and provided database upgrade scripts

2009-11-02 Thread Emmanuel Lacour
On Fri, Oct 30, 2009 at 06:36:38PM -0400, Barron, Josh wrote:
 
 [r...@help01 rt-3.8.6]# ./sbin/rt-setup-database --dba root
 --prompt-for-dba-password --action upgrade
 
 In order to create or update your RT database, this script needs to
 connect to your  mysql instance on localhost as root
 
 Please specify that user's database password below. If the user has no
 database
 
 password, just press return.
 

did you entered your MySQL root password here ?
___
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


Re: [rt-users] Quick overlay question

2009-11-02 Thread Emmanuel Lacour
On Wed, Oct 28, 2009 at 10:42:53AM -0400, Mauricio Tavares wrote:
   Well, it really boils down to how it works? Do you replace an entire 
 function in the overlay, the entire .pm file, or what?


there is description of this here:

http://wiki.bestpractical.com/view/CustomizingWithOverlays

In overlay, you override methods.

You can look in RT modules for examples, there is some that use overlay.

___
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


Re: [rt-users] Custom Scrip for ticket move

2009-11-02 Thread Emmanuel Lacour
On Wed, Oct 28, 2009 at 09:02:09AM -0400, Juan N. DLC wrote:
 Hi to all,
 
 I want to know if someone have a scrip that make a ticket get the priority
 and duedate from the queue is moving to.
 
 ej.
 
 Ticket#001 in queue#1 with duedate 1/priority 3
 
 Ticket#001 have now a dudedate1 and priority 3
 
 when the Ticket#001 is moved to queue#2 with duedate 3 / priority 1 - The
 ticket still have the queue#1 duedate/priority settings.
 
 Can some one be so kind to point me to the right direction here or can give
 me a scrip for this.
 

You have to create a scrip On queue change, in this scrip, get the new
queue

something like this:

my $queue_id = $self-TransactionObj-NewValue;
my $queue = RT::Queue-new( $RT::SystemUser );
$queue-Load($queue_id);

get values for duedate and priority:

$queue-DefaultDueIn;
$queue-InitialPriority;

use those values to set them on the ticket:

# Priority
$self-TicketObj-SetPriority($queue-InitialPriority);

# Due Date
my $due_date = RT::Date-new($RT::SystemUser);
$due_date-Set(Format = 'ISO', Value = $self-TicketObj-Due);
$due_date-AddDays($queue-InitialPriority);
$self-TicketObj-SetDue($due_date-ISO);

___
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


Re: [rt-users] help in creating Scrips (Nagios autoclose)

2009-11-02 Thread Rodolphe ALT
Hi Sunnavy,

Thanks a lot for this tip, because on the link (
http://wiki.bestpractical.com/view/AutoCloseOnNagiosRecoveryMessages) it was
not wrote.

I have read the file README.

After make and install, I have add this line in file
/opt/rt3/etc/RT_SiteConfig.pm
Set(@Plugins,qw(RT::Extension::Nagios));

But when I have initialized database (make initdb), i have a message error :
[Mon Nov  2 13:30:56 2009] [error]: Action 'Nagios' not found
(/opt/rt3/sbin/../lib/RT/Handle.pm:987)

And the scrip after that doesn't close always any messages. In the log :
[Mon Nov  2 13:45:32 2009] [debug]: Committing scrip #13 on txn #451 of
ticket #55 (/opt/rt3/bin/../lib/RT/Scrips_Overlay.pm:190)
[Mon Nov  2 13:45:32 2009] [debug]: Found a recovery msg:  ((eval 3253):18)

And that's all.





Regards,

Rodolphe


The scrip

-

# If the subject of the ticket matches a pattern suggesting
# that this is a Nagios RECOVERY message  AND there is
# an existing ticket (open or new) in the General queue with a matching
# problem description, (that is not this ticket)
# merge this ticket into that ticket
#
# Based on http://marc.free.net.ph/message/20040319.180325.27528377.en.html

my $problem_desc = undef;

my $Transaction = $self-TransactionObj;
my $subject = $Transaction-Attachments-First-GetHeader('Subject');
#if ($subject =~ /\*\* RECOVERY (\w+) - (.*) OK \*\*/) {
if ($subject =~ /\*\* RECOVERY (.*) OK \*\*/) {
# This looks like a nagios recovery message
$problem_desc = $2;

$RT::Logger-debug(Found a recovery msg: $problem_desc);
} else {
$RT::Logger-debug(Not a recovery msg: $problem_desc);
return 1;
}

# Ok, now let's merge this ticket with it's PROBLEM msg.
my $search = RT::Tickets-new($RT::SystemUser);
$search-LimitQueue(VALUE = 'General');
$search-LimitStatus(VALUE = 'new', OPERATOR = '=', ENTRYAGGREGATOR =
'or');
$search-LimitStatus(VALUE = 'open', OPERATOR = '=');

if ($search-Count == 0) { return 1; }
my $id = undef;
while (my $ticket = $search-Next) {
# Ignore the ticket that opened this transation (the recovery one...)
next if $self-TicketObj-Id == $ticket-Id;
# Look for nagios PROBLEM warning messages...
if ( $ticket-Subject =~ /\*\* PROBLEM (\w+) - (.*) (\w+) \*\*/ ) {
if ($2 eq $problem_desc){
# Aha! Found the Problem TICKET corresponding to this RECOVERY
# ticket
$id = $ticket-Id;
# Nagios may send more then one PROBLEM message, right?
$RT::Logger-debug(Merging ticket  . $self-TicketObj-Id . 
into $id because of OA number match.);
$self-TicketObj-MergeInto($id);
# Keep looking for more PROBLEM tickets...
}
}
}

$id || return 1;
# Auto-close/resolve this whole thing
$self-TicketObj-SetStatus( resolved );
1;


---



2009/11/2 sunnavy sunn...@bestpractical.com

 Hi Rodolphe

 Maybe you're interested in the RT extension attached, which is based on the
 wiki you read.
 I'm thinking of publishing it to CPAN soon.

 best wishes
 sunnavy

 On 09-11-02 12:00, Rodolphe ALT wrote:
  Hi all,
 
  I am trying create a scrip in RT3 for close automaticly the tickets from
  Nagios alert.
 
  I am working from the scrips AutoCloseOnNagiosRecoveryMessages - RT
  Integration from website
 
 
 http://exchange.nagios.org/directory/Addons/Helpdesk-and-Ticketing/RT/AutoCloseOnNagiosRecoveryMessages-%252D-RT-Integration/details
 
  http://wiki.bestpractical.com/view/AutoCloseOnNagiosRecoveryMessages
 
  goog_1257158193783
 
  https://wiki.koumbit.net/RequestTracker/NagiosBridge
 
 
 
  But with RT3 3.8.6 and Nagios 3.2, The subject of the email is not
 analyzed
  correctly.
 
  I mean when I have enabled debug log and this is a log messages like :
  [Mon Nov  2 10:30:33 2009] [debug]: Committing scrip #14 on txn #397 of
  ticket #46 (/opt/rt3/bin/../lib/RT/Scrips_Overlay.pm:190)
  [Mon Nov  2 10:30:33 2009] [debug]: Message Lancement Scrip 14 ((eval
  2528):12)
  [Mon Nov  2 10:30:33 2009] [debug]: Found a recovery msg:  ((eval
 2528):21)
  [Mon Nov  2 10:30:33 2009] [debug]: Boucle 14 : 45 ((eval 2528):36)
  [Mon Nov  2 10:30:33 2009] [debug]: Boucle 14 : 46 ((eval 2528):36)
  [Mon Nov  2 10:30:33 2009] [debug]: Boucle 14 : 27 ((eval 2528):36)
 
  And that' all. not Merging ticket !
 
 
  in scrip, I think this is the line who detect not the ticket :
  if ( $ticket-Subject =~ /\*\* PROBLEM (\w+(?:\s*\d+)?) - (.*) is
 (\w+)
  \*\*/ ) {
 
  I have tested also without success :
  if ( $ticket-Subject =~ /\*\* PROBLEM (\w+) - (.*) (\w+) \*\*/ ) {
 
 
  And the email subject is like :
  ** PROBLEM Service Alert: srv08.athome.local/Portail is CRITICAL **
  ** RECOVERY Service Alert: srv08.athome.local/Portail is OK **
 
 
  Can you help me to resolve this code ?
 
 
  Thanks,
 
  Regards,
 
  Rodolphe
 
 
  
 
 
  ALL CODE of actual scrip is here :
 
  # If the subject of the ticket matches a pattern suggesting
  # that 

Re: [rt-users] help in creating Scrips (Nagios autoclose)

2009-11-02 Thread Rodolphe ALT
Hi Richard,

I have try without dash. (thanks for that)

But it is always the same result (not detected)

Regex is :

Subject =~ /\*\* PROBLEM (\w+(?:\s*\d+)?) (.*) is (\w+) \*\*/

Subject Email is:
Subject = ** PROBLEM Service Alert: srv08.athome.local/Portail is CRITICAL
**




Regards,


Rodolphe

2009/11/2 Richard Foley richard.fo...@rfi.net

You've got a dash (-) character in your regex which doesn't appear in the
 subject line of the mail.

Subject =~ /\*\* PROBLEM (\w+(?:\s*\d+)?) - (.*) is (\w+) \*\*/
   ^
 Which might have something to do with it?

 --
 Richard Foley
 Ciao - shorter than aufwiedersehen

 http://www.rfi.net/

 On Monday 02 November 2009 12:00:07 Rodolphe ALT wrote:
  Hi all,
 
  I am trying create a scrip in RT3 for close automaticly the tickets from
  Nagios alert.
 
  I am working from the scrips AutoCloseOnNagiosRecoveryMessages - RT
  Integration from website
 
 

 http://exchange.nagios.org/directory/Addons/Helpdesk-and-Ticketing/RT/AutoCloseOnNagiosRecoveryMessages-%252D-RT-Integration/details
 
  http://wiki.bestpractical.com/view/AutoCloseOnNagiosRecoveryMessages
 
  goog_1257158193783
 
  https://wiki.koumbit.net/RequestTracker/NagiosBridge
 
 
 
  But with RT3 3.8.6 and Nagios 3.2, The subject of the email is not
 analyzed
  correctly.
 
  I mean when I have enabled debug log and this is a log messages like :
  [Mon Nov  2 10:30:33 2009] [debug]: Committing scrip #14 on txn #397 of
  ticket #46 (/opt/rt3/bin/../lib/RT/Scrips_Overlay.pm:190)
  [Mon Nov  2 10:30:33 2009] [debug]: Message Lancement Scrip 14 ((eval
  2528):12)
  [Mon Nov  2 10:30:33 2009] [debug]: Found a recovery msg:  ((eval
 2528):21)
  [Mon Nov  2 10:30:33 2009] [debug]: Boucle 14 : 45 ((eval 2528):36)
  [Mon Nov  2 10:30:33 2009] [debug]: Boucle 14 : 46 ((eval 2528):36)
  [Mon Nov  2 10:30:33 2009] [debug]: Boucle 14 : 27 ((eval 2528):36)
 
  And that' all. not Merging ticket !
 
 
  in scrip, I think this is the line who detect not the ticket :
  if ( $ticket-Subject =~ /\*\* PROBLEM (\w+(?:\s*\d+)?) - (.*) is
 (\w+)
  \*\*/ ) {
 
  I have tested also without success :
  if ( $ticket-Subject =~ /\*\* PROBLEM (\w+) - (.*) (\w+) \*\*/ ) {
 
 
  And the email subject is like :
  ** PROBLEM Service Alert: srv08.athome.local/Portail is CRITICAL **
  ** RECOVERY Service Alert: srv08.athome.local/Portail is OK **
 
 
  Can you help me to resolve this code ?
 
 
  Thanks,
 
  Regards,
 
  Rodolphe
 
 
  
 
 
  ALL CODE of actual scrip is here :
 
  # If the subject of the ticket matches a pattern suggesting
  # that this is a Nagios RECOVERY message  AND there is
  # an existing ticket (open or new) in the General queue with a matching
  # problem description, (that is not this ticket)
  # merge this ticket into that ticket
  #
  # Based on
 http://marc.free.net.ph/message/20040319.180325.27528377.en.html
 
  my $problem_desc = undef;
  my $report_type = undef;
 
  $RT::Logger-debug(Message Lancement Scrip 14);
 
  my $Transaction = $self-TransactionObj;
  my $subject = $Transaction-Attachments-First-GetHeader('Subject');
  if ($subject =~ /\*\* RECOVERY (.*) OK \*\*/) {
  # This looks like a nagios recovery message
  $report_type = $1;
  $problem_desc = $3;
 
  $RT::Logger-debug(Found a recovery msg: $problem_desc);
  } else {
  $RT::Logger-debug(Not a recovery msg: $problem_desc);
  return 1;
  }
 
  # Ok, now let's merge this ticket with it's PROBLEM msg.
  my $search = RT::Tickets-new($RT::SystemUser);
  $search-LimitQueue(VALUE = 'General');
  $search-LimitStatus(VALUE = 'new', OPERATOR = '=', ENTRYAGGREGATOR =
  'or');
  $search-LimitStatus(VALUE = 'open', OPERATOR = '=');
 
  if ($search-Count == 0) { return 1; }
  my $id = undef;
  while (my $ticket = $search-Next) {
  $RT::Logger-debug(Boucle 14 : .($ticket-Id));
  # Ignore the ticket that opened this transation (the recovery one...)
  next if $self-TicketObj-Id == $ticket-Id;
  # Look for nagios PROBLEM warning messages...
  if ( $ticket-Subject =~ /\*\* PROBLEM (\w+(?:\s*\d+)?) - (.*) is
 (\w+)
  \*\*/ ) {
  if ($2 eq $problem_desc){
  # Aha! Found the Problem TICKET corresponding to this
 RECOVERY
  # ticket
  $id = $ticket-Id;
  # Nagios may send more then one PROBLEM message, right?
  $RT::Logger-debug(Merging ticket  . $self-TicketObj-Id .
 
  into $id because of OA number match.);
  $self-TicketObj-MergeInto($id);
  # Keep looking for more PROBLEM tickets...
  $RT::Logger-debug(Scrip 14 : 1 ticket trouvé $ticket-Id
  avec
  la régle 1!);
 
  }
  }
 
 if ( $ticket-Subject =~ /\*\* PROBLEM (\w+) - (.*) (\w+) \*\*/ ) {
  $RT::Logger-debug(Scrip 14 : 1 ticket trouvé $ticket-Id  avec la
  régle 2!);
 }
  }
 
  $id || return 1;
 
  if ($report_type eq RECOVERY) {
# Auto-close/resolve this whole thing

Re: [rt-users] Unable to Upgrade RT 3.6.6 to 3.8.x usingMySQL 5.0.77 and provided database upgrade scripts

2009-11-02 Thread Barron, Josh
Hi Emmanuel,

Yes I did.  Its very strange, even when I enter the command with --dba
root it still comes up using rt_user
I've tried the password for rt-user and the password for root with no
success.

-Josh

-Original Message-
From: rt-users-boun...@lists.bestpractical.com
[mailto:rt-users-boun...@lists.bestpractical.com] On Behalf Of Emmanuel
Lacour
Sent: Monday, November 02, 2009 6:02 AM
To: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] Unable to Upgrade RT 3.6.6 to 3.8.x usingMySQL
5.0.77 and provided database upgrade scripts

On Fri, Oct 30, 2009 at 06:36:38PM -0400, Barron, Josh wrote:
 
 [r...@help01 rt-3.8.6]# ./sbin/rt-setup-database --dba root
 --prompt-for-dba-password --action upgrade
 
 In order to create or update your RT database, this script needs to
 connect to your  mysql instance on localhost as root
 
 Please specify that user's database password below. If the user has no
 database
 
 password, just press return.
 

did you entered your MySQL root password here ?
___
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
___
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] Resolved Time Stamp not set if ticket is resolved by Scrip from RT_System

2009-11-02 Thread Brumm, Torsten / Kuehne + Nagel / Ham MI-ID
Hi,
we figured out during the last weeks, that a ticket resolved by a scrip has no 
resolved time stamp set, is this a know behavior or a simple bug? We are still 
under RT 3.6.5.

Torsten

Kuehne + Nagel (AG  Co.) KG, Geschaeftsleitung: Hans-Georg Brinkmann (Vors.), 
Dirk Blesius (Stellv.), Reiner Heiken (Stellv.), Bruno Mang, Alfred Manke, 
Christian Marnetté (Stellv.), Mark Reinhardt (Stellv.), Jens Wollesen, Rainer 
Wunn, Sitz: Bremen, Registergericht: Bremen, HRA 21928, USt-IdNr.: DE 
812773878, Persoenlich haftende Gesellschaft: Kuehne  Nagel A.G., Sitz: 
Contern/Luxemburg Geschaeftsfuehrender Verwaltungsrat: Klaus-Michael Kuehne



___
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


Re: [rt-users] Start ticket ID in 2000

2009-11-02 Thread Rui Vitor Figueiras Meireles

Thank you very much, it worked!

Rui Meireles


-Original Message-
Date: Mon, 2 Nov 2009 13:50:55 +0100
From: Emmanuel Lacour elac...@easter-eggs.com
Subject: Re: [rt-users] Start ticket ID in 2000
To: rt-users@lists.bestpractical.com
Message-ID: 20091102125055.gb9...@easter-eggs.com
Content-Type: text/plain; charset=us-ascii

On Mon, Nov 02, 2009 at 12:40:12PM +, Rui Vitor Figueiras Meireles wrote:
 
 Is there any easy way to make ticket IDs start in a number (eg: 2000), 
 instead of starting in 1?
 If I manually change the ID of a ticket to 2000 will that do the trick?
 
 

here are some tips for this:

http://wiki.bestpractical.com/view/SetStartingId


-Original Message-
From: Rui Vitor Figueiras Meireles 
Sent: segunda-feira, 2 de Novembro de 2009 12:40
To: 'rt-users@lists.bestpractical.com'
Subject: Start ticket ID in 2000


Is there any easy way to make ticket IDs start in a number (eg: 2000), instead 
of starting in 1?
If I manually change the ID of a ticket to 2000 will that do the trick?


Thank you

___
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] FW: RT-Mailgate + Postfix on SLES10 Not Receiving Mail

2009-11-02 Thread Victor Gehring
-Original Message-
From: Alan Premselaar [mailto:al...@12inch.com] 
Sent: Thursday, October 29, 2009 10:33 PM
To: Victor Gehring
Cc: 'RT-Users@lists.bestpractical.com'
Subject: Re: [rt-users] RT-Mailgate + Postfix on SLES10 Not Receiving Mail



On 09/10/30 7:56, Victor Gehring wrote:
[snip...]

 Oct 29 18:17:35 dt-rt postfix/local[7122]: ED9E318235:
 to=???/opt/rt3/bin/rt???mailgate ??queue General ??action
 correspond ??url http://10.0.1.6/@dt-rt.yyy.com,
 orig_to=helpd...@dt-rt.yyy.com, relay=local, delay=1, status=bounced
 (unknown user: ???/opt/rt3/bin/rt???mailgate ??queue general
 ??action correspond ??url http://10.0.1.6/;)
Victor,

your problem lies in the lines above.  you apparently have some 
non-ascii / non-printable characters in your alias definition which 
postfix is choking on.  make sure that when you're editing your aliases 
file that you're using single-byte ASCII characters and not double-byte 
or extended ASCII characters.

hope this helps.

Alan
___
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


Re: [rt-users] Languages in RT

2009-11-02 Thread Rui Vitor Figueiras Meireles

I don't want to upgrade, I've made many changes to scrips, made plenty of 
configurations, and changed code to accommodate my needs, so it would be lots 
of work for something so simple...

Thanks anyway, users will just have to learn English! ;)


--

Date: Mon, 2 Nov 2009 13:55:30 +0100
From: Emmanuel Lacour elac...@easter-eggs.com
Subject: Re: [rt-users] Languages in RT
To: rt-users@lists.bestpractical.com
Message-ID: 20091102125530.gc9...@easter-eggs.com
Content-Type: text/plain; charset=us-ascii

On Mon, Nov 02, 2009 at 12:37:47PM +, Rui Vitor Figueiras Meireles wrote:
 
 Can anyone help me with this? Thanks.
 

The default language is the browser language.

Then LexiconLanguages limits the available languages.

I'm sure it's working on 3.8, can you upgrade to 3.8 ?

-Original Message-
From: Rui Vitor Figueiras Meireles 
Sent: segunda-feira, 2 de Novembro de 2009 12:38
To: 'rt-users@lists.bestpractical.com'
Subject: RE: Languages in RT


Can anyone help me with this? Thanks.


-Original Message-
From: Rui Vitor Figueiras Meireles 
Sent: quarta-feira, 28 de Outubro de 2009 18:22
To: 'rt-users@lists.bestpractical.com'
Subject: Languages in RT


Hi. I'm using RT 3.6, and I'm Portuguese.

I would like to give users the option of changing the language, default being 
English.

However, if I keep this line in RT_SiteConfig.pm:
@LexiconLanguages = qw(*) unless (@LexiconLanguages);
... then users that use Internet Explorer will get the default language 
Spanish! (why?) Firefox defaults to English.


So I changed the line to:
@LexiconLanguages = qw(en pt) unless (@LexiconLanguages);
Result: now the default is English, but Portuguese is no longer an option to 
choose from... (why?)


How can I set Default = English, BUT give users the power to choose? And can 
Non-staff users choose too?


Thanks,
Rui Meireles
___
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] Fwd: help in creating Scrips (Nagios autoclose)

2009-11-02 Thread Rodolphe ALT
My problem is solved.

I have used the soft : Rad Software Regular Expression Designer to find
the good sentence for Regex.

The final Scrip for Nagios AutoClose is :

---

# If the subject of the ticket matches a pattern suggesting
# that this is a Nagios RECOVERY message  AND there is
# an existing ticket (open or new) in the General queue with a matching
# problem description, (that is not this ticket)
# merge this ticket into that ticket
#
# Based on http://marc.free.net.ph/message/20040319.180325.27528377.en.html

my $problem_desc = undef;
my $report_type = undef;
my $report_value = undef;

$RT::Logger-debug(Message Lancement Scrip 14);

my $Transaction = $self-TransactionObj;
my $subject = $Transaction-Attachments-First-GetHeader('Subject');
#if ($subject =~ /\*\* RECOVERY (.*) OK \*\*/) {
if ($subject =~ /\*\* RECOVERY (\w+(?:\s*\d+)?) (.*) is (\w+) \*\*/) {
# This looks like a nagios recovery message
#$report_type = $1;
#$problem_desc = $3;
$report_type = $1;
$problem_desc = $2;
$report_value = $3;

$RT::Logger-debug(Found a recovery msg: $report_type -
$problem_desc);
} else {
$RT::Logger-debug(Not a recovery msg: $report_type - $problem_desc);
return 1;
}

# Ok, now let's merge this ticket with it's PROBLEM msg.
my $search = RT::Tickets-new($RT::SystemUser);
$search-LimitQueue(VALUE = 'General');
$search-LimitStatus(VALUE = 'new', OPERATOR = '=', ENTRYAGGREGATOR =
'or');
$search-LimitStatus(VALUE = 'open', OPERATOR = '=');

if ($search-Count == 0) { return 1; }
my $id = undef;
while (my $ticket = $search-Next) {
# Ignore the ticket that opened this transation (the recovery one...)
next if $self-TicketObj-Id == $ticket-Id;
# Look for nagios PROBLEM warning messages...
if ( $ticket-Subject =~ /\*\* PROBLEM (\w+(?:\s*\d+)?) (.*) is (\w+)
\*\*/ ) {
if ($2 eq $problem_desc){
# Aha! Found the Problem TICKET corresponding to this RECOVERY
# ticket
$id = $ticket-Id;
# Nagios may send more then one PROBLEM message, right?
$RT::Logger-debug(Merging ticket  . $self-TicketObj-Id . 
into $id because of OA number match.);
$self-TicketObj-MergeInto($id);
# Keep looking for more PROBLEM tickets...
   }
}
}

$id || return 1;

if ($subject =~ /\*\* RECOVERY (.*) OK \*\*/) {
  # Auto-close/resolve this whole thing
  $self-TicketObj-SetStatus( resolved );
}
1;





---



-- Forwarded message --
From: Rodolphe ALT rodolphe@gmail.com
Date: 2009/11/2
Subject: Re: [rt-users] help in creating Scrips (Nagios autoclose)
To: RT-Users@lists.bestpractical.com
Cc: richard.fo...@rfi.net


Hi Richard,

I have try without dash. (thanks for that)

But it is always the same result (not detected)

Regex is :

Subject =~ /\*\* PROBLEM (\w+(?:\s*\d+)?) (.*) is (\w+) \*\*/

Subject Email is:
Subject = ** PROBLEM Service Alert: srv08.athome.local/Portail is CRITICAL
**




Regards,


Rodolphe

2009/11/2 Richard Foley richard.fo...@rfi.net

You've got a dash (-) character in your regex which doesn't appear in the
 subject line of the mail.

Subject =~ /\*\* PROBLEM (\w+(?:\s*\d+)?) - (.*) is (\w+) \*\*/
   ^
 Which might have something to do with it?

 --
 Richard Foley
 Ciao - shorter than aufwiedersehen

 http://www.rfi.net/

 On Monday 02 November 2009 12:00:07 Rodolphe ALT wrote:
  Hi all,
 
  I am trying create a scrip in RT3 for close automaticly the tickets from
  Nagios alert.
 
  I am working from the scrips AutoCloseOnNagiosRecoveryMessages - RT
  Integration from website
 
 

 http://exchange.nagios.org/directory/Addons/Helpdesk-and-Ticketing/RT/AutoCloseOnNagiosRecoveryMessages-%252D-RT-Integration/details
 
  http://wiki.bestpractical.com/view/AutoCloseOnNagiosRecoveryMessages
 
  goog_1257158193783
 
  https://wiki.koumbit.net/RequestTracker/NagiosBridge
 
 
 
  But with RT3 3.8.6 and Nagios 3.2, The subject of the email is not
 analyzed
  correctly.
 
  I mean when I have enabled debug log and this is a log messages like :
  [Mon Nov  2 10:30:33 2009] [debug]: Committing scrip #14 on txn #397 of
  ticket #46 (/opt/rt3/bin/../lib/RT/Scrips_Overlay.pm:190)
  [Mon Nov  2 10:30:33 2009] [debug]: Message Lancement Scrip 14 ((eval
  2528):12)
  [Mon Nov  2 10:30:33 2009] [debug]: Found a recovery msg:  ((eval
 2528):21)
  [Mon Nov  2 10:30:33 2009] [debug]: Boucle 14 : 45 ((eval 2528):36)
  [Mon Nov  2 10:30:33 2009] [debug]: Boucle 14 : 46 ((eval 2528):36)
  [Mon Nov  2 10:30:33 2009] [debug]: Boucle 14 : 27 ((eval 2528):36)
 
  And that' all. not Merging ticket !
 
 
  in scrip, I think this is the line who detect not the ticket :
  if ( $ticket-Subject =~ /\*\* PROBLEM (\w+(?:\s*\d+)?) - (.*) is
 (\w+)
  \*\*/ ) {
 
  I have tested also without success :
  if ( $ticket-Subject =~ /\*\* PROBLEM (\w+) - (.*) (\w+) \*\*/ ) {
 
 
  And the email subject is like :
  ** PROBLEM Service Alert: 

Re: [rt-users] Billing for RT customer service.

2009-11-02 Thread Jesse Vincent



On Thu 29.Oct'09 at 15:39:58 -0400, Todd Chapman wrote:
 Hi all,
 
 We use RT to perform customer service for our client. RT doesn't
 really have a good way for us to get the numbers we need to bill our
 clients. It's easy to get the number of tickets handled, but getting
 the number of emails sent external (to consumers) during a given time
 period seems to be pretty difficult (and I have a fair amount of
 experience with the RT API).

You'd probably need to iterate over transactions to get this right.

I'd start with an RT::Transactions collection, limit it down as best you
can by date and then filter using IsInbound.  You could go further and
join the Transaction creator to GroupMembers to make sure you find only
things created by Unprivileged.


 
 Any advice on getting this data? Thanks!
 
 -Todd
 ___
 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
 


signature.asc
Description: Digital signature
___
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

Re: [rt-users] 3.8.x serious security issue with mixing sessions [SOLVED I think!]

2009-11-02 Thread Jesse Vincent


 Cache: no-cache but that will prevent caching at all. Seem to be no way to 
 prevent caching cookies from application side.

What's the current state of browser in-memory/on-disk caching with the
Cache: no-cache header?

The attached patch against 3.8.6 might be the right solution for you. I'd
consider making this change to RT if you can report back and tell me if
it does the right thing for you:

diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index b82b638..dccf829 100755
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -279,7 +279,6 @@ sub MaybeShowNoAuthPage {
 return unless $m-base_comp-path =~ RT-Config-Get('WebNoAuthRegex');
 
 # If it's a noauth file, don't ask for auth.
-SendSessionCookie();
 $m-comp( { base_comp = $m-request_comp }, $m-fetch_next, %$ARGS );
 $m-abort;
 }

___
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


Re: [rt-users] Remove Watchers on Owner Change

2009-11-02 Thread Seth Lake
Here's what I ended up with, take everyone off the mail group then add
in the new owner...


foreach my
$address($self-TicketObj-QueueObj-Cc-MemberEmailAddresses){
  $self-TicketObj-SquelchMailTo($address);
}
if($self-TicketObj-OwnerObj-Id != $RT::Nobody-id){
  $self-TicketObj-AddWatcher(
Type=Cc,
PrincipalId=$self-TicketObj-OwnerObj-Id
  );
}
$self-TicketObj-UnsquelchMailTo($self-TicketObj-OwnerObj-EmailAddre
ss);



___
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


Re: [rt-users] help in creating Scrips (Nagios autoclose)

2009-11-02 Thread sunnavy
Hi Rodolphe 

It's a bug, I'm sorry for that.
please test the new version attached.

best wishes
sunnavy

On 09-11-02 15:16, Rodolphe ALT wrote:
 Hi Sunnavy,
 
 Thanks a lot for this tip, because on the link (
 http://wiki.bestpractical.com/view/AutoCloseOnNagiosRecoveryMessages) it was
 not wrote.
 
 I have read the file README.
 
 After make and install, I have add this line in file
 /opt/rt3/etc/RT_SiteConfig.pm
 Set(@Plugins,qw(RT::Extension::Nagios));
 
 But when I have initialized database (make initdb), i have a message error :
 [Mon Nov  2 13:30:56 2009] [error]: Action 'Nagios' not found
 (/opt/rt3/sbin/../lib/RT/Handle.pm:987)
 
 And the scrip after that doesn't close always any messages. In the log :
 [Mon Nov  2 13:45:32 2009] [debug]: Committing scrip #13 on txn #451 of
 ticket #55 (/opt/rt3/bin/../lib/RT/Scrips_Overlay.pm:190)
 [Mon Nov  2 13:45:32 2009] [debug]: Found a recovery msg:  ((eval 3253):18)
 
 And that's all.
 
 
 
 
 
 Regards,
 
 Rodolphe
 
 
 The scrip
 
 -
 
 # If the subject of the ticket matches a pattern suggesting
 # that this is a Nagios RECOVERY message  AND there is
 # an existing ticket (open or new) in the General queue with a matching
 # problem description, (that is not this ticket)
 # merge this ticket into that ticket
 #
 # Based on http://marc.free.net.ph/message/20040319.180325.27528377.en.html
 
 my $problem_desc = undef;
 
 my $Transaction = $self-TransactionObj;
 my $subject = $Transaction-Attachments-First-GetHeader('Subject');
 #if ($subject =~ /\*\* RECOVERY (\w+) - (.*) OK \*\*/) {
 if ($subject =~ /\*\* RECOVERY (.*) OK \*\*/) {
 # This looks like a nagios recovery message
 $problem_desc = $2;
 
 $RT::Logger-debug(Found a recovery msg: $problem_desc);
 } else {
 $RT::Logger-debug(Not a recovery msg: $problem_desc);
 return 1;
 }
 
 # Ok, now let's merge this ticket with it's PROBLEM msg.
 my $search = RT::Tickets-new($RT::SystemUser);
 $search-LimitQueue(VALUE = 'General');
 $search-LimitStatus(VALUE = 'new', OPERATOR = '=', ENTRYAGGREGATOR =
 'or');
 $search-LimitStatus(VALUE = 'open', OPERATOR = '=');
 
 if ($search-Count == 0) { return 1; }
 my $id = undef;
 while (my $ticket = $search-Next) {
 # Ignore the ticket that opened this transation (the recovery one...)
 next if $self-TicketObj-Id == $ticket-Id;
 # Look for nagios PROBLEM warning messages...
 if ( $ticket-Subject =~ /\*\* PROBLEM (\w+) - (.*) (\w+) \*\*/ ) {
 if ($2 eq $problem_desc){
 # Aha! Found the Problem TICKET corresponding to this RECOVERY
 # ticket
 $id = $ticket-Id;
 # Nagios may send more then one PROBLEM message, right?
 $RT::Logger-debug(Merging ticket  . $self-TicketObj-Id . 
 into $id because of OA number match.);
 $self-TicketObj-MergeInto($id);
 # Keep looking for more PROBLEM tickets...
 }
 }
 }
 
 $id || return 1;
 # Auto-close/resolve this whole thing
 $self-TicketObj-SetStatus( resolved );
 1;
 
 
 ---
 
 
 
 2009/11/2 sunnavy sunn...@bestpractical.com
 
  Hi Rodolphe
 
  Maybe you're interested in the RT extension attached, which is based on the
  wiki you read.
  I'm thinking of publishing it to CPAN soon.
 
  best wishes
  sunnavy
 
  On 09-11-02 12:00, Rodolphe ALT wrote:
   Hi all,
  
   I am trying create a scrip in RT3 for close automaticly the tickets from
   Nagios alert.
  
   I am working from the scrips AutoCloseOnNagiosRecoveryMessages - RT
   Integration from website
  
  
  http://exchange.nagios.org/directory/Addons/Helpdesk-and-Ticketing/RT/AutoCloseOnNagiosRecoveryMessages-%252D-RT-Integration/details
  
   http://wiki.bestpractical.com/view/AutoCloseOnNagiosRecoveryMessages
  
   goog_1257158193783
  
   https://wiki.koumbit.net/RequestTracker/NagiosBridge
  
  
  
   But with RT3 3.8.6 and Nagios 3.2, The subject of the email is not
  analyzed
   correctly.
  
   I mean when I have enabled debug log and this is a log messages like :
   [Mon Nov  2 10:30:33 2009] [debug]: Committing scrip #14 on txn #397 of
   ticket #46 (/opt/rt3/bin/../lib/RT/Scrips_Overlay.pm:190)
   [Mon Nov  2 10:30:33 2009] [debug]: Message Lancement Scrip 14 ((eval
   2528):12)
   [Mon Nov  2 10:30:33 2009] [debug]: Found a recovery msg:  ((eval
  2528):21)
   [Mon Nov  2 10:30:33 2009] [debug]: Boucle 14 : 45 ((eval 2528):36)
   [Mon Nov  2 10:30:33 2009] [debug]: Boucle 14 : 46 ((eval 2528):36)
   [Mon Nov  2 10:30:33 2009] [debug]: Boucle 14 : 27 ((eval 2528):36)
  
   And that' all. not Merging ticket !
  
  
   in scrip, I think this is the line who detect not the ticket :
   if ( $ticket-Subject =~ /\*\* PROBLEM (\w+(?:\s*\d+)?) - (.*) is
  (\w+)
   \*\*/ ) {
  
   I have tested also without success :
   if ( $ticket-Subject =~ /\*\* PROBLEM (\w+) - (.*) (\w+) \*\*/ ) {
  
  
   And the email subject is like :
   ** PROBLEM Service Alert: srv08.athome.local/Portail is 

[rt-users] Database upgrade issue from RT 3.6.3 to RT 3.8.4

2009-11-02 Thread Varun
Hello All

 

I have recently upgraded my application from RT 3.6.3 to 3.8.4. Application
has seems to be upgraded correctly but when I have upgraded database. It has
shown me that database upgrade is successful. And I have also been able to
log in system but whenever I tried to see the basics of any tickets or
custom fields of any ticket RT has gone into infinite loop of query and
seems to have been never returned from it when I checked in logs it has
shown me this error

 

 

[error] [client 192.168.7.79] FastCGI: server
/opt/rt3/bin/mason_handler.fcgi stderr: RT::Handle=HASH(0xb8dce30)
couldn't prepare the query 'SELECT main.* FROM Attributes main  WHERE
(main.Content = '3') AND (main.Name = 'BasedOn') AND (main.ObjectType =
'RT::CustomField') 'ORA-00932: inconsistent datatypes: expected - got CLOB
(DBD ERROR: error possibly near * indicator at char 43 in 'SELECT main.*
FROM Attributes main  WHERE (*main.Content = '3') AND (main.Name =
'BasedOn') AND (main.ObjectType = 'RT::CustomField') '), referer:
http://rtbeta.elitecore.co.in/Ticket/Display.html?id=132467

 

[Tue Nov 03 16:14:02 2009] [error] [client 192.168.7.79] FastCGI: server
/opt/rt3/bin/mason_handler.fcgi stderr: DBD::Oracle::db prepare failed:
ORA-00932: inconsistent datatypes: expected - got CLOB (DBD ERROR: error
possibly near * indicator at char 43 in 'SELECT main.* FROM Attributes
main  WHERE (*main.Content = '3') AND (main.Name = 'BasedOn') AND
(main.ObjectType = 'RT::CustomField') ') [for Statement SELECT main.* FROM
Attributes main  WHERE (main.Content = '3') AND (main.Name = 'BasedOn') AND
(main.ObjectType = 'RT::CustomField') ] at
/usr/local/lib/perl5/site_perl/5.8.8/DBIx/SearchBuilder/Handle.pm line 470,
GEN106 line 2501., referer:
http://rtbeta.elitecore.co.in/Ticket/Display.html?id=132467

 

[Tue Nov 03 16:14:02 2009] [error] [client 192.168.7.79] FastCGI: server
/opt/rt3/bin/mason_handler.fcgi stderr: RT::Handle=HASH(0xb8dce30)
couldn't prepare the query 'SELECT main.* FROM Attributes main  WHERE
(main.Content = '3') AND (main.Name = 'BasedOn') AND (main.ObjectType =
'RT::CustomField') 'ORA-00932: inconsistent datatypes: expected - got CLOB
(DBD ERROR: error possibly near * indicator at char 43 in 'SELECT main.*
FROM Attributes main  WHERE (*main.Content = '3') AND (main.Name =
'BasedOn') AND (main.ObjectType = 'RT::CustomField') '), referer:
http://rtbeta.elitecore.co.in/Ticket/Display.html?id=132467

 

[Tue Nov 03 16:14:02 2009] [error] [client 192.168.7.79] FastCGI: server
/opt/rt3/bin/mason_handler.fcgi stderr: DBD::Oracle::db prepare failed:
ORA-00932: inconsistent datatypes: expected - got CLOB (DBD ERROR: error
possibly near * indicator at char 43 in 'SELECT main.* FROM Attributes
main  WHERE (*main.Content = '3') AND (main.Name = 'BasedOn') AND
(main.ObjectType = 'RT::CustomField') ') [for Statement SELECT main.* FROM
Attributes main  WHERE (main.Content = '3') AND (main.Name = 'BasedOn') AND
(main.ObjectType = 'RT::CustomField') ] at
/usr/local/lib/perl5/site_perl/5.8.8/DBIx/SearchBuilder/Handle.pm line 470,
GEN106 line 2501., referer:
http://rtbeta.elitecore.co.in/Ticket/Display.html?id=132467

 

 

I don't know what kind of error is this and also my upgrade database command
was completed successfully. Can any one suggest me what is the problem. And
how to correct and what I am missing

 

Thanks  Regards

Varun Vyas

 

 

 

___
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

Re: [rt-users] 3.8.x serious security issue with mixing sessions [SOLVED I think!]

2009-11-02 Thread Arkadiusz Miskiewicz
On Monday 02 of November 2009, Jesse Vincent wrote:
  Cache: no-cache but that will prevent caching at all. Seem to be no way
  to prevent caching cookies from application side.
 
 What's the current state of browser in-memory/on-disk caching with the
 Cache: no-cache header?
 
 The attached patch against 3.8.6 might be the right solution for you. I'd
 consider making this change to RT if you can report back and tell me if
 it does the right thing for you:

This patch doesn't solve the issue. People still get mixed sessions (test was 
done after deleting all sessions from sessions table and restarting apache).

 diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
 index b82b638..dccf829 100755
 --- a/lib/RT/Interface/Web.pm
 +++ b/lib/RT/Interface/Web.pm
 @@ -279,7 +279,6 @@ sub MaybeShowNoAuthPage {
  return unless $m-base_comp-path =~
  RT-Config-Get('WebNoAuthRegex');
 
  # If it's a noauth file, don't ask for auth.
 -SendSessionCookie();
  $m-comp( { base_comp = $m-request_comp }, $m-fetch_next, %$ARGS );
  $m-abort;
  }
 


-- 
Arkadiusz MiśkiewiczPLD/Linux Team
arekm / maven.plhttp://ftp.pld-linux.org/
___
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

Re: [rt-users] Database upgrade issue from RT 3.6.3 to RT 3.8.4

2009-11-02 Thread Joop

Varun wrote:


Hello All

 

I have recently upgraded my application from RT 3.6.3 to 3.8.4. 
Application has seems to be upgraded correctly but when I have 
upgraded database. It has shown me that database upgrade is 
successful. And I have also been able to log in system but whenever I 
tried to see the basics of any tickets or custom fields of any ticket 
RT has gone into infinite loop of query and seems to have been never 
returned from it when I checked in logs it has shown me this error


 

 

[error] [client 192.168.7.79] FastCGI: server 
/opt/rt3/bin/mason_handler.fcgi stderr: RT::Handle=HASH(0xb8dce30) 
couldn't prepare the query 'SELECT main.* FROM Attributes main  WHERE 
(main.Content = '3') AND (main.Name = 'BasedOn') AND (main.ObjectType 
= 'RT::CustomField') 'ORA-00932: inconsistent datatypes: expected - 
got CLOB (DBD ERROR: error possibly near * indicator at char 43 in 
'SELECT main.* FROM Attributes main  WHERE (*main.Content = '3') AND 
(main.Name = 'BasedOn') AND (main.ObjectType = 'RT::CustomField') '), 
referer: http://rtbeta.elitecore.co.in/Ticket/Display.html?id=132467


 



A good idea is when you get errors like these in your rt.log is to cut 
and paste the sql statement into sqlplus and see if it will give you an 
error message that is more clear then rt.log



SELECT main.* FROM Attributes main  WHERE (main.Content = '3') AND 
(main.Name = 'BasedOn') AND (main.ObjectType = 'RT::CustomField')

  *
ERROR at line 1:
ORA-00932: inconsistent datatypes: expected - got CLOB

As you, hopefully, can see, the * is under main.Content = '3' and if you 
know Oracle SQL a bit then it is obvious that you can't do '=' on a 
CLOB. So this qualifies as a bug.


Are you sure you're on 3.8.4 because I posted to rt-devel about 
something like it but that was for 3.8.6 where they overhauled 
hierarchical customfields and I found that converting from old to new 
resulted in something like this.


Regards,

Joop





___
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