CGI Modifications

search.cgi

Description:

This CGI enhanced the default search function with status.cgi that Nagios uses by default to search hosts.

With search.cgi, now you can use regular expressions to match either hosts or services.

Current Version

1.0.1

Last Release Date

2014-04-10

Compatible With

  • Nagios 3.x

Owner

License

GPL


Project Files
Project Photos
Project Notes
This CGI enhanced the default search function with status.cgi that Nagios uses by default to search hosts.
With search.cgi, now you can use regular expressions to match either hosts or services.
Release notes:
1.0.0
=================================
First release
=================================
1.0.1
Support searching host alias
Support showing notes_url
Installation instructions:
1. Download search.cgi and put in nagios/sbin
2. Add the following lines to anywhere you like in nagios/share/side.php:
<div class="navbarsearch"> <form method="get" action="<?php echo $cfg["cgi_base_url"];?>/search.cgi" target="<?php echo $link_target;?>"> <fieldset> <legend>Host Search:</legend> <input type='hidden' name='search' value='host'> <input type='text' name='host' size='15' class="NavBarSearchItem"> </fieldset> </form> </div> <div class="navbarsearch"> <form method="get" action="<?php echo $cfg["cgi_base_url"];?>/search.cgi" target="<?php echo $link_target;?>"> <fieldset> <legend>Service Search:</legend> <input type='hidden' name='search' value='service'> <input type='text' name='host' size='15' class="NavBarSearchItem"> </fieldset> </form> </div>
Reviews (5) Add a Review
Excellent, but with a bug
by DrydenK, June 30, 2019

Would rate as excellent, if not for a bug. When you search for services, it lists all found services with the status 'PENDING' and with an empty status information, even when they are ok. The Host search works fine. This is for Nagios-core 4.4.3 (currently the latest release).



Works Great! Solved Issue
by rtim, November 30, 2017

I followed the installation steps and verified that the permissions are correct on the file, but I was getting an "Internal Server Error" when I search. I found that I needed to install perl-CGI in my CentOS server. Hope this helps someone! Thanks for this. Can't believe something like this isn't already built into Nagios.



Very good but seems to have a bug
by p-thor, September 30, 2016

I really like the regex of it all. Searches most things. But I have found that when the host alias is missing it does not work properly. Also the search does a grep -A INT so if the configuration is less default and places the grep'ed variable outside of the lookahead it will fail also. example: grep -EA2 "define[ ]+host[ ]+" /path/to/objects.cache | grep -Eo "(host_name|alias).+" if alias is on position 3+ it will miss it. Perhaps first grep all the required parameters and then split the ones you want. Something like below. example: grep "(host_name|alias|define[ ]+host[ ]+).+" |grep -EA2 "define[ ]+host[ ]+" /path/to/objects.cache | grep -Eo "(host_name|alias).+"



Love it, but it needs sorting.
by GavinH, December 31, 2015

One thing it needs is, column sorting. I've been trying to add sorting to it - but I am no expert. Other than that, intergration was easy and I like it a lot.



It must be in Nagios Core
by whutest, June 30, 2015

Buit-in search in Nagios 3 and 4 is poor. This plugin is cool and must be in Nagios by default. Thanks!



Add a Review

You must be logged in to submit a review.

Thank you for your review!

Your review has been submitted and is pending approval.

Recommend

To:


From:


Thank you for your recommendation!

Your recommendation has been sent.

Project Stats
Rating
4.5 (8)
Favorites
2
Views
38,993