<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://rt-wiki.bestpractical.com/index.php?action=history&amp;feed=atom&amp;title=AutoCloseOnNagiosRecoveryMessages</id>
	<title>AutoCloseOnNagiosRecoveryMessages - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://rt-wiki.bestpractical.com/index.php?action=history&amp;feed=atom&amp;title=AutoCloseOnNagiosRecoveryMessages"/>
	<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=AutoCloseOnNagiosRecoveryMessages&amp;action=history"/>
	<updated>2026-08-23T16:43:37Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=AutoCloseOnNagiosRecoveryMessages&amp;diff=236&amp;oldid=prev</id>
		<title>Admin: 6 revisions imported</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=AutoCloseOnNagiosRecoveryMessages&amp;diff=236&amp;oldid=prev"/>
		<updated>2016-04-06T20:03:17Z</updated>

		<summary type="html">&lt;p&gt;6 revisions imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 16:03, 6 April 2016&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key bestpractical_mediawiki1459887241:diff:1.41:old-235:rev-236 --&gt;
&lt;/table&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=AutoCloseOnNagiosRecoveryMessages&amp;diff=235&amp;oldid=prev</id>
		<title>80.30.180.36: /* Problem Description */</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=AutoCloseOnNagiosRecoveryMessages&amp;diff=235&amp;oldid=prev"/>
		<updated>2013-12-20T00:55:03Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Problem Description&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 20:55, 19 December 2013&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Problem Description ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Problem Description ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;We use Nagios to check if our machines are up and working. Every time something strange happens (swap use is too high, CPU load is above 10, and so on ) it sends an e-mail with a subject like &quot; &#039;&#039;&#039;* PROBLEM boxxor/CPU load os CRITICAL *&#039;&#039;&#039;&quot;. As soon as things back back to normal it sends another message &quot; &#039;&#039;&#039;* RECOVERY boxxor/CPU load os OK *&#039;&#039;&#039;&quot;. So, this will create two tickets in RT - two tickets that ougt to be manually merged and closed. To make things easier here I adapted the above script to merge ALL pending open/new PROBLEM messages related to a given &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;RECOBERY &lt;/del&gt;message and automatically close/resolve these tickets.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;We use Nagios to check if our machines are up and working. Every time something strange happens (swap use is too high, CPU load is above 10, and so on ) it sends an e-mail with a subject like &quot; &#039;&#039;&#039;* PROBLEM boxxor/CPU load os CRITICAL *&#039;&#039;&#039;&quot;. As soon as things back back to normal it sends another message &quot; &#039;&#039;&#039;* RECOVERY boxxor/CPU load os OK *&#039;&#039;&#039;&quot;. So, this will create two tickets in RT - two tickets that ougt to be manually merged and closed. To make things easier here I adapted the above script to merge ALL pending open/new PROBLEM messages related to a given &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;RECOVERY &lt;/ins&gt;message and automatically close/resolve these tickets.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== History ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== History ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key bestpractical_mediawiki1459887241:diff:1.41:old-234:rev-235:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>80.30.180.36</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=AutoCloseOnNagiosRecoveryMessages&amp;diff=234&amp;oldid=prev</id>
		<title>128.117.9.117: /* Problem Description */</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=AutoCloseOnNagiosRecoveryMessages&amp;diff=234&amp;oldid=prev"/>
		<updated>2011-07-21T19:53:16Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Problem Description&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 15:53, 21 July 2011&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Problem Description ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Problem Description ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;We use Nagios to check if our machines &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;ar &lt;/del&gt;up and working. Every time something strange happens (swap use is too high, CPU load is above 10, and so on ) it sends an e-mail with a subject like &quot; &#039;&#039;&#039;* PROBLEM boxxor/CPU load os CRITICAL *&#039;&#039;&#039;&quot;. As soon as things back back to normal it sends another message &quot; &#039;&#039;&#039;* RECOVERY boxxor/CPU load os OK *&#039;&#039;&#039;&quot;. So, this will create two tickets in RT - two tickets that ougt to be manually merged and closed. To make things easier here I adapted the above script to merge ALL pending open/new PROBLEM messages related to a given RECOBERY message and automatically close/resolve these tickets.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;We use Nagios to check if our machines &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;are &lt;/ins&gt;up and working. Every time something strange happens (swap use is too high, CPU load is above 10, and so on ) it sends an e-mail with a subject like &quot; &#039;&#039;&#039;* PROBLEM boxxor/CPU load os CRITICAL *&#039;&#039;&#039;&quot;. As soon as things back back to normal it sends another message &quot; &#039;&#039;&#039;* RECOVERY boxxor/CPU load os OK *&#039;&#039;&#039;&quot;. So, this will create two tickets in RT - two tickets that ougt to be manually merged and closed. To make things easier here I adapted the above script to merge ALL pending open/new PROBLEM messages related to a given RECOBERY message and automatically close/resolve these tickets.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== History ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== History ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key bestpractical_mediawiki1459887241:diff:1.41:old-233:rev-234:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>128.117.9.117</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=AutoCloseOnNagiosRecoveryMessages&amp;diff=233&amp;oldid=prev</id>
		<title>94.158.99.44 at 21:17, 15 April 2011</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=AutoCloseOnNagiosRecoveryMessages&amp;diff=233&amp;oldid=prev"/>
		<updated>2011-04-15T21:17:13Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;https://rt-wiki.bestpractical.com/index.php?title=AutoCloseOnNagiosRecoveryMessages&amp;amp;diff=233&amp;amp;oldid=232&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>94.158.99.44</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=AutoCloseOnNagiosRecoveryMessages&amp;diff=232&amp;oldid=prev</id>
		<title>94.158.99.44 at 21:15, 15 April 2011</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=AutoCloseOnNagiosRecoveryMessages&amp;diff=232&amp;oldid=prev"/>
		<updated>2011-04-15T21:15:10Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Problem Description ==&lt;br /&gt;
