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

search.cgi

Rating
8 votes
Favoured:
2
Current Version
1.0.1
Last Release Date
2014-04-10
Compatible With
  • Nagios 3.x
Owner
License
GPL
Hits
37455
Files:
FileDescription
search.cgisearch.cgi
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
search.cgi
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.
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)
byDrydenK, June 18, 2019
1 of 1 people found this review helpful
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).
byrtim, November 28, 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.
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).+"
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.
Buit-in search in Nagios 3 and 4 is poor.
This plugin is cool and must be in Nagios by default.
Thanks!