Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

nagiosAck

Rating
1 vote
Favoured:
0
Current Version
1.0.1
Last Release Date
2016-01-20
Compatible With
  • Nagios 3.x
  • Nagios 4.x
  • Nagios XI
Owner
License
GPL
Hits
8125
Files:
FileDescription
nagiosAck.plnagiosAck.pl
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
nagiosAck is an enhancement of the existing "Remove acknowledgements older than n hours / days / weeks and send a report" project (available at
https://exchange.nagios.org/directory/Addons/Comments-and-Acknowledgements/Remove-acknowledgements-older-than-n-hours--2F-days--2F-weeks-and-send-a-report/details).
Usage: nagiosAck |<-?> [OPTION]...

COMMAND
-a, --add Add acknowledgement
-r, --remove Remove acknowledgement(s)
-i, --info Get acknowledgement details
-?, --help Display this help text
-V, --version Display version info

OPTIONS
Searching:
--older-than Older than @tag
--since-last-remove Since last remove time
--use-ack-comment Use attributes from acknowledgement comment
--no-end-time Acks with no end time
--type Regex of definition type
--host Regex of host
--service Regex of service
--author Regex of author
--comment Regex of comment
--commentid Regex of comment id

Other:
--test Do nothing except display actions that would be performed
--email-report Send an email report
--logfile Log to file
-v, --verbose Verbose output
-d, --debug Debug output

IMPORTANT
Ensure that "retention.dat" is up to date before running this program (ie.
reload Nagios).

TAGS
The following tags can be specified in an acknowledgement comment or with
the --older-than option (don't forget to persist the comment):

@period:[nd] [nh] [nm] [ns]
@until:yyyy-mm-dd hh:mm[:ss]

EXAMPLES
Removing:
Remove all acknowledgements (use with caution, or add --test):

# nagiosAck.pl -r

Remove any acknowledgement older than 8 days 7 hours 6 minutes and 5 seconds
(ie. 716765 seconds):

# nagiosAck.pl -r --older-than="@period:8d 7h 6m 5s"

Remove any acknowledgement older than Thu Jan 12 21:15 2016:

# nagiosAck.pl -r --older-than="@until:2016-01-21 21:15"

Remove acknowledgements based on the @tag in its acknowledgement comment:

# nagiosAck.pl -r --use-ack-comment

Remove useless acknowledgements from all 'nagios.org' subdomains older than
31 days:

# nagiosAck.pl -r --host=".*.nagios.org" --comment="test"
--older-than="31d"

Adding:
Add a host acknowledgement:

# nagiosAck.pl -a --host="old.nagios.com" --author="admin"
--comment="@until:2016-01-015 09:00"

Add multiple service acknowledgements for multiple hosts:

# nagiosAck.pl -a --host="exchange.nagios.com,assets.nagios.com"
--service="ping,ssh" --author="admin" --comment="@period:15m"

Searching:
Find all host acknowledgements from host 'webserver':

# nagiosAck.pl -i --type="host" --host="webserver"

Find all service acknowledgements with 'test' in the comment:

# nagiosAck.pl -i --type="service" --comment="test"

Find all acknowledgements created by user1:

# nagiosAck.pl -i --author="user1"

Reporting:
Remove host acknowledgements matching "test*123" and send a report to a
list of email recipients:

# nagiosAck.pl -r --host="test.*d+"
--email-report="root@localhost,admin@website.com"

Logging:
Log remove-all actions to a file:

# nagiosAck.pl -r --logfile="/tmp/acks.log"

For more information and advanced options, see the source code. Also refer to
the "External Commands" section of the Nagios server documentation.
Reviews (1)
This doesn't seem to work on my box, running Perl 5.32.1. I don't know Perl well enough to fix. Here's the run and log:

./nagiosAck.pl -r --test
given is experimental at ./nagiosAck.pl line 597.
when is experimental at ./nagiosAck.pl line 598.
when is experimental at ./nagiosAck.pl line 601.
given is experimental at ./nagiosAck.pl line 638.
when is experimental at ./nagiosAck.pl line 639.
when is experimental at ./nagiosAck.pl line 640.
given is experimental at ./nagiosAck.pl line 694.
when is experimental at ./nagiosAck.pl line 695.
when is experimental at ./nagiosAck.pl line 696.
when is experimental at ./nagiosAck.pl line 697.
when is experimental at ./nagiosAck.pl line 698.
when is experimental at ./nagiosAck.pl line 699.
when is experimental at ./nagiosAck.pl line 700.
when is experimental at ./nagiosAck.pl line 701.
when is experimental at ./nagiosAck.pl line 702.
when is experimental at ./nagiosAck.pl line 703.
when is experimental at ./nagiosAck.pl line 704.
when is experimental at ./nagiosAck.pl line 705.
given is experimental at ./nagiosAck.pl line 736.
when is experimental at ./nagiosAck.pl line 737.
when is experimental at ./nagiosAck.pl line 738.
Experimental keys on scalar is now forbidden at ./nagiosAck.pl line 430.
Type of arg 1 to keys must be hash or array (not private variable) at ./nagiosAck.pl line 430, near "$service) "
Execution of ./nagiosAck.pl aborted due to compilation errors.