&lt;br /&gt;
We use Nagios to check if our machines ar up and working. Every time something strange happens (swap use is too high, CPU load is above 10, and so on ) it sends an e-mail with a subject like &amp;quot; &amp;#039;&amp;#039;&amp;#039;* PROBLEM boxxor/CPU load os CRITICAL *&amp;#039;&amp;#039;&amp;#039;&amp;quot;. As soon as things back back to normal it sends another message &amp;quot; &amp;#039;&amp;#039;&amp;#039;* RECOVERY boxxor/CPU load os OK *&amp;#039;&amp;#039;&amp;#039;&amp;quot;. So, this will create two tickets in RT - two tickets that ougt to be manually merged and closed. To make things easier here I adapted the above script to merge ALL pending open/new PROBLEM messages related to a given RECOBERY message and automatically close/resolve these tickets.&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
* Mar 2004 - original version from Todd Chapman extracted from an [http://marc.free.net.ph/message/20040319.180325.27528377.en.html email message]&lt;br /&gt;
* Nov 2009 - Sunnavy uploads plugin to the CPAN&lt;br /&gt;
* Mar 2010 - Kamil&amp;#039;s simplification of Todd&amp;#039;s variant (requires Nagios3)&lt;br /&gt;
&lt;br /&gt;
== Solutions ==&lt;br /&gt;
&lt;br /&gt;
=== Original Todd&amp;#039;s version ===&lt;br /&gt;
&lt;br /&gt;
Description: Merge Into Existing Ticket on match Condition: [[OnCreate]]&lt;br /&gt;
&lt;br /&gt;
Action: User Defined Custom action preparation code:&lt;br /&gt;
&lt;br /&gt;
 1;&lt;br /&gt;
&lt;br /&gt;
Custom action cleanup code:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;# If the subject of the ticket matches a pattern suggesting&lt;br /&gt;
  # that this is a Nagios RECOVERY message  AND there is&lt;br /&gt;
  # an existing ticket (open or new) in the &amp;quot;General&amp;quot; queue with a matching&lt;br /&gt;
  # &amp;quot;problem description&amp;quot;, (that is not this ticket)&lt;br /&gt;
  # merge this ticket into that ticket&lt;br /&gt;
  #&lt;br /&gt;
  # Based on http://marc.free.net.ph/message/20040319.180325.27528377.en.html&lt;br /&gt;
  &lt;br /&gt;
  my $problem_desc = undef;&lt;br /&gt;
  &lt;br /&gt;
  my $Transaction = $self-&amp;amp;gt;TransactionObj;&lt;br /&gt;
  my $subject = $Transaction-&amp;amp;gt;Attachments-&amp;amp;gt;First-&amp;amp;gt;GetHeader(&amp;#039;Subject&amp;#039;);&lt;br /&gt;
  if ($subject =~ /\*\* RECOVERY (\w+) - (.*) OK \*\*/) {&lt;br /&gt;
      # This looks like a nagios recovery message&lt;br /&gt;
      $problem_desc = $2;&lt;br /&gt;
  &lt;br /&gt;
      $RT::Logger-&amp;amp;gt;debug(&amp;quot;Found a recovery msg: $problem_desc&amp;quot;);&lt;br /&gt;
  } else {&lt;br /&gt;
      return 1;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  # Ok, now let&amp;#039;s merge this ticket with it&amp;#039;s PROBLEM msg.&lt;br /&gt;
  my $search = RT::Tickets-&amp;amp;gt;new($RT::SystemUser);&lt;br /&gt;
  $search-&amp;amp;gt;LimitQueue(VALUE =&amp;amp;gt; &amp;#039;General&amp;#039;);&lt;br /&gt;
  $search-&amp;amp;gt;LimitStatus(VALUE =&amp;amp;gt; &amp;#039;new&amp;#039;, OPERATOR =&amp;amp;gt; &amp;#039;=&amp;#039;, ENTRYAGGREGATOR =&amp;amp;gt; &amp;#039;or&amp;#039;);&lt;br /&gt;
  $search-&amp;amp;gt;LimitStatus(VALUE =&amp;amp;gt; &amp;#039;open&amp;#039;, OPERATOR =&amp;amp;gt; &amp;#039;=&amp;#039;);&lt;br /&gt;
  &lt;br /&gt;
  if ($search-&amp;amp;gt;Count == 0) { return 1; }&lt;br /&gt;
  my $id = undef;&lt;br /&gt;
  while (my $ticket = $search-&amp;amp;gt;Next) {&lt;br /&gt;
      # Ignore the ticket that opened this transation (the recovery one...)&lt;br /&gt;
      next if $self-&amp;amp;gt;TicketObj-&amp;amp;gt;Id == $ticket-&amp;amp;gt;Id;&lt;br /&gt;
      # Look for nagios PROBLEM warning messages...&lt;br /&gt;
      if ( $ticket-&amp;amp;gt;Subject =~ /\*\* PROBLEM (\w+) - (.*) (\w+) \*\*/ ) {&lt;br /&gt;
          if ($2 eq $problem_desc){&lt;br /&gt;
              # Aha! Found the Problem TICKET corresponding to this RECOVERY&lt;br /&gt;
              # ticket&lt;br /&gt;
              $id = $ticket-&amp;amp;gt;Id;&lt;br /&gt;
              # Nagios may send more then one PROBLEM message, right?&lt;br /&gt;
              $RT::Logger-&amp;amp;gt;debug(&amp;quot;Merging ticket &amp;quot; . $self-&amp;amp;gt;TicketObj-&amp;amp;gt;Id . &amp;quot; into $id because of OA number match.&amp;quot;);&lt;br /&gt;
              $self-&amp;amp;gt;TicketObj-&amp;amp;gt;MergeInto($id);&lt;br /&gt;
              # Keep looking for more PROBLEM tickets...&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  $id || return 1;&lt;br /&gt;
  # Auto-close/resolve this whole thing&lt;br /&gt;
  $self-&amp;amp;gt;TicketObj-&amp;amp;gt;SetStatus( &amp;quot;resolved&amp;quot; );&lt;br /&gt;
  1;&lt;br /&gt;
  &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extension from Sunnaby ===&lt;br /&gt;
&lt;br /&gt;
[http://search.cpan.org/dist/RT-Extension-Nagios/lib/RT/Extension/Nagios.pm RT-Extension-Nagios]&lt;br /&gt;
&lt;br /&gt;
=== Kamil&amp;#039;s version for Nagios3 and newer =&lt;br /&gt;
&lt;br /&gt;
by Kamil Srot (kamil.srot at nLogy dot com) 26/03/2010&lt;br /&gt;
&lt;br /&gt;
First of all - sorry for my coding, I don&amp;#039;t know Perl at all :-( Feel free to upgrade the script and let me know :-)&lt;br /&gt;
&lt;br /&gt;
I use Nagios3 and it comes with nice macro defined making integration with RT much easier. Here is example of notification, defined in Nagios (commands.cfg):&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;# &amp;#039;notify-host-by-rtemail&amp;#039; command definition&lt;br /&gt;
  define command{&lt;br /&gt;
        command_name    notify-host-by-rtemail&lt;br /&gt;
        command_line    /usr/bin/printf &amp;quot;%b&amp;quot; &amp;quot;***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nEventID: $HOSTPROBLEMID$\nLastEventID: $LASTHOSTPROBLEMID$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n&amp;quot; | /usr/bin/mail -s &amp;quot;** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **&amp;quot; $CONTACTEMAIL$&lt;br /&gt;
        }&lt;br /&gt;
  &lt;br /&gt;
  # &amp;#039;notify-service-by-rtemail&amp;#039; command definition&lt;br /&gt;
  define command{&lt;br /&gt;
        command_name    notify-service-by-rtemail&lt;br /&gt;
        command_line    /usr/bin/printf &amp;quot;%b&amp;quot; &amp;quot;***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\nEventID: $SERVICEPROBLEMID$\nLastEventID: $LASTSERVICEPROBLEMID$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$&amp;quot; | /usr/bin/mail -s &amp;quot;** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **&amp;quot; $CONTACTEMAIL$&lt;br /&gt;
        }&lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the $HOSTPROBLEMID$, $LASTHOSTPROBLEMID$, $SERVICEPROBLEMID$ and $LASTSERVICEPROBLEMID$ macros.&lt;br /&gt;
&lt;br /&gt;
The *PROBLEMID is new unique ID for the first time, a problem appears and is constant till final RECOVERY. RECOVERY has everytime *PROBLEMID eqal to 0 and LAST*PROBLEMID is the *PROBLEMID or all previous notifications.&lt;br /&gt;
&lt;br /&gt;
I use code like this, to process incoming emails and close open tickets and merge the corresponding ones:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;# ziskej telo mailu&lt;br /&gt;
  my $T_Obj = $self-&amp;amp;gt;TicketObj;&lt;br /&gt;
  my $AttachObj = $self-&amp;amp;gt;TransactionObj-&amp;amp;gt;Attachments-&amp;amp;gt;First;&lt;br /&gt;
  my $content = $AttachObj-&amp;amp;gt;Content;&lt;br /&gt;
  &lt;br /&gt;
  # extract EventID and LastEventID&lt;br /&gt;
  my $val = 0;&lt;br /&gt;
  my $EventID = undef;&lt;br /&gt;
  my $LastEventID = undef;&lt;br /&gt;
  if( $content =~ m/^\QEventID:\E\s*(\S+)\s*$/m ) {&lt;br /&gt;
   $EventID = $1;&lt;br /&gt;
  }&lt;br /&gt;
  if( $content =~ m/^\QLastEventID:\E\s*(\S+)\s*$/m ) {&lt;br /&gt;
   $LastEventID = $1;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  if($EventID == 0) {&lt;br /&gt;
   $val = $LastEventID;&lt;br /&gt;
  } else {&lt;br /&gt;
   $val = $EventID;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  # Hledej ticket se stejnym EventID&lt;br /&gt;
  my $TicketsObj = RT::Tickets-&amp;amp;gt;new($RT::SystemUser);&lt;br /&gt;
  $TicketsObj-&amp;amp;gt;LimitQueue(VALUE =&amp;amp;gt; &amp;#039;Monitoring&amp;#039;);&lt;br /&gt;
  $TicketsObj-&amp;amp;gt;LimitCustomField(CUSTOMFIELD =&amp;amp;gt; &amp;#039;NagiosProblemID&amp;#039;, OPERATOR =&amp;amp;gt; &amp;#039;=&amp;#039;, VALUE =&amp;amp;gt; $val);&lt;br /&gt;
  &lt;br /&gt;
  if ($TicketsObj-&amp;amp;gt;Count &amp;amp;gt; 0) {&lt;br /&gt;
   # nalezeno!&lt;br /&gt;
   my $id = undef;&lt;br /&gt;
   my $ticket;&lt;br /&gt;
   while ($ticket = $TicketsObj-&amp;amp;gt;Next) {&lt;br /&gt;
    next if $self-&amp;amp;gt;TicketObj-&amp;amp;gt;Id == $ticket-&amp;amp;gt;Id;&lt;br /&gt;
    $id = $ticket-&amp;amp;gt;Id;&lt;br /&gt;
    last;&lt;br /&gt;
   }&lt;br /&gt;
   if ( $id ) {&lt;br /&gt;
    # ...merge into&lt;br /&gt;
    $self-&amp;amp;gt;TicketObj-&amp;amp;gt;MergeInto($id);&lt;br /&gt;
    # kdyz je EventID = 0 zavirame parent ticket&lt;br /&gt;
    if($EventID == 0) {&lt;br /&gt;
     $self-&amp;amp;gt;TicketObj-&amp;amp;gt;SetStatus(&amp;#039;resolved&amp;#039;);&lt;br /&gt;
    }&lt;br /&gt;
    # ...and exit&lt;br /&gt;
    return 1;&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  # hmm, novej ticket.&lt;br /&gt;
  # nechame ho propadnout do fronty&lt;br /&gt;
  &lt;br /&gt;
  # a nastavit NagiosProblemID&lt;br /&gt;
  $self-&amp;amp;gt;TicketObj-&amp;amp;gt;AddCustomFieldValue( Field =&amp;amp;gt; &amp;#039;NagiosProblemID&amp;#039;, Value =&amp;amp;gt; $val, RecordTransaction=&amp;amp;gt;0 );&lt;br /&gt;
  # pokud je to recovery, tak nastavit na resolved&lt;br /&gt;
  if($EventID == 0) {&lt;br /&gt;
   $self-&amp;amp;gt;TicketObj-&amp;amp;gt;SetStatus(&amp;#039;resolved&amp;#039;);&lt;br /&gt;
  }&lt;br /&gt;
  &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>94.158.99.44</name></author>
	</entry>
</feed>