// Nagios BPI (Business Process Intelligence) 
// Copyright (c) 2010 Nagios Enterprises, LLC.
// Written by Mike Guthrie <mguthrie@nagios.com>
//
// LICENSE:
//
// This work is made available to you under the terms of Version 2 of
// the GNU General Public License. A copy of that license should have
// been provided with this software, but in any event can be obtained
// from http://www.fsf.org.
// 
// This work is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
// 02110-1301 or visit their web page on the internet at
// http://www.fsf.org.
//
//
// CONTRIBUTION POLICY:
//
// (The following paragraph is not intended to limit the rights granted
// to you to modify and distribute this software under the terms of
// licenses that may apply to the software.)
//
// Contributions to this software are subject to your understanding and acceptance of
// the terms and conditions of the Nagios Contributor Agreement, which can be found 
// online at:
//
// http://www.nagios.com/legal/contributoragreement/
//
//
// DISCLAIMER:
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
// HOLDERS BE LIABLE FOR ANY CLAIM FOR DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
// OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 
// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, STRICT LIABILITY, TORT (INCLUDING 
// NEGLIGENCE OR OTHERWISE) OR OTHER ACTION, ARISING FROM, OUT OF OR IN CONNECTION 
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.



Installation Instructions for Nagios Core 
===========================================

-Download and unzip the nagios.zip into your /tmp directory

-Copy the nagiosbpi folder inside of your Nagios directory or your preferred location that is accessible by your webserver.   (depends on your distribution).

cd /<your_nagiosbpi_location>/nagiosbpi 

-Execute the permissions script as the root user:
chmod +x set_bpi_perms.sh
./set_bpi_perms.sh

-Edit the contents of the constants.conf file to match your directory locations.  (Use absolute locations)

-Launch Nagios BPI from your web browser http://<yourserver>/nagios/nagiosbpi  

-Start creating new bpi groups using the built-in configuration tools.  


Installation on Nagios XI
==========================================
- Download the zip file onto a machine that can access XI from the web interface
- ***For upgrades***:
	- cp /usr/local/nagiosxi/html/includes/components/nagiosbpi/bpi.conf /tmp/bpi.conf
- Go to the Admin->Manage Components page
- Upload the zip file using the upload tool on the page
- chmod +x /usr/local/nagiosxi/html/includes/components/nagiosbpi/set_bpi_perms.sh
- Execute the /usr/local/nagiosxi/html/includes/components/nagiosbpi/set_bpi_perms.sh script 
- Nagios BPI should be accessible from the main-left menu of Nagios XI  



RUNNING A NAGIOS CHECK FOR BPI GROUPS 
=====================================

NAGIOS XI
=========
- Download and install the BPI Wizard to create checks for your BPI groups.
- http://exchange.nagios.org/directory/Addons/Configuration/Configuration-Wizards/Nagios-Business-Process-Intelligence-%28BPI%29-Wizard/details


NAGIOS CORE
===========
- Download the check_bpi.php script
- http://exchange.nagios.org/components/com_mtree/attachment.php?link_id=2335&cf_id=29
- Edit the 'check_bpi.php' file to point to the directory location of the 'api_tool.php' file.  
- Example:

  #!/usr/bin/php 
  <?php
  $file = '/var/www/http_public/nagiosbpi/api_tool.php'; 
  include($file);
  ?>

-Copy this file to the directory of your nagios check plugins.  (Depends on distrubition)
-Make sure the file is executable

-In your nagios/etc directory, locate your commands.cfg and add the following definition:

define command {
       command_name                  		check_bpi
       command_line                  		$USER1$/check_bpi.php $ARG1$
}

-Create a dummy host definition similar to the following:

define host {
	host_name			bpigroups
	use				generic_host
	display_name			BPI Groups
	check_command			check_dummy!0
	address				1.0.0.0
	register			1
}

-Create service definitions like the following, use the BPI Group ID as the argument.  
-(This can by found my mousing over the group name in the web interface, or by finding the 'define [groupID]' statement in your bpi.conf file).  

define service {
	host_name			bpigroups
	service_description		My BPI Group 
	use				generic_service
	check_command			check_bpi!myBpiGroupID
	register			1
}	



-A sample BPI group definitions:

#this group contains services and another group 
define MyStuff {
	title=My Stuff
	desc=This is a test group for Nagios BPI
	primary=1
	info=www.yourwebsite.com
	members=localhost;PING;&, 192.168.5.11;Ping;&, $YourStuff;&, 
	warning_threshold=2 
	priority=1 
	critical_threshold=3
	
	}

#this is a group with only services  
define YourStuff {
	title=Your Stuff
	desc=This is a group with services only 
	primary=1
	info=http://www.example.com
	members=localhost;HTTP;&, localhost;SSH;&, localhost;Swap Usage;&, 
	warning_threshold=0
	priority=1
	critical_threshold=3
}



For Questions or Support, visit the Nagios forums at:
http://support.nagios.com/forum

For patches, contributions, or feature requests, email mguthrie@nagios.com




