Compare commits
No commits in common. "master" and "pristine-tar" have entirely different histories.
master
...
pristine-t
204
API-DOC
204
API-DOC
@ -1,204 +0,0 @@
|
|||||||
Nagios Business Process JSON-API
|
|
||||||
================================
|
|
||||||
|
|
||||||
|
|
||||||
Starting with version 0.9.6 the Nagios Business Process AddOns have got a
|
|
||||||
JSON-API. This means You can query state information of business processes from
|
|
||||||
the Nagios Business Process AddOns in JSON format to use the results e. g. in
|
|
||||||
Your own scripts or for building up Your own GUI.
|
|
||||||
|
|
||||||
You can get any information about any business processes also by querying the
|
|
||||||
API. That means: Any information available in the Nagios Business Process AddOns
|
|
||||||
can be requested by API too.
|
|
||||||
This document describes this API.
|
|
||||||
|
|
||||||
The JSON-API is being already used by the Business Process Cronks in the new
|
|
||||||
Icinga-Web.
|
|
||||||
|
|
||||||
|
|
||||||
Calling the API
|
|
||||||
===============
|
|
||||||
|
|
||||||
There are two ways:
|
|
||||||
1. Call a local script on the machine Nagios Business Process AddOns are
|
|
||||||
running at, e. g.
|
|
||||||
sbin/nagios-bp.cgi outformat=json
|
|
||||||
(within Nagios Business Process AddOns' install path)
|
|
||||||
|
|
||||||
2. Call the script remote by HTTP(S):
|
|
||||||
http://nagioshost.example.com/nagiosbp/cgi-bin/nagios-bp.cgi?outformat=json
|
|
||||||
Normally You have to give username and password by HTTP basic auth.
|
|
||||||
A browser asks for Your credentials, but on a script You have to add them,
|
|
||||||
e. g.
|
|
||||||
curl -u nagiosadmin:secret http://nagioshost.example.com/nagiosbp/cgi-bin/nagios-bp.cgi?outformat=json
|
|
||||||
|
|
||||||
In both cases You get back a data structure in JSON format. There are modules
|
|
||||||
for every common scriping language to read JSON. Use them!
|
|
||||||
|
|
||||||
|
|
||||||
Parameters
|
|
||||||
==========
|
|
||||||
|
|
||||||
By adding more parameters when calling You can decide what information You want
|
|
||||||
to get. Append these parameters with a blank when calling local and with a &
|
|
||||||
when using HTTP(S).
|
|
||||||
e. g.
|
|
||||||
sbin/nagios-bp.cgi outformat=json tree=mail
|
|
||||||
or
|
|
||||||
http://nagioshost.example.com/nagiosbp/cgi-bin/nagios-bp.cgi?outformat=json&tree=mail
|
|
||||||
|
|
||||||
If none of the parameters tree or detail is given, a complete list of all
|
|
||||||
defined business processes is returned, the default view.
|
|
||||||
|
|
||||||
tree
|
|
||||||
----
|
|
||||||
give the name of a business process as argument, e. g.
|
|
||||||
tree=mail
|
|
||||||
|
|
||||||
returns: only one level of hierarchy in the tree of one business process
|
|
||||||
|
|
||||||
excludes: detail
|
|
||||||
(give parameter tree or detail or none of them, but never both)
|
|
||||||
|
|
||||||
detail
|
|
||||||
------
|
|
||||||
give the name of a business process as argument, e. g.
|
|
||||||
detail=mail
|
|
||||||
|
|
||||||
returns: plain list of all components in this business process without
|
|
||||||
hierarchy, going down recursively
|
|
||||||
|
|
||||||
excludes: tree
|
|
||||||
(give parameter tree or detail or none of them, but never both)
|
|
||||||
|
|
||||||
conf
|
|
||||||
----
|
|
||||||
give the name of one config as argument, e. g.
|
|
||||||
conf=nagios-bp-second-view
|
|
||||||
to read definition of business processes from
|
|
||||||
etc/nagios-bp-second-view.conf
|
|
||||||
instead of default file
|
|
||||||
etc/nagios-bp.conf
|
|
||||||
|
|
||||||
hint: the leave out path of the file and the .conf extension
|
|
||||||
|
|
||||||
lang
|
|
||||||
----
|
|
||||||
give wanted language of output as argument, e. g.
|
|
||||||
lang=en
|
|
||||||
|
|
||||||
it is only used to determine from which language files You want to
|
|
||||||
take strings for display_prio_description and display_prio_headline
|
|
||||||
|
|
||||||
|
|
||||||
Output Description
|
|
||||||
==================
|
|
||||||
|
|
||||||
The resulting JSON at the top level contains a hash map with the following
|
|
||||||
keys:
|
|
||||||
|
|
||||||
business_processes
|
|
||||||
only in default view
|
|
||||||
refers to a section with all the business processes
|
|
||||||
|
|
||||||
business_process
|
|
||||||
only in tree or detail view
|
|
||||||
refers to a section with all components of the given business process
|
|
||||||
|
|
||||||
priority_definitions
|
|
||||||
refers to a section giving display strings for every priority used
|
|
||||||
in any of the business processes found in the business_process
|
|
||||||
section. Parameter lang is only for this section.
|
|
||||||
|
|
||||||
json_created
|
|
||||||
refers to a very simple section containing only on timestamp when this
|
|
||||||
output was created
|
|
||||||
|
|
||||||
|
|
||||||
Output sections in detail
|
|
||||||
=========================
|
|
||||||
|
|
||||||
business_processes
|
|
||||||
------------------
|
|
||||||
|
|
||||||
hashmap with references to business_process objects
|
|
||||||
key is the business process name
|
|
||||||
|
|
||||||
business_process
|
|
||||||
----------------
|
|
||||||
|
|
||||||
hashmap with following keys, where values are taken from the business process
|
|
||||||
definition
|
|
||||||
|
|
||||||
bp_id
|
|
||||||
the name of a business process
|
|
||||||
display_name
|
|
||||||
the string for displaying it
|
|
||||||
display_prio
|
|
||||||
in which prio is the process displayed
|
|
||||||
may be 0 if not displayed in the top level view of the web GUI
|
|
||||||
info_url
|
|
||||||
the URL You get to when clicking the little blue i icon on the GUI
|
|
||||||
operator
|
|
||||||
the operator used in definition of this process
|
|
||||||
may be: and, or, of
|
|
||||||
hardstate
|
|
||||||
the actual (hard) state of this business process
|
|
||||||
components
|
|
||||||
array with all components
|
|
||||||
see description of components below
|
|
||||||
|
|
||||||
|
|
||||||
components
|
|
||||||
----------
|
|
||||||
|
|
||||||
array of components
|
|
||||||
in tree view or detail view components can be subprocesses or single services
|
|
||||||
in detail view components are always single services
|
|
||||||
|
|
||||||
subprocesses have fields:
|
|
||||||
|
|
||||||
subprocess
|
|
||||||
the name of a subprocess
|
|
||||||
display_name
|
|
||||||
the string for displaying this subprocess
|
|
||||||
hardstate
|
|
||||||
the actual (hard) state of this subprocess
|
|
||||||
display_prio
|
|
||||||
in which prio is the subprocess displayed
|
|
||||||
may be 0 if not displayed in the top level view of the web GUI
|
|
||||||
|
|
||||||
|
|
||||||
single services have fields
|
|
||||||
|
|
||||||
host
|
|
||||||
hostname of the service
|
|
||||||
service
|
|
||||||
servicename of the service
|
|
||||||
hardstate
|
|
||||||
the actual (hard) state of this service
|
|
||||||
plugin_output
|
|
||||||
the plugin output of last check of this service
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
priority_definitions
|
|
||||||
--------------------
|
|
||||||
|
|
||||||
hashmap to priority definitions
|
|
||||||
key is the id of the priority
|
|
||||||
fields:
|
|
||||||
|
|
||||||
display_prio_headline
|
|
||||||
headline defined in language file for this priority
|
|
||||||
|
|
||||||
display_prio_description
|
|
||||||
description defined in language file for this priority
|
|
||||||
|
|
||||||
|
|
||||||
json_created
|
|
||||||
------------
|
|
||||||
|
|
||||||
just a timestamp in format YYYY-MM-DD hh:mm:ss
|
|
||||||
|
|
||||||
|
|
12
AUTHORS
12
AUTHORS
@ -1,12 +0,0 @@
|
|||||||
Bernd Stroessenreuther, Sparda-Datenverarbeitung eG, Nuernberg, Germany,
|
|
||||||
berny1@users.sourceforge.net (Maintainer)
|
|
||||||
|
|
||||||
Contributors:
|
|
||||||
|
|
||||||
Bianca Meidt, Denic, meidt@denic.de
|
|
||||||
|
|
||||||
Hendrik Baecker
|
|
||||||
|
|
||||||
Sven Velt, team(ix) GmbH, sv@teamix.net
|
|
||||||
|
|
||||||
Frank Brunner, Brunner WEBMEDIA, info@brunner-webmedia.de
|
|
178
CHANGES
178
CHANGES
@ -1,178 +0,0 @@
|
|||||||
version 0.9.6
|
|
||||||
-------------
|
|
||||||
Feature Request 2010-003: bp_cfg2service_cfg.pl can optional generate an
|
|
||||||
additional notes line containing the description You did define
|
|
||||||
in nagios-bp.conf
|
|
||||||
use commandline switch "-n 1" if you want this
|
|
||||||
|
|
||||||
Bug 2010-004 fixed: some translation errors in english
|
|
||||||
|
|
||||||
Feature Request 2010-005: Display the timestamp when page was created
|
|
||||||
on every page.
|
|
||||||
|
|
||||||
Bug 2010-006 fixed: some typing errors in german
|
|
||||||
|
|
||||||
Preformance enhancement 2010-008: when executing check_bp_status.pl,
|
|
||||||
the info from external_info scripts is never used
|
|
||||||
so we do not execute them any longer for a better performance
|
|
||||||
|
|
||||||
Feature Request 2010-009: Better integration with Icinga.
|
|
||||||
You can use the Icinga-API by HTTP/JSON as an additional backend.
|
|
||||||
There are Cronks to integrate the Business Process View
|
|
||||||
directly in the new Icinga-Web.
|
|
||||||
|
|
||||||
Feature Request 2010-009: Whithin this feature request, Business Process
|
|
||||||
AddOns have got a JSON-API. This means You can query state
|
|
||||||
information of business processes from the Nagios Business Process
|
|
||||||
AddOns in JSON format to use the results e. g. in Your own scripts
|
|
||||||
or for building up Your own GUI. For more info, see API-DOC.
|
|
||||||
|
|
||||||
Bug 2010-010 fixed: on more errors we now display a helpful HTML page
|
|
||||||
instead of a technical error
|
|
||||||
|
|
||||||
Bug 2010-011 fixed: most generated HTML pages refresh after a certain
|
|
||||||
amount of time. On error pages this is useless. So took the
|
|
||||||
refresh out.
|
|
||||||
|
|
||||||
version 0.9.5
|
|
||||||
-------------
|
|
||||||
Bug 2008-008 fixed: info_url directives did not work, if the given URL
|
|
||||||
did contain a = sign
|
|
||||||
we thought, it was fixed in 0.9.2, but the problem still did
|
|
||||||
exist; now it should be fixed.
|
|
||||||
Feature Request 2009-021: bp_cfg2service_cfg.pl got an additional option
|
|
||||||
-o to tell where the result file should be created
|
|
||||||
so You can use each path You like, e. g. directly put it into
|
|
||||||
a cfg_dir used by Nagios
|
|
||||||
Bug 2009-022 fixed: When using whereUsed by giving host and service name
|
|
||||||
by HTTP referer, the URL decoding of the HTTP referer did not work
|
|
||||||
correct if host or service names had special characters such as /
|
|
||||||
(slash).
|
|
||||||
Feature Request 2009-023: whereUsed now also works with more than one
|
|
||||||
nagios-bp.conf
|
|
||||||
Improofment 2009-024: rewrite of an internal used method (cutOffSpaces)
|
|
||||||
for more efficiency
|
|
||||||
Bug 2009-026 fixed: whereUsed did not work, if the hostname did contain
|
|
||||||
a . (dot)
|
|
||||||
Feature Request 2009-027: added mk_livestatus as an alternative backend
|
|
||||||
for getting actual status information from Nagios
|
|
||||||
for more information, see INSTALL
|
|
||||||
Feature Request 2009-028: when calling http://<hostname>/nagiosbp/ You
|
|
||||||
are now redirected to the web GUI.
|
|
||||||
(Thanks to Sven Velt for the idea and the patch)
|
|
||||||
Feature Request 2009-029: Users can adapt the GUI to fit Your personal
|
|
||||||
needs now.
|
|
||||||
for more information see README, section "Adapting the GUI to
|
|
||||||
fit Your needs"
|
|
||||||
With this step also all generated pages were made fully
|
|
||||||
compliant to "HTML 4.01 Strict" standard.
|
|
||||||
They now validate without errors and warnings.
|
|
||||||
|
|
||||||
|
|
||||||
version 0.9.4
|
|
||||||
-------------
|
|
||||||
Feature Request 2008-021: whereUsed.cgi
|
|
||||||
Link this page from Nagios, to see in which Business Processes
|
|
||||||
the according host or service is used in.
|
|
||||||
Details see README, section Where used?
|
|
||||||
Feature Request 2009-004: You can now in the toplevel view display only
|
|
||||||
one priority.
|
|
||||||
Feature Request 2009-006: versionnumber is displayed at several points
|
|
||||||
e. g. in the web interface
|
|
||||||
Bugfix 2009-007: parsing of ndo.cfg had problems with minor inaccuracies
|
|
||||||
e. g. leading blanks
|
|
||||||
Feature Request 2009-008: when reading from NDO backend (NDO database,
|
|
||||||
ndo2fs, Merlin) You can now do a caching of the values we got from
|
|
||||||
there for a configurable amount of time to reduce the number of
|
|
||||||
backend requests.
|
|
||||||
ATTENTION: Use this feature only if there is NO OTHER possibility.
|
|
||||||
Better tune Your database.
|
|
||||||
Feature Request 2009-011: Merlin integration
|
|
||||||
You can now also use Merlin
|
|
||||||
(http://www.op5.org/community/projects/merlin) instead of NDO
|
|
||||||
database, see INSTALL for more details
|
|
||||||
Feature Request 2009-012: nagios-bp-check-ndo-connection.pl now reports
|
|
||||||
which type of backend is being used
|
|
||||||
Bugfix 2009-013: fixed get_lang_string, minor problem in variable
|
|
||||||
substitution
|
|
||||||
Feature Request 2009-014: added an info bubble for all icons while
|
|
||||||
onMouseOver
|
|
||||||
Bugfix 2009-015: when using ndo2fs some special characters like slash in
|
|
||||||
service names did not work
|
|
||||||
Bugfix 2009-017: pending status was not displayed when using ndo2fs as
|
|
||||||
backend
|
|
||||||
Rewrite 2009-018: complete rewrite of function listAllComponentsOf()
|
|
||||||
|
|
||||||
|
|
||||||
version 0.9.3
|
|
||||||
-------------
|
|
||||||
Feature Request 2008-012: made check_bp_status.pl more compliant to
|
|
||||||
the Nagios Plugin Developers Guideline
|
|
||||||
Bug 2008-025 fixed: in the INSTALL file the section about modifying
|
|
||||||
side.html there was an old (wrong) path
|
|
||||||
Feature Request 2009-001: support for ndo2fs was added
|
|
||||||
If You don't like the overhead of a database, You alternatively
|
|
||||||
can use ndo2fs (http://www.pnp4nagios.org/ndo2fs/start) which
|
|
||||||
writes the same information into the file system.
|
|
||||||
Nagios Business Process AddOns can read them from the filesystem
|
|
||||||
now as well.
|
|
||||||
(But keep in mind: ndo2fs uses NDOUTILS as well, You don't save
|
|
||||||
the installation of NDOUTILS, but only the overhead of running
|
|
||||||
a database.)
|
|
||||||
Bug 2009-002 fixed: in the Nagios plugin check_bp_status.pl the
|
|
||||||
lib path did contain an old (wrong) path
|
|
||||||
Feature Request 2009-003: a script was added that helps You to find
|
|
||||||
out easyly if the connection to Your NDO works correct
|
|
||||||
nagios-bp-check-ndo-connection.pl
|
|
||||||
Details see README section "Check if everything works"
|
|
||||||
|
|
||||||
version 0.9.2
|
|
||||||
-------------
|
|
||||||
Feature Request 2007-001: provides an installer now
|
|
||||||
build by autoconf
|
|
||||||
Feature Request 2007-007: different templates for singele business
|
|
||||||
processes
|
|
||||||
new keyword "template" in nagios-bp.conf
|
|
||||||
Bug 2008-004 fixed: nagios-bp-consistency-check.pl on some special
|
|
||||||
mistakes told config would be ok, even if it was not
|
|
||||||
Bug 2008-005 fixed: nagios-bp-consistency-check.pl in some cases was
|
|
||||||
unable to check if services were defined using hostgroups
|
|
||||||
Bug 2008-007 fixed: some dirty workarounds were necessary, if you wanted
|
|
||||||
to use more than one nagios-bp.conf
|
|
||||||
now everything can be done by parameters
|
|
||||||
Bug 2008-008 fixed: info_url directives did not work, if the given URL
|
|
||||||
did contain a = sign
|
|
||||||
Feature Request 2008-010: the perl modules do not any longer need to be
|
|
||||||
in the system INC path
|
|
||||||
Feature Request 2008-013: there is a config file for apaches conf.d
|
|
||||||
directory, so there is no need to edit Your httpd.conf manually
|
|
||||||
when installing the Nagios Business Process AddOns
|
|
||||||
Bug 2008-014 fixed: the directory for storing sessions of Nagios Business
|
|
||||||
Impact Analysis is now by default a subdirectory of the install
|
|
||||||
root directory
|
|
||||||
Bug 2008-017 fixed: not all names for service_descriptions did work well
|
|
||||||
especially when mixing up camelCase syntax with blanks and
|
|
||||||
underscores
|
|
||||||
Feature Request 2008-020: the own stylesheet is no longer needed
|
|
||||||
only those of nagios are used from now on
|
|
||||||
|
|
||||||
|
|
||||||
version 0.9.1
|
|
||||||
-------------
|
|
||||||
Bug 2007-002 fixed: nagios-bp-consistency-check.pl did not work correct
|
|
||||||
if cfg_dir directives where used in Nagios config files
|
|
||||||
Documentation Update 2007-003: remind Users to use correct spelling
|
|
||||||
in nagios-bp.conf
|
|
||||||
Feature Request 2007-004: support NDO-DB on another host more easyly
|
|
||||||
(separate parameter for hostname and port in ndo_db_readonly.cfg)
|
|
||||||
Bug 2007-005 fixed: nagios-bp-consistency-check.pl did not work correct
|
|
||||||
when services were defined no hostgroups instead of single hosts
|
|
||||||
Bug 2007-006 fixed: nagios-bp-consistency-check.pl did not work correct
|
|
||||||
when using dashes (-) in business process names
|
|
||||||
Documentation Update 2008-001: make the AuthUserFile directive (in
|
|
||||||
httpd.conf) for Nagios Business Process View by default point to
|
|
||||||
the same file as Nagios does
|
|
||||||
|
|
||||||
version 0.9.0
|
|
||||||
-------------
|
|
||||||
first public release
|
|
222
INSTALL
222
INSTALL
@ -1,222 +0,0 @@
|
|||||||
Nagios Business Process View and Nagios Business Impact Analysis
|
|
||||||
----------------------------------------------------------------
|
|
||||||
|
|
||||||
This document decribes, how to install.
|
|
||||||
If You are new to these AddOns make sure You read README before.
|
|
||||||
|
|
||||||
Requirements
|
|
||||||
------------
|
|
||||||
|
|
||||||
1. You must have Nagios (http://www.nagios.org) or Icinga
|
|
||||||
(http://www.icinga.org) installed and running.
|
|
||||||
|
|
||||||
2. You need to have one of the following possibilities to give
|
|
||||||
this software access to the actual status information Nagios or Icinga
|
|
||||||
provides
|
|
||||||
|
|
||||||
2.1 NDOUTILS
|
|
||||||
(The NDOUTILS - Nagios Data Output Utils - addon allows you to move
|
|
||||||
status and event information from Nagios to a database for later
|
|
||||||
retrieval and processing.)
|
|
||||||
see: http://www.nagios.org/download/addons/
|
|
||||||
|
|
||||||
2.2 IDOUTILS
|
|
||||||
(same for Icinga)
|
|
||||||
see: http://docs.icinga.org/latest/en/quickstart-idoutils.html
|
|
||||||
|
|
||||||
2.3 As an alternative, You may use Merlin. Merlin also requires a separate
|
|
||||||
daemon to run, also requires a MySQL database, but some people like it
|
|
||||||
more then NDOUTILS, because Merlins table structure ist simpler.
|
|
||||||
see: http://www.op5.org/community/projects/merlin
|
|
||||||
|
|
||||||
2.4 If You don't like the overhead of a database, You alternatively can
|
|
||||||
use ndo2fs which writes the same information into the file system.
|
|
||||||
(But keep in mind: ndo2fs uses NDOUTILS as well, You don't save the
|
|
||||||
installation of NDOUTILS, but only the overhead of running a database.)
|
|
||||||
see: http://www.pnp4nagios.org/ndo2fs/start
|
|
||||||
|
|
||||||
2.5 mk_livestatus
|
|
||||||
This backend is very simple. It does not need NDOUTILS, no
|
|
||||||
database and also no other separate storage in filesystem or where
|
|
||||||
ever, because it directly gets information from Nagios' or Icingas
|
|
||||||
internal memory structure.
|
|
||||||
You need at least version 1.1.2 of mk_livestatus.
|
|
||||||
see: http://mathias-kettner.de/checkmk_livestatus.html
|
|
||||||
|
|
||||||
2.6 Icinga-API
|
|
||||||
If You have the new Icinga Web Interface
|
|
||||||
(http://docs.icinga.org/latest/en/icinga-web-scratch.html) up and
|
|
||||||
running, there is the possibility to get status information from the
|
|
||||||
Icinga-API by HTTP/JSON.
|
|
||||||
You need at least Icinga-Web 1.0.3
|
|
||||||
But keep in mind: There are an additional HTTP connection and
|
|
||||||
additional PHP scripts in between. This way is much slower than
|
|
||||||
all the others!!
|
|
||||||
|
|
||||||
3. You need a WebServer installed, we describe configuration for Apache.
|
|
||||||
|
|
||||||
4. Perl > 5.8 is needed.
|
|
||||||
|
|
||||||
5. The Perl-Modul CGI::Simple must be installed
|
|
||||||
If You are not sure, type
|
|
||||||
perl -e "use CGI::Simple" && echo ok
|
|
||||||
this prints out "ok" if the module is installed and included in the
|
|
||||||
default INC path and an error otherwise.
|
|
||||||
Maybe Your linux distribution provides this as a package called
|
|
||||||
libcgi-simple-perl or so.
|
|
||||||
|
|
||||||
6. The Perl-Modul DBI must be installed
|
|
||||||
If You are not sure, type
|
|
||||||
perl -e "use DBI" && echo ok
|
|
||||||
|
|
||||||
7. The Perl-Modul JSON::XS must be installed
|
|
||||||
If You are not sure, type
|
|
||||||
perl -e "use JSON::XS" && echo ok
|
|
||||||
Maybe Your linux distribution provides this as a package called
|
|
||||||
libjson-perl or so.
|
|
||||||
|
|
||||||
8. The Perl-Modul LWP::UserAgent must be installed
|
|
||||||
If You are not sure, type
|
|
||||||
perl -e "use LWP::UserAgent" && echo ok
|
|
||||||
Maybe Your linux distribution provides this as a package called
|
|
||||||
perl-libwww-perl or so.
|
|
||||||
|
|
||||||
|
|
||||||
Install
|
|
||||||
-------
|
|
||||||
|
|
||||||
Be root.
|
|
||||||
Extract the download file
|
|
||||||
tar xvzf nagios-business-process-addon-<VERSION>.tar.gz
|
|
||||||
cd nagios-business-process-addon-<VERSION>
|
|
||||||
|
|
||||||
if using Nagios: For installation in the default path (/usr/local/nagiosbp/)
|
|
||||||
type
|
|
||||||
./configure
|
|
||||||
|
|
||||||
if using Icinga: For installation in the default path (/usr/local/nagiosbp/)
|
|
||||||
type
|
|
||||||
./configure --with-nagcgiurl=/icinga/cgi-bin --with-naghtmurl=/icinga --with-nagetc=/usr/local/icinga/etc/ --with-apache-authname="Icinga Access"
|
|
||||||
|
|
||||||
If You want to install somewhere else or if Your nagios or icinga is not
|
|
||||||
installed in the default path (/usr/local/nagios/ or /usr/local/icinga),
|
|
||||||
you can call configure with different parameters, see
|
|
||||||
./configure --help
|
|
||||||
for details.
|
|
||||||
At the end, all important parameters are listed. If they are ok, type
|
|
||||||
make install
|
|
||||||
to install Nagios Business Process AddOns.
|
|
||||||
|
|
||||||
|
|
||||||
Apache needs to know about the new files. Therefore a file nagiosbp.conf
|
|
||||||
has been put into Your Apache's conf.d directory.
|
|
||||||
The default is, that the given configuration is included in all of
|
|
||||||
Apache's virtual hosts. If this is not what you want, You can copy the
|
|
||||||
content of nagiosbp.conf into the according VirtualHost section of Your
|
|
||||||
httpd.conf and delete nagiosbp.conf afterwards.
|
|
||||||
Another possibility is, to install the file in some other path, by calling
|
|
||||||
configure e. g. with
|
|
||||||
./configure --with-httpd-conf=/usr/local/nagiosbp/etc/apache-conf.d/
|
|
||||||
and afterwards add an include statement into Apache's section for the
|
|
||||||
according VirtualHost:
|
|
||||||
Include /usr/local/nagiosbp/etc/apache-conf.d/nagiosbp.conf
|
|
||||||
|
|
||||||
Concerning the AuthName directives (there are two) in this file:
|
|
||||||
make sure they are exactly the same as in Nagios' or Icingas Apache
|
|
||||||
config file (conf.d/nagios.conf or conf.d/icinga.conf)
|
|
||||||
Otherwise in the web GUI you are prompte twice for Your username and
|
|
||||||
password. Once when accessing a page of Nagios or Icinga and once when
|
|
||||||
accessing a page of the Business Process AddOns.
|
|
||||||
|
|
||||||
You can give the correct AuthName when calling configure by giving the
|
|
||||||
additional parameter --with-apache-authname or by editing the file
|
|
||||||
conf.d/nagiosbp.conf afterwards.
|
|
||||||
|
|
||||||
If You are done with Your Apache configuration, by typing
|
|
||||||
apachectl configtest
|
|
||||||
You can check Your configuration. If it reports no error, reload Your
|
|
||||||
Apache.
|
|
||||||
|
|
||||||
For Nagios Business Impact Analysis, a cron job has been created for You,
|
|
||||||
that throws away old session files. It is normally located in /etc/cron.d
|
|
||||||
|
|
||||||
In Nagios or Icinga You need some links so that You can use the 2 AddOns
|
|
||||||
|
|
||||||
If using Nagios edit /usr/local/nagios/share/side.html
|
|
||||||
e. g. after this section
|
|
||||||
<tr>
|
|
||||||
<td width=13><img src="images/greendot.gif" width="13" height="14" name="statuswrl-dot"></td>
|
|
||||||
<td nowrap><a href="/nagios/cgi-bin/statuswrl.cgi?host=all" target="main" onMouseOver="switchdot('statuswrl-dot',1)" onMouseOut="switchdot('statuswrl-dot',0)" class="NavBarItem">3-D Status Map</a></td>
|
|
||||||
</tr>
|
|
||||||
You insert the following lines:
|
|
||||||
<tr>
|
|
||||||
<td width=13><img src="images/greendot.gif" width="13" height="14" name="statuswrl-dot"></td>
|
|
||||||
<td nowrap><a href="/nagiosbp/cgi-bin/nagios-bp.cgi" target="main" onMouseOver="switchdot('statuswrl-dot',1)" onMouseOut="switchdot('statuswrl-dot',0)" class="NavBarItem">Business Process View</a></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td width=13><img src="images/greendot.gif" width="13" height="14" name="statuswrl-dot"></td>
|
|
||||||
<td nowrap><a href="/nagiosbp/cgi-bin/nagios-bp.cgi?mode=bi" target="main" onMouseOver="switchdot('statuswrl-dot',1)" onMouseOut="switchdot('statuswrl-dot',0)" class="NavBarItem">Business Impact</a></td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
If using Icinga with the classic web GUI edit
|
|
||||||
/usr/local/icinga/share/menu.html
|
|
||||||
e. g. after this section
|
|
||||||
<li class="menuli_style1"><a href="/icinga/cgi-bin/extinfo.cgi?&type=7" target="main">Scheduling Queue</a></li>
|
|
||||||
You insert the following lines:
|
|
||||||
<li class="menuli_style2"><a href="/nagiosbp/cgi-bin/nagios-bp.cgi" target="main">Business Process View</a></li>
|
|
||||||
<li class="menuli_style1"><a href="/nagiosbp/cgi-bin/nagios-bp.cgi?mode=bi" target="main">Business Impact</a></li>
|
|
||||||
|
|
||||||
As Nagios Business Process AddOns use the stylesheets of Nagios or Icinga
|
|
||||||
the web GUI has the look and feel of Nagios when installed with Nagios
|
|
||||||
and the look and feel of Icinga when installed with Icinga.
|
|
||||||
In very little details they differ. So when using Icinga with the classic
|
|
||||||
web GUI You might want to insert the following line
|
|
||||||
#nbp_foot_version, #nbp_foot_language, .nbp_text_small, .nbp_text_tiny { font-size:100%; }
|
|
||||||
into share/stylesheets/user.css
|
|
||||||
Otherwise some elements on the web GUI would look very tiny.
|
|
||||||
|
|
||||||
If using Icinga with the new Icinga-Web you need to add the additional
|
|
||||||
cronks there. You find a download link for the Business Process Icinga
|
|
||||||
Cronk at
|
|
||||||
http://nagiosbp.projects.nagiosforge.org/download.shtml
|
|
||||||
Please see the documention there to include them into Your installation.
|
|
||||||
|
|
||||||
Now it's time to set up some config files.
|
|
||||||
|
|
||||||
If You are running with a database (NDO database, IDO database or merlin
|
|
||||||
database) create a user on Your database.
|
|
||||||
The user needs only select privileges.
|
|
||||||
|
|
||||||
If You are running NDO with ndo2fs, You have to make sure, the user Your
|
|
||||||
webserver is running under has read access to the output files of ndo2fs.
|
|
||||||
You might therefor want to append something like
|
|
||||||
-o UMASK=002
|
|
||||||
to the line
|
|
||||||
ndo2fsParam
|
|
||||||
in the init-Script of ndo2fs (normally found under /etc/init.d/ndo2fs)
|
|
||||||
|
|
||||||
If You are running with mk_livestatus, You have to make sure, the user Your
|
|
||||||
webserver is running under has read access to the unix socket which has
|
|
||||||
been created by mk_livestatus (by default: /usr/local/nagios/var/rw/live)
|
|
||||||
|
|
||||||
When using the Icinga-API as backend, please note:
|
|
||||||
The cooperation of Icinga-API and Nagios Business Process AddOns is not
|
|
||||||
yet in use in a large number of setups in production. Also this one is the
|
|
||||||
backend with the most overhead (an additional layer of HTTP and additional
|
|
||||||
PHP scripts are used to get data). Therefor the performance is not as good
|
|
||||||
as with the other backends.
|
|
||||||
|
|
||||||
So if You have a big setup or a need for well tested software, You might want
|
|
||||||
to use it with a NDO database, IDO database or mk_livestatus.
|
|
||||||
|
|
||||||
Now move etc/ndo.cfg-sample to etc/ndo.cfg and edit it
|
|
||||||
change all the parameters there according to Your setup and
|
|
||||||
- if using a database backend - the user You just created
|
|
||||||
all parameters have comments there.
|
|
||||||
If You did install all components with their default path
|
|
||||||
and settings, You probably will not have to change a lot.
|
|
||||||
|
|
||||||
Now You have finished the installation. Go ahead by configuring Your
|
|
||||||
Business Processes as described in README
|
|
||||||
|
|
||||||
Especially do not miss nagios-bp-check-ndo-connection.pl
|
|
340
LICENSE
340
LICENSE
@ -1,340 +0,0 @@
|
|||||||
GNU GENERAL PUBLIC LICENSE
|
|
||||||
Version 2, June 1991
|
|
||||||
|
|
||||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
|
||||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The licenses for most software are designed to take away your
|
|
||||||
freedom to share and change it. By contrast, the GNU General Public
|
|
||||||
License is intended to guarantee your freedom to share and change free
|
|
||||||
software--to make sure the software is free for all its users. This
|
|
||||||
General Public License applies to most of the Free Software
|
|
||||||
Foundation's software and to any other program whose authors commit to
|
|
||||||
using it. (Some other Free Software Foundation software is covered by
|
|
||||||
the GNU Library General Public License instead.) You can apply it to
|
|
||||||
your programs, too.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
|
||||||
have the freedom to distribute copies of free software (and charge for
|
|
||||||
this service if you wish), that you receive source code or can get it
|
|
||||||
if you want it, that you can change the software or use pieces of it
|
|
||||||
in new free programs; and that you know you can do these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to make restrictions that forbid
|
|
||||||
anyone to deny you these rights or to ask you to surrender the rights.
|
|
||||||
These restrictions translate to certain responsibilities for you if you
|
|
||||||
distribute copies of the software, or if you modify it.
|
|
||||||
|
|
||||||
For example, if you distribute copies of such a program, whether
|
|
||||||
gratis or for a fee, you must give the recipients all the rights that
|
|
||||||
you have. You must make sure that they, too, receive or can get the
|
|
||||||
source code. And you must show them these terms so they know their
|
|
||||||
rights.
|
|
||||||
|
|
||||||
We protect your rights with two steps: (1) copyright the software, and
|
|
||||||
(2) offer you this license which gives you legal permission to copy,
|
|
||||||
distribute and/or modify the software.
|
|
||||||
|
|
||||||
Also, for each author's protection and ours, we want to make certain
|
|
||||||
that everyone understands that there is no warranty for this free
|
|
||||||
software. If the software is modified by someone else and passed on, we
|
|
||||||
want its recipients to know that what they have is not the original, so
|
|
||||||
that any problems introduced by others will not reflect on the original
|
|
||||||
authors' reputations.
|
|
||||||
|
|
||||||
Finally, any free program is threatened constantly by software
|
|
||||||
patents. We wish to avoid the danger that redistributors of a free
|
|
||||||
program will individually obtain patent licenses, in effect making the
|
|
||||||
program proprietary. To prevent this, we have made it clear that any
|
|
||||||
patent must be licensed for everyone's free use or not licensed at all.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow.
|
|
||||||
|
|
||||||
GNU GENERAL PUBLIC LICENSE
|
|
||||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
||||||
|
|
||||||
0. This License applies to any program or other work which contains
|
|
||||||
a notice placed by the copyright holder saying it may be distributed
|
|
||||||
under the terms of this General Public License. The "Program", below,
|
|
||||||
refers to any such program or work, and a "work based on the Program"
|
|
||||||
means either the Program or any derivative work under copyright law:
|
|
||||||
that is to say, a work containing the Program or a portion of it,
|
|
||||||
either verbatim or with modifications and/or translated into another
|
|
||||||
language. (Hereinafter, translation is included without limitation in
|
|
||||||
the term "modification".) Each licensee is addressed as "you".
|
|
||||||
|
|
||||||
Activities other than copying, distribution and modification are not
|
|
||||||
covered by this License; they are outside its scope. The act of
|
|
||||||
running the Program is not restricted, and the output from the Program
|
|
||||||
is covered only if its contents constitute a work based on the
|
|
||||||
Program (independent of having been made by running the Program).
|
|
||||||
Whether that is true depends on what the Program does.
|
|
||||||
|
|
||||||
1. You may copy and distribute verbatim copies of the Program's
|
|
||||||
source code as you receive it, in any medium, provided that you
|
|
||||||
conspicuously and appropriately publish on each copy an appropriate
|
|
||||||
copyright notice and disclaimer of warranty; keep intact all the
|
|
||||||
notices that refer to this License and to the absence of any warranty;
|
|
||||||
and give any other recipients of the Program a copy of this License
|
|
||||||
along with the Program.
|
|
||||||
|
|
||||||
You may charge a fee for the physical act of transferring a copy, and
|
|
||||||
you may at your option offer warranty protection in exchange for a fee.
|
|
||||||
|
|
||||||
2. You may modify your copy or copies of the Program or any portion
|
|
||||||
of it, thus forming a work based on the Program, and copy and
|
|
||||||
distribute such modifications or work under the terms of Section 1
|
|
||||||
above, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) You must cause the modified files to carry prominent notices
|
|
||||||
stating that you changed the files and the date of any change.
|
|
||||||
|
|
||||||
b) You must cause any work that you distribute or publish, that in
|
|
||||||
whole or in part contains or is derived from the Program or any
|
|
||||||
part thereof, to be licensed as a whole at no charge to all third
|
|
||||||
parties under the terms of this License.
|
|
||||||
|
|
||||||
c) If the modified program normally reads commands interactively
|
|
||||||
when run, you must cause it, when started running for such
|
|
||||||
interactive use in the most ordinary way, to print or display an
|
|
||||||
announcement including an appropriate copyright notice and a
|
|
||||||
notice that there is no warranty (or else, saying that you provide
|
|
||||||
a warranty) and that users may redistribute the program under
|
|
||||||
these conditions, and telling the user how to view a copy of this
|
|
||||||
License. (Exception: if the Program itself is interactive but
|
|
||||||
does not normally print such an announcement, your work based on
|
|
||||||
the Program is not required to print an announcement.)
|
|
||||||
|
|
||||||
These requirements apply to the modified work as a whole. If
|
|
||||||
identifiable sections of that work are not derived from the Program,
|
|
||||||
and can be reasonably considered independent and separate works in
|
|
||||||
themselves, then this License, and its terms, do not apply to those
|
|
||||||
sections when you distribute them as separate works. But when you
|
|
||||||
distribute the same sections as part of a whole which is a work based
|
|
||||||
on the Program, the distribution of the whole must be on the terms of
|
|
||||||
this License, whose permissions for other licensees extend to the
|
|
||||||
entire whole, and thus to each and every part regardless of who wrote it.
|
|
||||||
|
|
||||||
Thus, it is not the intent of this section to claim rights or contest
|
|
||||||
your rights to work written entirely by you; rather, the intent is to
|
|
||||||
exercise the right to control the distribution of derivative or
|
|
||||||
collective works based on the Program.
|
|
||||||
|
|
||||||
In addition, mere aggregation of another work not based on the Program
|
|
||||||
with the Program (or with a work based on the Program) on a volume of
|
|
||||||
a storage or distribution medium does not bring the other work under
|
|
||||||
the scope of this License.
|
|
||||||
|
|
||||||
3. You may copy and distribute the Program (or a work based on it,
|
|
||||||
under Section 2) in object code or executable form under the terms of
|
|
||||||
Sections 1 and 2 above provided that you also do one of the following:
|
|
||||||
|
|
||||||
a) Accompany it with the complete corresponding machine-readable
|
|
||||||
source code, which must be distributed under the terms of Sections
|
|
||||||
1 and 2 above on a medium customarily used for software interchange; or,
|
|
||||||
|
|
||||||
b) Accompany it with a written offer, valid for at least three
|
|
||||||
years, to give any third party, for a charge no more than your
|
|
||||||
cost of physically performing source distribution, a complete
|
|
||||||
machine-readable copy of the corresponding source code, to be
|
|
||||||
distributed under the terms of Sections 1 and 2 above on a medium
|
|
||||||
customarily used for software interchange; or,
|
|
||||||
|
|
||||||
c) Accompany it with the information you received as to the offer
|
|
||||||
to distribute corresponding source code. (This alternative is
|
|
||||||
allowed only for noncommercial distribution and only if you
|
|
||||||
received the program in object code or executable form with such
|
|
||||||
an offer, in accord with Subsection b above.)
|
|
||||||
|
|
||||||
The source code for a work means the preferred form of the work for
|
|
||||||
making modifications to it. For an executable work, complete source
|
|
||||||
code means all the source code for all modules it contains, plus any
|
|
||||||
associated interface definition files, plus the scripts used to
|
|
||||||
control compilation and installation of the executable. However, as a
|
|
||||||
special exception, the source code distributed need not include
|
|
||||||
anything that is normally distributed (in either source or binary
|
|
||||||
form) with the major components (compiler, kernel, and so on) of the
|
|
||||||
operating system on which the executable runs, unless that component
|
|
||||||
itself accompanies the executable.
|
|
||||||
|
|
||||||
If distribution of executable or object code is made by offering
|
|
||||||
access to copy from a designated place, then offering equivalent
|
|
||||||
access to copy the source code from the same place counts as
|
|
||||||
distribution of the source code, even though third parties are not
|
|
||||||
compelled to copy the source along with the object code.
|
|
||||||
|
|
||||||
4. You may not copy, modify, sublicense, or distribute the Program
|
|
||||||
except as expressly provided under this License. Any attempt
|
|
||||||
otherwise to copy, modify, sublicense or distribute the Program is
|
|
||||||
void, and will automatically terminate your rights under this License.
|
|
||||||
However, parties who have received copies, or rights, from you under
|
|
||||||
this License will not have their licenses terminated so long as such
|
|
||||||
parties remain in full compliance.
|
|
||||||
|
|
||||||
5. You are not required to accept this License, since you have not
|
|
||||||
signed it. However, nothing else grants you permission to modify or
|
|
||||||
distribute the Program or its derivative works. These actions are
|
|
||||||
prohibited by law if you do not accept this License. Therefore, by
|
|
||||||
modifying or distributing the Program (or any work based on the
|
|
||||||
Program), you indicate your acceptance of this License to do so, and
|
|
||||||
all its terms and conditions for copying, distributing or modifying
|
|
||||||
the Program or works based on it.
|
|
||||||
|
|
||||||
6. Each time you redistribute the Program (or any work based on the
|
|
||||||
Program), the recipient automatically receives a license from the
|
|
||||||
original licensor to copy, distribute or modify the Program subject to
|
|
||||||
these terms and conditions. You may not impose any further
|
|
||||||
restrictions on the recipients' exercise of the rights granted herein.
|
|
||||||
You are not responsible for enforcing compliance by third parties to
|
|
||||||
this License.
|
|
||||||
|
|
||||||
7. If, as a consequence of a court judgment or allegation of patent
|
|
||||||
infringement or for any other reason (not limited to patent issues),
|
|
||||||
conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot
|
|
||||||
distribute so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you
|
|
||||||
may not distribute the Program at all. For example, if a patent
|
|
||||||
license would not permit royalty-free redistribution of the Program by
|
|
||||||
all those who receive copies directly or indirectly through you, then
|
|
||||||
the only way you could satisfy both it and this License would be to
|
|
||||||
refrain entirely from distribution of the Program.
|
|
||||||
|
|
||||||
If any portion of this section is held invalid or unenforceable under
|
|
||||||
any particular circumstance, the balance of the section is intended to
|
|
||||||
apply and the section as a whole is intended to apply in other
|
|
||||||
circumstances.
|
|
||||||
|
|
||||||
It is not the purpose of this section to induce you to infringe any
|
|
||||||
patents or other property right claims or to contest validity of any
|
|
||||||
such claims; this section has the sole purpose of protecting the
|
|
||||||
integrity of the free software distribution system, which is
|
|
||||||
implemented by public license practices. Many people have made
|
|
||||||
generous contributions to the wide range of software distributed
|
|
||||||
through that system in reliance on consistent application of that
|
|
||||||
system; it is up to the author/donor to decide if he or she is willing
|
|
||||||
to distribute software through any other system and a licensee cannot
|
|
||||||
impose that choice.
|
|
||||||
|
|
||||||
This section is intended to make thoroughly clear what is believed to
|
|
||||||
be a consequence of the rest of this License.
|
|
||||||
|
|
||||||
8. If the distribution and/or use of the Program is restricted in
|
|
||||||
certain countries either by patents or by copyrighted interfaces, the
|
|
||||||
original copyright holder who places the Program under this License
|
|
||||||
may add an explicit geographical distribution limitation excluding
|
|
||||||
those countries, so that distribution is permitted only in or among
|
|
||||||
countries not thus excluded. In such case, this License incorporates
|
|
||||||
the limitation as if written in the body of this License.
|
|
||||||
|
|
||||||
9. The Free Software Foundation may publish revised and/or new versions
|
|
||||||
of the General Public License from time to time. Such new versions will
|
|
||||||
be similar in spirit to the present version, but may differ in detail to
|
|
||||||
address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the Program
|
|
||||||
specifies a version number of this License which applies to it and "any
|
|
||||||
later version", you have the option of following the terms and conditions
|
|
||||||
either of that version or of any later version published by the Free
|
|
||||||
Software Foundation. If the Program does not specify a version number of
|
|
||||||
this License, you may choose any version ever published by the Free Software
|
|
||||||
Foundation.
|
|
||||||
|
|
||||||
10. If you wish to incorporate parts of the Program into other free
|
|
||||||
programs whose distribution conditions are different, write to the author
|
|
||||||
to ask for permission. For software which is copyrighted by the Free
|
|
||||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
|
||||||
make exceptions for this. Our decision will be guided by the two goals
|
|
||||||
of preserving the free status of all derivatives of our free software and
|
|
||||||
of promoting the sharing and reuse of software generally.
|
|
||||||
|
|
||||||
NO WARRANTY
|
|
||||||
|
|
||||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
|
||||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
|
||||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
|
||||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
|
||||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
|
||||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
|
||||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
|
||||||
REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
|
||||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
|
||||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
|
||||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
|
||||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
|
||||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
|
||||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
|
||||||
POSSIBILITY OF SUCH DAMAGES.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
convey the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) 19yy <name of author>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If the program is interactive, make it output a short notice like this
|
|
||||||
when it starts in an interactive mode:
|
|
||||||
|
|
||||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
|
||||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
|
||||||
This is free software, and you are welcome to redistribute it
|
|
||||||
under certain conditions; type `show c' for details.
|
|
||||||
|
|
||||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
|
||||||
parts of the General Public License. Of course, the commands you use may
|
|
||||||
be called something other than `show w' and `show c'; they could even be
|
|
||||||
mouse-clicks or menu items--whatever suits your program.
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or your
|
|
||||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
|
||||||
necessary. Here is a sample; alter the names:
|
|
||||||
|
|
||||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
|
||||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
|
||||||
|
|
||||||
<signature of Ty Coon>, 1 April 1989
|
|
||||||
Ty Coon, President of Vice
|
|
||||||
|
|
||||||
This General Public License does not permit incorporating your program into
|
|
||||||
proprietary programs. If your program is a subroutine library, you may
|
|
||||||
consider it more useful to permit linking proprietary applications with the
|
|
||||||
library. If this is what you want to do, use the GNU Library General
|
|
||||||
Public License instead of this License.
|
|
159
Makefile.in
159
Makefile.in
@ -1,159 +0,0 @@
|
|||||||
###############################
|
|
||||||
# Makefile for NagiosBP
|
|
||||||
#
|
|
||||||
# Last Modified: 21-02-2008
|
|
||||||
###############################
|
|
||||||
|
|
||||||
|
|
||||||
# Source code directories
|
|
||||||
SRC_CGIBIN=@srcdir@/sbin
|
|
||||||
SRC_BIN=@srcdir@/bin
|
|
||||||
SRC_CONFIG=@srcdir@/etc
|
|
||||||
SRC_LANG=@srcdir@/share/lang
|
|
||||||
SRC_LIBEXEC=@srcdir@/libexec
|
|
||||||
SRC_LIBS=@srcdir@/lib
|
|
||||||
SRC_SHARE=@srcdir@/share
|
|
||||||
SRC_VAR=@srcdir@/var
|
|
||||||
|
|
||||||
|
|
||||||
#CC=@CC@
|
|
||||||
#CFLAGS=@CFLAGS@ @DEFS@
|
|
||||||
#LDFLAGS=@LDFLAGS@ @LIBS@
|
|
||||||
|
|
||||||
prefix=@prefix@
|
|
||||||
exec_prefix=@exec_prefix@
|
|
||||||
LOGDIR=@localstatedir@
|
|
||||||
CFGDIR=@sysconfdir@
|
|
||||||
BINDIR=@bindir@
|
|
||||||
LIBEXECDIR=@libexecdir@
|
|
||||||
CGIDIR=@sbindir@
|
|
||||||
HTMLDIR=@datadir@
|
|
||||||
INSTALL=@INSTALL@
|
|
||||||
INSTALL_OPTS=@INSTALL_OPTS@
|
|
||||||
DATAROOTDIR=@datarootdir@
|
|
||||||
CRON_D_DIR=@CRON_D_DIR@
|
|
||||||
|
|
||||||
CP=@CP@
|
|
||||||
|
|
||||||
@SET_MAKE@
|
|
||||||
|
|
||||||
none:
|
|
||||||
@echo "Please supply a command line argument (i.e. 'make all'). Other targets are:"
|
|
||||||
@echo " clean"
|
|
||||||
@echo " install install-init install-config install-processperfdata install-html fullinstall"
|
|
||||||
# @echo " uninstall"
|
|
||||||
|
|
||||||
all:
|
|
||||||
cd $(SRC_BASE) && $(MAKE)
|
|
||||||
cd $(SRC_SHARE) && $(MAKE)
|
|
||||||
cd $(SRC_SCRIPTS) && $(MAKE)
|
|
||||||
|
|
||||||
@echo ""
|
|
||||||
@echo "*** Compile finished ***"
|
|
||||||
@echo ""
|
|
||||||
@echo " make install"
|
|
||||||
@echo " - This installs the main program and HTML files"
|
|
||||||
@echo ""
|
|
||||||
@echo "Enjoy."
|
|
||||||
@echo ""
|
|
||||||
|
|
||||||
scripts:
|
|
||||||
cd $(SRC_SCRIPTS) && $(MAKE)
|
|
||||||
|
|
||||||
share:
|
|
||||||
cd $(SRC_SHARE) && $(MAKE)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
cd $(SRC_CGIBIN) && $(MAKE) $@
|
|
||||||
cd $(SRC_BIN) && $(MAKE) $@
|
|
||||||
cd $(SRC_CONFIG) && $(MAKE) $@
|
|
||||||
cd $(SRC_CONFIG)/apache-conf.d && $(MAKE) $@
|
|
||||||
cd $(SRC_CONFIG)/cron.d && $(MAKE) $@
|
|
||||||
cd $(SRC_LANG) && $(MAKE) $@
|
|
||||||
cd $(SRC_LIBEXEC) && $(MAKE) $@
|
|
||||||
cd $(SRC_LIBS) && $(MAKE) $@
|
|
||||||
cd $(SRC_SHARE) && $(MAKE) $@
|
|
||||||
cd $(SRC_SHARE)/stylesheets && $(MAKE) $@
|
|
||||||
cd $(SRC_VAR)/nagios_bp.sessions && $(MAKE) $@
|
|
||||||
cd $(SRC_VAR)/cache && $(MAKE) $@
|
|
||||||
-rm -f *.cfg core
|
|
||||||
-rm -f *~ *.*~ */*~ */*.*~
|
|
||||||
-rm -f config.log config.status config.cache
|
|
||||||
|
|
||||||
distclean:
|
|
||||||
cd $(SRC_CGIBIN) && $(MAKE) $@
|
|
||||||
cd $(SRC_BIN) && $(MAKE) $@
|
|
||||||
cd $(SRC_CONFIG) && $(MAKE) $@
|
|
||||||
cd $(SRC_CONFIG)/apache-conf.d && $(MAKE) $@
|
|
||||||
cd $(SRC_CONFIG)/cron.d && $(MAKE) $@
|
|
||||||
cd $(SRC_LANG) && $(MAKE) $@
|
|
||||||
cd $(SRC_LIBEXEC) && $(MAKE) $@
|
|
||||||
cd $(SRC_LIBS) && $(MAKE) $@
|
|
||||||
cd $(SRC_SHARE) && $(MAKE) $@
|
|
||||||
cd $(SRC_SHARE)/stylesheets && $(MAKE) $@
|
|
||||||
cd $(SRC_VAR)/nagios_bp.sessions && $(MAKE) $@
|
|
||||||
cd $(SRC_VAR)/cache && $(MAKE) $@
|
|
||||||
rm -f Makefile config.status config.log subst
|
|
||||||
|
|
||||||
devclean: distclean
|
|
||||||
|
|
||||||
install-html:
|
|
||||||
cd $(SRC_SHARE) && $(MAKE) install
|
|
||||||
|
|
||||||
install-base:
|
|
||||||
cd $(SRC_BASE) && $(MAKE) install
|
|
||||||
|
|
||||||
install-processperfdata:
|
|
||||||
cd $(SRC_SCRIPTS) && $(MAKE) install
|
|
||||||
|
|
||||||
install-man:
|
|
||||||
cd $(SRC_MAN) && $(MAKE) install
|
|
||||||
|
|
||||||
install-init:
|
|
||||||
cd $(SRC_SCRIPTS) && $(MAKE) install-init
|
|
||||||
|
|
||||||
install-config:
|
|
||||||
cd $(SRC_CONFIG) && $(MAKE) install-config
|
|
||||||
|
|
||||||
install:
|
|
||||||
cd $(SRC_CGIBIN) && $(MAKE) $@
|
|
||||||
cd $(SRC_CONFIG) && $(MAKE) $@
|
|
||||||
cd $(SRC_CONFIG)/apache-conf.d && $(MAKE) $@
|
|
||||||
cd $(SRC_CONFIG)/cron.d && $(MAKE) $@
|
|
||||||
cd $(SRC_LANG) && $(MAKE) $@
|
|
||||||
cd $(SRC_LIBEXEC) && $(MAKE) $@
|
|
||||||
cd $(SRC_LIBS) && $(MAKE) $@
|
|
||||||
cd $(SRC_SHARE) && $(MAKE) $@
|
|
||||||
cd $(SRC_SHARE)/stylesheets && $(MAKE) $@
|
|
||||||
cd $(SRC_VAR)/nagios_bp.sessions && $(MAKE) $@
|
|
||||||
cd $(SRC_VAR)/cache && $(MAKE) $@
|
|
||||||
cd $(SRC_BIN) && $(MAKE) $@
|
|
||||||
$(INSTALL) -m 644 $(INSTALL_OPTS) README $(DESTDIR)$(exec_prefix)
|
|
||||||
$(INSTALL) -m 644 $(INSTALL_OPTS) AUTHORS $(DESTDIR)$(exec_prefix)
|
|
||||||
$(INSTALL) -m 644 $(INSTALL_OPTS) CHANGES $(DESTDIR)$(exec_prefix)
|
|
||||||
$(INSTALL) -m 644 $(INSTALL_OPTS) INSTALL $(DESTDIR)$(exec_prefix)
|
|
||||||
$(INSTALL) -m 644 $(INSTALL_OPTS) LICENSE $(DESTDIR)$(exec_prefix)
|
|
||||||
$(INSTALL) -m 644 $(INSTALL_OPTS) UPDATE $(DESTDIR)$(exec_prefix)
|
|
||||||
$(MAKE) install-basic
|
|
||||||
|
|
||||||
install-unstripped:
|
|
||||||
cd $(SRC_BASE) && $(MAKE) $@
|
|
||||||
cd $(SRC_SHARE) && $(MAKE) $@
|
|
||||||
cd $(SRC_SCRIPTS) && $(MAKE) $@
|
|
||||||
$(MAKE) install-basic
|
|
||||||
|
|
||||||
install-basic:
|
|
||||||
# $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(LOGDIR)
|
|
||||||
# $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(LOGDIR)/archives
|
|
||||||
|
|
||||||
@echo ""
|
|
||||||
@echo "*** Main program, Scripts, HTML files and sample configuration files installed ***"
|
|
||||||
@echo "*** There are some more things to do for You, see INSTALL ***"
|
|
||||||
@echo ""
|
|
||||||
# @echo "Please run 'make install-config' to install sample"
|
|
||||||
# @echo "configuration files"
|
|
||||||
# @echo ""
|
|
||||||
|
|
||||||
#fullinstall: install install-init install-config
|
|
||||||
fullinstall: install
|
|
||||||
|
|
719
README
719
README
@ -1,719 +0,0 @@
|
|||||||
Nagios Business Process View and Nagios Business Impact Analysis
|
|
||||||
----------------------------------------------------------------
|
|
||||||
|
|
||||||
The software and documents in this package have been produced by
|
|
||||||
Sparda-Datenverarbeitung eG, Nuernberg, Germany, Bernd Stroessenreuther
|
|
||||||
<berny1@users.sourceforge.net> and are available to the community under the
|
|
||||||
conditions of GNU General Public License Version 2, see LICENSE.
|
|
||||||
|
|
||||||
|
|
||||||
Short overview
|
|
||||||
--------------
|
|
||||||
|
|
||||||
The AddOn "Business Process View" takes results of the single nagios checks out
|
|
||||||
of NDO or IDO backend (NDO database, IDO database, ndo2fs, Merlin, mk_livestatus,
|
|
||||||
Icinga-API) and builds up aggregated states.
|
|
||||||
How they are associated is described in one or more config files.
|
|
||||||
There is the possibility to make "and" conjuctions, "or" conjunction and other...
|
|
||||||
A business process (as defined by such a formula) can be used as a part of
|
|
||||||
another business process. So You can build up a hirachical structure to describe
|
|
||||||
the state of Your Application.
|
|
||||||
|
|
||||||
The AddOn "Business Impact Analysis" allows You to simulate Outages. You can set
|
|
||||||
manually the state of each single component to each state You like and look, how
|
|
||||||
this would impact Your applications.
|
|
||||||
|
|
||||||
|
|
||||||
Help
|
|
||||||
----
|
|
||||||
|
|
||||||
If You have problems installing or using this AddOns, please visit the
|
|
||||||
Support page on our homepage:
|
|
||||||
http://nagiosbp.projects.nagiosforge.org/support.shtml
|
|
||||||
Here You find a FAQ and some helpful mailinglists.
|
|
||||||
|
|
||||||
Also a very active community of users You find at
|
|
||||||
http://www.nagios-portal.org/
|
|
||||||
(this one is in german only)
|
|
||||||
|
|
||||||
|
|
||||||
What is it?
|
|
||||||
-----------
|
|
||||||
(a little bit more in detail)
|
|
||||||
|
|
||||||
You are running a lot of applications for Your customers. (I use the word
|
|
||||||
customers because as a system administrator You allways have customers,
|
|
||||||
no matter if they are employees or customers of the company You are working
|
|
||||||
for.)
|
|
||||||
Each application needs a few or a lot of components (like webservers,
|
|
||||||
application servers, DNS- or mail servers, LAN- or WAN-connections ...)
|
|
||||||
to work properly.
|
|
||||||
There are components You need for only one application, and of course there
|
|
||||||
are components which are important for more applications (e. g. DNS-servers)
|
|
||||||
You already are running Nagios or Icinga to monitor all of these components
|
|
||||||
I guess. (Otherwise You would not think about this AddOn.)
|
|
||||||
|
|
||||||
If You are the only system administrator of Your company, You will probably
|
|
||||||
know all Your applications very well, You know which application needs
|
|
||||||
which components - then You will not need this AddOn.
|
|
||||||
If there are more admins, You probably will share work. This means each admin
|
|
||||||
knows view applications very well and the other applications only a little
|
|
||||||
bit.
|
|
||||||
So maybe You would find it great to visualize, how all these components work
|
|
||||||
together. If one ore more components fail, You want to see on one single
|
|
||||||
page, which applications are unavailable for Your customers - in this case:
|
|
||||||
Install this addon.
|
|
||||||
|
|
||||||
It has two modes:
|
|
||||||
1. Nagios Business Process View
|
|
||||||
it shows the actual state of Your applications
|
|
||||||
2. Nagios Business Impact Analysis
|
|
||||||
this is a simulation mode.
|
|
||||||
You can set each of Your components to every stat You like.
|
|
||||||
So if You want to know: What would be if my web server would fail now?
|
|
||||||
Just klick the state of Your web server an set it to CRITICAL
|
|
||||||
Return to the overview page and look, which applications are now in
|
|
||||||
state CRITICAL.
|
|
||||||
|
|
||||||
The states of the single services and hosts defined in Nagios or Icinga are
|
|
||||||
taken from the NDO or IDO backend (NDO database, IDO database, ndo2fs, Merlin,
|
|
||||||
mk_livestatus or Icinga-API).
|
|
||||||
|
|
||||||
|
|
||||||
How it works
|
|
||||||
------------
|
|
||||||
|
|
||||||
You have one or more config files in which You define Your applications.
|
|
||||||
You define which components are needed and how they are related.
|
|
||||||
So go and set up a config file called etc/nagios-bp.conf
|
|
||||||
There You have to type some simple formulas for defining business processes.
|
|
||||||
e. g.
|
|
||||||
loadbalancers = loadbalancer1;System Health | loadbalancer2;System Health
|
|
||||||
website_webserver1 = webserver1;HTTP & webserver1;HTTPD Slots
|
|
||||||
|
|
||||||
The first string is the name You want to give to the business process.
|
|
||||||
On the right side You have strings in the form
|
|
||||||
<hostname>;<servicename>
|
|
||||||
|
|
||||||
The example above means:
|
|
||||||
You have a loadbalancer cluster. If one of them is in ok state, the
|
|
||||||
application is available for the customer. So You define a "or" conjuction
|
|
||||||
for Your business process.
|
|
||||||
|
|
||||||
If You are looking if Your webserver1 works well, You normaly look for the
|
|
||||||
Check HTTP and also for the check "HTTPD Slots". If both are in OK state, You
|
|
||||||
know, the webserver1 is working well.
|
|
||||||
So we put these two together by making a "and" conjuction.
|
|
||||||
|
|
||||||
Next step is, to give a name to each business process You defined, so type
|
|
||||||
display 0;loadbalancers;Loadbalancer Cluster
|
|
||||||
display 0;website_webserver1;WebServer 1
|
|
||||||
|
|
||||||
The digit after the keyword display is the priority class, in which these
|
|
||||||
business process ist displayed in the top level view.
|
|
||||||
0 means: No display
|
|
||||||
1, 2,...: Display in the given priority.
|
|
||||||
|
|
||||||
As You can use single business processes again in other processes, display 0
|
|
||||||
is very useful, if You do not want to display each sub-process in the top
|
|
||||||
level view.
|
|
||||||
|
|
||||||
Let's have a complete example:
|
|
||||||
|
|
||||||
internetconnection = internetconnection;Provider 1 | internetconnection;Provider 2
|
|
||||||
display 0;internetconnection;Internet Connection
|
|
||||||
|
|
||||||
loadbalancers = loadbalancer1;System Health | loadbalancer2;System Health
|
|
||||||
display 0;loadbalancers;Loadbalancer Cluster
|
|
||||||
|
|
||||||
dns = dns1;DNS | dns2;DNS | dns3;DNS
|
|
||||||
display 0;dns;DNS Cluster
|
|
||||||
|
|
||||||
website_webserver1 = webserver1;HTTP & webserver1;HTTPD Slots
|
|
||||||
website_webserver2 = webserver2;HTTP & webserver2;HTTPD Slots
|
|
||||||
website_webservers = website_webserver1 | website_webserver2
|
|
||||||
website = internetconnection & loadbalancers & dns & website_webservers
|
|
||||||
|
|
||||||
display 0;website_webserver1;WebServer 1
|
|
||||||
display 0;website_webserver2;WebServer 2
|
|
||||||
display 0;website_webservers;WebServer Cluster
|
|
||||||
display 1;website;WebSite
|
|
||||||
|
|
||||||
If these line are the only ones in Your nagios-bp.conf file, this should work.
|
|
||||||
You have defined Your first business process! Congratulations!
|
|
||||||
Go and view http://your-host/nagiosbp/cgi-bin/nagios-bp.cgi
|
|
||||||
(I just assume, You have all these services and hosts defined in your Nagios
|
|
||||||
or Icinga configuration or adapted the example.)
|
|
||||||
|
|
||||||
Care for the correct spelling! The <hostname> and the <servicename> must exactly
|
|
||||||
match the spelling, how You defined them in Nagios/Icinga. Watch for correct upper
|
|
||||||
case and lower case.
|
|
||||||
|
|
||||||
More examples can be found in etc/nagios-bp.conf
|
|
||||||
|
|
||||||
|
|
||||||
Syntax check
|
|
||||||
------------
|
|
||||||
|
|
||||||
To make sure the syntax of Your nagios-bp.conf is correct, run
|
|
||||||
bin/nagios-bp-consistency-check.pl
|
|
||||||
In this syntax it checks Your default nagios-bp.conf. If You want to check
|
|
||||||
some other file call
|
|
||||||
bin/nagios-bp-consistency-check.pl <file>
|
|
||||||
|
|
||||||
|
|
||||||
Some more keywords
|
|
||||||
------------------
|
|
||||||
|
|
||||||
In the top level view (http://your-host/nagiosbp/cgi-bin/nagios-bp.cgi)
|
|
||||||
the right column is empty at the moment. It can be used to display some short
|
|
||||||
information according the business process. This can be a static or dynamic
|
|
||||||
string. e. g. You want to display, how many users are currently logged into
|
|
||||||
Your webshop if You defined a business process WebShop.
|
|
||||||
Or You want to display a short announcement, ...
|
|
||||||
|
|
||||||
Just write a little script that displays the information You like (just one
|
|
||||||
line to stdout) and the You configure:
|
|
||||||
|
|
||||||
external_info website;echo '<b>Please note:</b> Today maintainance on WebServer1,<br>Production only on WebServer2'
|
|
||||||
or
|
|
||||||
external_info website;/path/to/your/script.sh
|
|
||||||
|
|
||||||
Maybe one little string is not enough for all the information You have.
|
|
||||||
Then
|
|
||||||
info_url website;/more_info/website.html
|
|
||||||
or
|
|
||||||
info_url website;http://some.other.site.com/more_info/website.html
|
|
||||||
would be of value for You. Just linking to a WebSite with all the information.
|
|
||||||
In the first syntax, the page is located on the Nagios/Icinga machine.
|
|
||||||
In the second syntax, it is somewhere in the world.
|
|
||||||
If You defined some info_url, a little info icon appears, which can be clicked
|
|
||||||
by Your users.
|
|
||||||
Maybe You want to use it for some emergency documentation or so.
|
|
||||||
|
|
||||||
|
|
||||||
complete syntax description
|
|
||||||
---------------------------
|
|
||||||
|
|
||||||
PLEASE NOTE: The order of Your definitions is important!!
|
|
||||||
If You use a (sub level) business process in the definition of another business
|
|
||||||
process, make sure You define the subl level process BEFORE You use it.
|
|
||||||
|
|
||||||
|
|
||||||
<bp_name> = <host>;<service> [& <host>;<service>]+
|
|
||||||
|
|
||||||
Services have a "and" conjuction. All of them are needed for the application to
|
|
||||||
be available to the customer.
|
|
||||||
Or in other words: If all of the given services are OK, the defined business
|
|
||||||
process has state OK. If at least one is WARNING, the process has state
|
|
||||||
WARNING. If at least one is CRITICAL, the process gets CRITICAL.
|
|
||||||
|
|
||||||
|
|
||||||
<bp_name> = <host>;<service> [| <host>;<service>]+
|
|
||||||
|
|
||||||
Services have a "or" conjunction. This is often used if You have redundant
|
|
||||||
systems. If one of them is working, the application is available to the
|
|
||||||
customer.
|
|
||||||
If at least one service is OK, the process gets state OK.
|
|
||||||
If all services are CRITIAL and at least one is WARNING, the process gets
|
|
||||||
state WARNING.
|
|
||||||
Only if all of the services are CRITIAL, the process gets CRITICAL.
|
|
||||||
|
|
||||||
|
|
||||||
<bp_name> = <min_num> of: <host>;<service> + <host>;<service> [+ <host>;<service>]+
|
|
||||||
|
|
||||||
Use this one, if You have a number of application servers running the same
|
|
||||||
application and You know You need at least <min_num> of servers active for
|
|
||||||
load reasons.
|
|
||||||
e. g.
|
|
||||||
appserver_cluster = 2 of: appserver1;WebShop + appserver2;WebShop + appserver3;WebShop + appserver4;WebShop
|
|
||||||
So if at least 2 of the given services are in state OK, the process is OK.
|
|
||||||
|
|
||||||
|
|
||||||
<host>;Hoststatus
|
|
||||||
|
|
||||||
You also can use the results of Nagios/Icinga host checks in Your business
|
|
||||||
processes. In this case You use this syntax.
|
|
||||||
|
|
||||||
|
|
||||||
Instead of <host>;<service> You always can use <bp_name> too, where <bp_name>
|
|
||||||
is the name of a business process You defined BEFORE.
|
|
||||||
|
|
||||||
|
|
||||||
display <x>;<bp_name>;<long_name>
|
|
||||||
|
|
||||||
The digit x is the priority of the process. The process is displayed in this
|
|
||||||
priority class in the top level view.
|
|
||||||
0 means: This process is not displayed in the top level view.
|
|
||||||
<long_name> is the name or description used when displaying the process.
|
|
||||||
(The user never sees <bp_name> in the GUI, always <long_name>)
|
|
||||||
|
|
||||||
|
|
||||||
external_info <bp_name>;<script>
|
|
||||||
|
|
||||||
For each business process which is not defined with display 0 you can add a
|
|
||||||
script. The script must print one line to stdout. This line is displayed
|
|
||||||
in the right column of the top level view near the business process.
|
|
||||||
|
|
||||||
|
|
||||||
info_url <bp_name>;<url>
|
|
||||||
|
|
||||||
For each business process which is not defined with display 0 you can add a
|
|
||||||
URL. If You define one, a little info icon (white letter i on blue ground)
|
|
||||||
is displayed near the business process. Clicking this icon brings You to the
|
|
||||||
given URL.
|
|
||||||
|
|
||||||
|
|
||||||
template <bp_name>;<service_template>
|
|
||||||
|
|
||||||
This is only used, if You map Business Processes as services in Nagios or
|
|
||||||
Icinga. (see below "Business Process representation as Nagios/Icinga services")
|
|
||||||
Normaly all Business Processes with display greater than 0 get the same
|
|
||||||
service template and all Business Processes with display 0 get another one.
|
|
||||||
If You want to have one Business Process e. g. with a different
|
|
||||||
notification_period, You just define one more template and give it's name
|
|
||||||
here.
|
|
||||||
|
|
||||||
|
|
||||||
Check if everything works
|
|
||||||
-------------------------
|
|
||||||
|
|
||||||
If You did everything described until this point and set up as described in
|
|
||||||
INSTALL, You probably have got a nice new view in Your Nagios/Icinga installation.
|
|
||||||
If not, DO NOT STEP BEYOND THIS POINT.
|
|
||||||
I recommend, You go and solve Your problems first, get Your installation running
|
|
||||||
and then continue with the next (advanced) part.
|
|
||||||
|
|
||||||
If the page "Business Process View" is not displayed, check the error log
|
|
||||||
of Your webserver for the problem. Maybe a required perl module is not found
|
|
||||||
or You have a problem with file permissions.
|
|
||||||
If You have SELinux or AppArmor, maybe they do not allow access to some
|
|
||||||
files.
|
|
||||||
Maybe You just forgot to restart Your webserver after making the config changes.
|
|
||||||
|
|
||||||
Next thing to do to locate the problem is to run a script especially built
|
|
||||||
for this:
|
|
||||||
bin/nagios-bp-check-ndo-connection.pl
|
|
||||||
Run it under the user Your Apache runs with. On success it prints out a
|
|
||||||
list of all the services Your NDO or IDO backend knows together with status
|
|
||||||
information and the last plugin output.
|
|
||||||
On error You should get an error message that probably will be very helpful
|
|
||||||
for locating the problem.
|
|
||||||
|
|
||||||
To see if the problem is in the webserver or in Nagios Business Process AddOn
|
|
||||||
You can call
|
|
||||||
sbin/nagios-bp.cgi
|
|
||||||
form the commandline. Do this as a normal user, not as root.
|
|
||||||
It should print out some HTML code on STDOUT, if everything works and
|
|
||||||
error or warning messages otherwise.
|
|
||||||
|
|
||||||
|
|
||||||
Business Process representation as Nagios/Icinga services
|
|
||||||
---------------------------------------------------------
|
|
||||||
|
|
||||||
You now have a beautiful page that displays the health of all or some of Your
|
|
||||||
applications at any time.
|
|
||||||
But You always get this information for NOW. You do not see, how it was an
|
|
||||||
hour ago or one day ago. You have no history.
|
|
||||||
And: You do not get notifications for whole business processes, only for single
|
|
||||||
components.
|
|
||||||
|
|
||||||
Solution is simple. Just make any business process itself to be a normal Nagios
|
|
||||||
or Icinga service. Nagios checks the state of these services regularly, e. g. each
|
|
||||||
minute. On these service You can use all of Nagios' or Icingas features:
|
|
||||||
notifications, statistics, history, ...
|
|
||||||
|
|
||||||
A simple script is integrated, that generates an additional Nagios/Icinga
|
|
||||||
configuration file with all the business processes as service.
|
|
||||||
The script can be found under
|
|
||||||
bin/bp_cfg2service_cfg.pl
|
|
||||||
Running this script should produce a new file
|
|
||||||
services-bp.cfg
|
|
||||||
in the etc directory of NAGIOS/ICINGA (not etc of Nagios Business Process AddOns)
|
|
||||||
Do not make any manual changes to this file! If You change Your business
|
|
||||||
processes later You just run this script again. This produces an actual
|
|
||||||
services-bp.cfg but would overwrite any changes You made there.
|
|
||||||
|
|
||||||
Next step is to edit the nagios.cfg or icinga.cfg file (normally
|
|
||||||
/usr/local/nagios/etc/nagios.cfg or /usr/local/icinga/etc/icinga.cfg)
|
|
||||||
and add the new config file by adding a line like:
|
|
||||||
cfg_file=/usr/local/nagios/etc/services-bp.cfg
|
|
||||||
or
|
|
||||||
cfg_file=/usr/local/icinga/etc/services-bp.cfg
|
|
||||||
|
|
||||||
Additionaly You need two new service templates, two new dummy hosts, and two
|
|
||||||
new commands looking like the following.
|
|
||||||
Please define them in another Nagios/Icinga configfile, e. g. the service in
|
|
||||||
services.cfg, the hosts in host.cfg and the commands in commands.cfg
|
|
||||||
(Do not define them in services-bp.cfg!!)
|
|
||||||
|
|
||||||
define service{
|
|
||||||
name generic-bp-service
|
|
||||||
use generic-service
|
|
||||||
contact_groups nagios-admins
|
|
||||||
host_name business_processes
|
|
||||||
notification_period none
|
|
||||||
max_check_attempts 1
|
|
||||||
register 0
|
|
||||||
}
|
|
||||||
|
|
||||||
define service{
|
|
||||||
name generic-bp-detail-service
|
|
||||||
use generic-service
|
|
||||||
contact_groups nagios-admins
|
|
||||||
host_name business_processes_detail
|
|
||||||
notification_period none
|
|
||||||
max_check_attempts 1
|
|
||||||
normal_check_interval 5
|
|
||||||
retry_check_interval 1
|
|
||||||
register 0
|
|
||||||
}
|
|
||||||
|
|
||||||
define host{
|
|
||||||
use generic-host
|
|
||||||
host_name business_processes
|
|
||||||
alias Business Processe
|
|
||||||
address 10.6.255.99 # dummy IP
|
|
||||||
contact_groups nogroup
|
|
||||||
check_command return_true
|
|
||||||
}
|
|
||||||
|
|
||||||
define host{
|
|
||||||
use generic-host
|
|
||||||
host_name business_processes_detail
|
|
||||||
alias untergeordnete Business Processe
|
|
||||||
address 10.6.255.99 # dummy IP
|
|
||||||
contact_groups nogroup
|
|
||||||
check_command return_true
|
|
||||||
}
|
|
||||||
|
|
||||||
define command{
|
|
||||||
command_name check_bp_status
|
|
||||||
command_line /usr/local/nagiosbp/libexec/check_bp_status.pl -b $ARG1$ -f $ARG2$
|
|
||||||
}
|
|
||||||
|
|
||||||
define command{
|
|
||||||
command_name return_true
|
|
||||||
command_line $USER1$/check_dummy 0
|
|
||||||
}
|
|
||||||
|
|
||||||
Now reload Your Nagios/Icinga configuration. That's it.
|
|
||||||
Nagios/Icinga now checks the states of all business processes regulary.
|
|
||||||
|
|
||||||
If only states of business processes in the top level view are of interest to You,
|
|
||||||
but not the states of the sub-processes, use
|
|
||||||
bin/bp_cfg2service_cfg.pl -s 0
|
|
||||||
In this case You do not need the service template generic-bp-detail-service and
|
|
||||||
the host template business_processes_detail
|
|
||||||
|
|
||||||
Parameters for this script are displayed, if You type
|
|
||||||
bin/bp_cfg2service_cfg.pl --help
|
|
||||||
|
|
||||||
If You are using these new services to generate alerts for problems of whole
|
|
||||||
business processes, You might not want to inform the same users or groups for
|
|
||||||
all business processes. Of course this would be the case, if You have only one
|
|
||||||
template for all of them (as described above).
|
|
||||||
|
|
||||||
So for all business processes that should use some other template than the
|
|
||||||
default, You just enter a line in the form
|
|
||||||
template <bp_name>;<service_template>
|
|
||||||
e. g. for our example
|
|
||||||
template website;website-bp-service
|
|
||||||
to Your etc/nagios-bp.conf.
|
|
||||||
|
|
||||||
This means, the service representing the business process website should be
|
|
||||||
generated with the template website-bp-service.
|
|
||||||
|
|
||||||
Of course, in this case You need to define an other template:
|
|
||||||
|
|
||||||
define service{
|
|
||||||
name website-bp-service
|
|
||||||
use generic-bp-service
|
|
||||||
contact_groups website-admins
|
|
||||||
notification_period 24x7
|
|
||||||
register 0
|
|
||||||
}
|
|
||||||
|
|
||||||
Run bin/bp_cfg2service_cfg.pl again. It will produce a services-bp.cfg where
|
|
||||||
the according service is now defined referring to this new template.
|
|
||||||
Reload Nagios/Icinga and You are done.
|
|
||||||
|
|
||||||
|
|
||||||
More than one Top Level View
|
|
||||||
----------------------------
|
|
||||||
|
|
||||||
Until now, all the business processes You defined show up in the one and only
|
|
||||||
top level view. Maybe You want to have more than one top level view, e. g.
|
|
||||||
because You have different customers and each of them should only see his
|
|
||||||
business processes.
|
|
||||||
|
|
||||||
So You just go to etc directory and build additional configuration
|
|
||||||
files, each of them defining business processes as described above.
|
|
||||||
Let's assume You called them
|
|
||||||
nagios-bp-customer1.conf
|
|
||||||
nagios-bp-customer2.conf
|
|
||||||
nagios-bp-customer3.conf
|
|
||||||
...
|
|
||||||
they all must be located in the same directory as nagios-bp.conf
|
|
||||||
|
|
||||||
Now use the following URLs to view them:
|
|
||||||
For the business process view:
|
|
||||||
http://<servername>/nagiosbp/cgi-bin/nagios-bp.cgi?conf=nagios-bp-customer1
|
|
||||||
http://<servername>/nagiosbp/cgi-bin/nagios-bp.cgi?conf=nagios-bp-customer2
|
|
||||||
http://<servername>/nagiosbp/cgi-bin/nagios-bp.cgi?conf=nagios-bp-customer3
|
|
||||||
...
|
|
||||||
|
|
||||||
And for the business impact analysis:
|
|
||||||
http://<servername>/nagiosbp/cgi-bin/nagios-bp.cgi?conf=nagios-bp-customer1&mode=bi
|
|
||||||
http://<servername>/nagiosbp/cgi-bin/nagios-bp.cgi?conf=nagios-bp-customer2&mode=bi
|
|
||||||
http://<servername>/nagiosbp/cgi-bin/nagios-bp.cgi?conf=nagios-bp-customer3&mode=bi
|
|
||||||
...
|
|
||||||
|
|
||||||
Please note: The different configurations do not know each other. So it is not
|
|
||||||
possible to use a business process defined in one of them in another configuration.
|
|
||||||
|
|
||||||
If You want to map the Business Processes of all of these files to Nagios
|
|
||||||
services, use
|
|
||||||
/usr/local/nagiosbp/bin/bp_cfg2service_cfg.pl -f /usr/local/nagiosbp/etc/nagios-bp-customer1.conf
|
|
||||||
/usr/local/nagiosbp/bin/bp_cfg2service_cfg.pl -f /usr/local/nagiosbp/etc/nagios-bp-customer2.conf
|
|
||||||
/usr/local/nagiosbp/bin/bp_cfg2service_cfg.pl -f /usr/local/nagiosbp/etc/nagios-bp-customer3.conf
|
|
||||||
|
|
||||||
Maybe You want different default templates for each of these config files,
|
|
||||||
because in the one case contacts of customer1 should be notified, in the
|
|
||||||
other case contacts of customer2, ...
|
|
||||||
For this You do not need to include template directives for every single
|
|
||||||
Business Process in every single config file. Just call bp_cfg2service_cfg.pl
|
|
||||||
with -tt or -tm parameters.
|
|
||||||
Complete description see
|
|
||||||
bin/bp_cfg2service_cfg.pl --help
|
|
||||||
|
|
||||||
|
|
||||||
Where used?
|
|
||||||
-----------
|
|
||||||
|
|
||||||
(new feature since version 0.9.4)
|
|
||||||
|
|
||||||
Imagine You want to stop one service or one host in Your network for maintainance.
|
|
||||||
But You are not the one who did the setup of this host or service and You are
|
|
||||||
not sure in which of Your business processes it is used.
|
|
||||||
Ok, You could use the webinterface and click on every business process and
|
|
||||||
look if it is listed there. Quite a lot of time if You have lots of business
|
|
||||||
processes. So You might want to use this feature:
|
|
||||||
|
|
||||||
You can use Nagios' or Icingas notes_url or the action_url to put the whereUsed-URL
|
|
||||||
into:
|
|
||||||
|
|
||||||
define host {
|
|
||||||
# ...
|
|
||||||
notes_url /nagiosbp/cgi-bin/whereUsed.cgi?host=$HOSTNAME$
|
|
||||||
}
|
|
||||||
|
|
||||||
or
|
|
||||||
|
|
||||||
define host {
|
|
||||||
# ...
|
|
||||||
action_url /nagiosbp/cgi-bin/whereUsed.cgi?host=$HOSTNAME$
|
|
||||||
}
|
|
||||||
|
|
||||||
at services:
|
|
||||||
|
|
||||||
define service {
|
|
||||||
# ...
|
|
||||||
notes_url /nagiosbp/cgi-bin/whereUsed.cgi?host=$HOSTNAME$&service=$SERVICEDESC$
|
|
||||||
}
|
|
||||||
|
|
||||||
or
|
|
||||||
|
|
||||||
define service {
|
|
||||||
# ...
|
|
||||||
action_url /nagiosbp/cgi-bin/whereUsed.cgi?host=$HOSTNAME$&service=$SERVICEDESC$
|
|
||||||
}
|
|
||||||
|
|
||||||
These definitions work for Nagios 3.x and Icinga. When still using Nagios 2.x,
|
|
||||||
please note, that You have to define notes_url or action_url directives in
|
|
||||||
hostextinfo or serviceextinfo sections, not directly in the host or service
|
|
||||||
section.
|
|
||||||
|
|
||||||
Probably it will be the best choice to define these notes_url or action_url
|
|
||||||
in a template, e. g. in generic-host or generic-service to have them available
|
|
||||||
for all Your services and hosts.
|
|
||||||
|
|
||||||
With these definitions You get new icons in Your Nagios' or Icingas
|
|
||||||
webinterface for every host and service. When clicking it You are presented a
|
|
||||||
new view showing in which of Your business processes the according host or
|
|
||||||
service is used. Here You are!
|
|
||||||
|
|
||||||
If Your notes_url and action_url both are already used for other important
|
|
||||||
things like PnP and other AddOns, You still have another (second best)
|
|
||||||
chance. You can define a link in the text You are giving as "notes".
|
|
||||||
(again please note, this directive has to be defined in hostextinfo or
|
|
||||||
serviceextinfo section in Nagios 2.x)
|
|
||||||
|
|
||||||
define host {
|
|
||||||
# ...
|
|
||||||
notes On problems with this host, see documentation chapter 16.<br><a href="/nagiosbp/cgi-bin/whereUsed.cgi">Where is this host used?</a>
|
|
||||||
}
|
|
||||||
|
|
||||||
define service {
|
|
||||||
# ...
|
|
||||||
notes On problems with this service, see documentation chapter 16.<br><a href="/nagiosbp/cgi-bin/whereUsed.cgi">Where is this service used?</a>
|
|
||||||
}
|
|
||||||
|
|
||||||
The first part is the normal information for the host or service. You maybe
|
|
||||||
did define this part already to give the users some helpful information in
|
|
||||||
the webinterface.
|
|
||||||
|
|
||||||
Next You see a <br> for a new line and then a link in normal HTML syntax.
|
|
||||||
You may have noticed, we do not add the parameters host=$HOSTNAME$ and
|
|
||||||
service=$SERVICEDESC$ as we did above. This is because Nagios/Icinga does
|
|
||||||
not expand macros here. So we do not have this chance.
|
|
||||||
Instead the whereUsed.cgi looks for the HTTP referer (a HTTP request
|
|
||||||
header telling which URL the click did come from) and tries to expand
|
|
||||||
the information about host and/or service from this.
|
|
||||||
|
|
||||||
This only works, when using the official Nagios/Icinga webinterface. When
|
|
||||||
using some other GUI, it will probably not work.
|
|
||||||
|
|
||||||
Some users also configure their browsers to suppress HTTP referers (to
|
|
||||||
increase privacy) e. g. by using a special Firefox Plugin. In this case
|
|
||||||
it also will not work.
|
|
||||||
|
|
||||||
In both cases it will be the better solution to use action_url or
|
|
||||||
notes_url.
|
|
||||||
|
|
||||||
Additional hint: If 3 links (one in action_url, one in notes_url and one
|
|
||||||
in notes) are not enough for everything You want to link from one single
|
|
||||||
host or service, e. g. different AddOns, a link to Your server documentation
|
|
||||||
and so on, You can add more than one link in the text given in the notes
|
|
||||||
directive.
|
|
||||||
|
|
||||||
|
|
||||||
Where used with more than one Top Level View
|
|
||||||
--------------------------------------------
|
|
||||||
|
|
||||||
If You have more than one Top Level View (see according section above) and
|
|
||||||
want to use the "Where used?" feature, by default the whereUsed.cgi looks for
|
|
||||||
processes in the default config file nagios-bp.conf. If You want it to look
|
|
||||||
in an alternate config file, call it with the additional parameter "conf"
|
|
||||||
in the same way as described in section "More than one Top Level View".
|
|
||||||
e. g.
|
|
||||||
action_url /nagiosbp/cgi-bin/whereUsed.cgi?conf=nagios-bp-customer1&host=$HOSTNAME$&service=$SERVICEDESC$
|
|
||||||
or
|
|
||||||
notes <a href="/nagiosbp/cgi-bin/whereUsed.cgi?conf=nagios-bp-customer1">Where is this service used?</a>
|
|
||||||
|
|
||||||
|
|
||||||
Preview Changes
|
|
||||||
---------------
|
|
||||||
|
|
||||||
If You make changes to Your nagios-bp.conf file, the new configuration is used
|
|
||||||
as soon as You save the file. All Your customers see Your changes immediatelly.
|
|
||||||
|
|
||||||
Maybe this is not what You want. Maybe You want to check if everything is how
|
|
||||||
You desinged it and there are no errors in the file.
|
|
||||||
|
|
||||||
So copy nagios-bp.conf to e. g. nagios-bp-new.conf and make Your changes to
|
|
||||||
this copy. Now it's a good idea to make a syntax check of nagios-bp-new.conf
|
|
||||||
as described in section Syntax check.
|
|
||||||
Now You can preview as described in section More than one Top Level View
|
|
||||||
If everything is ok, You copy it over to nagios-bp.conf to bring Your changes
|
|
||||||
online.
|
|
||||||
|
|
||||||
|
|
||||||
Using new hosts or service in a Business Process
|
|
||||||
------------------------------------------------
|
|
||||||
|
|
||||||
If You just did define new hosts or services in Nagios/Icinga and You want to
|
|
||||||
use them in a Business Process, make sure You did reload Your Nagios/Icinga
|
|
||||||
first and then You wait a minute. This gives Nagios/Icinga the chance to write
|
|
||||||
the first status information to the NDO or IDO backend (NDO database, IDO
|
|
||||||
database, ndo2fs, Merlin, mk_livestatus, ...). Now You can use them.
|
|
||||||
Also the syntax check (see above, section Syntax Check) can only work if
|
|
||||||
the first status information is available in the NDO or IDO backend.
|
|
||||||
|
|
||||||
|
|
||||||
Caching results from NDO or IDO backend
|
|
||||||
---------------------------------------
|
|
||||||
|
|
||||||
(new feature since version 0.9.4)
|
|
||||||
|
|
||||||
If You have performance problems with the NDO or IDO backend You are using,
|
|
||||||
this might result in too high latency of Your Nagios/Icinga installation.
|
|
||||||
Best thing in this case is to tune Your NDO or IDO backend, e. g. by tuning
|
|
||||||
MySQL or You decide to write as less information as possible into the NDO or
|
|
||||||
IDO backend.
|
|
||||||
|
|
||||||
Only if this is impossible, or does not make Your system as fast as required
|
|
||||||
You might think about caching values in the Nagios Business Process AddOn for
|
|
||||||
a certain amount of time. So access to Your NDO or IDO backend is done not so
|
|
||||||
often, but the results are not so fresh as they could be.
|
|
||||||
Cache is held in one file in the filesystem, by default
|
|
||||||
var/cache/ndo_backend_cache
|
|
||||||
|
|
||||||
If You did really decide to use caching, You activate it by using the
|
|
||||||
parameters cache_time and cache_file in etc/ndo.cfg
|
|
||||||
(they have comments there)
|
|
||||||
|
|
||||||
Please note: var/cache/ndo_backend_cache is created world-writable
|
|
||||||
(permissions 666) by the installer. If You do not want this for security
|
|
||||||
reasons, You can change permissions to whatever You like. The only thing You
|
|
||||||
must make sure is that the user Your Nagios/Icinga is running under and the
|
|
||||||
user Your webserver is running under have write access to this file.
|
|
||||||
|
|
||||||
|
|
||||||
Adapting the GUI to fit Your needs
|
|
||||||
----------------------------------
|
|
||||||
|
|
||||||
(new feature since version 0.9.5)
|
|
||||||
|
|
||||||
Some users did ask for some changes in the GUI.
|
|
||||||
The difficulty is, the AddOn is used for so many different purposes, so
|
|
||||||
that it is nearly impossible to build a GUI which fits for all of them.
|
|
||||||
|
|
||||||
Some use it for display on a big monitoring screen in an IT operations center
|
|
||||||
and like big letters to be able to read it from a distance of some meters.
|
|
||||||
Others use it in the browser on a smart phone and need some compact view
|
|
||||||
without needing to scroll so much.
|
|
||||||
|
|
||||||
Some use many priorities, some need only one priority (so navigation
|
|
||||||
between priorities is unneccessary).
|
|
||||||
|
|
||||||
I decided to have a generic solution: By default keep the GUI as it was
|
|
||||||
because I think this layout is ok for most users.
|
|
||||||
In addition giving each installation the possibility to change the layout
|
|
||||||
of the GUI to fit special needs using an own CSS.
|
|
||||||
|
|
||||||
All pages include an additional CSS file called user.css. This one You can
|
|
||||||
change if You like. All the relevant elements in the generated HTML pages have
|
|
||||||
an ID now so that everything You can do with CSS can be done with Nagios
|
|
||||||
Business Process AddOn's pages.
|
|
||||||
|
|
||||||
user.css is located in share/stylesheets/ directory.
|
|
||||||
|
|
||||||
some examples:
|
|
||||||
|
|
||||||
If You want to make Trafficlight readable from a bigger distance, just put
|
|
||||||
the following line into user.css:
|
|
||||||
#nbp_trafficlight_yes_table td { border-top:30px solid white; padding:5px; font-size:120% }
|
|
||||||
|
|
||||||
If You do not want to display the selction buttons for single priorities:
|
|
||||||
#nbp_prio_selection { display:none; }
|
|
||||||
|
|
||||||
In the same way you can hide other elements too.
|
|
||||||
|
|
||||||
To display the traffic light on the right hand side, You need two lines:
|
|
||||||
#nbp_cental_table_box_tl_yes { margin-right:9em; margin-left:0; }
|
|
||||||
#nbp_trafficlight_yes_box { float:right; }
|
|
||||||
|
|
||||||
And I'm sure users find much more cool hacks to make the GUI fit their needs.
|
|
||||||
If You found one, which You think it is interesting for other users too,
|
|
||||||
please mail it to nagiosbp-users@lists.nagiosforge.org and we will publish it.
|
|
||||||
|
|
||||||
In the approach described above all users of one installation get the same
|
|
||||||
layout of the GUI. If You like different layouts for single users, they might
|
|
||||||
want to use an addon for their browser (like Stylish for Firefox) to add user
|
|
||||||
specific styles directly in their browser.
|
|
||||||
|
|
||||||
Maybe You like a more centralistic approach: You could provide more than one
|
|
||||||
user.css on the server. The problem is, all browsers ask for the same URL of
|
|
||||||
user.css. But You can use something like apache's mod_rewrite to decide (e. g.
|
|
||||||
by the client's IP address) to deliver the one or the other.
|
|
178
UPDATE
178
UPDATE
@ -1,178 +0,0 @@
|
|||||||
If You are updating form a version before 0.9.6 please note, there are
|
|
||||||
two more perl modules required now, JSON::XS and LWP::UserAgent, see section
|
|
||||||
"Requirements" in INSTALL
|
|
||||||
|
|
||||||
If You want to update from version 0.9.0 or 0.9.1, there are two different
|
|
||||||
ways:
|
|
||||||
1. keep the old path and URL settings (not recommended)
|
|
||||||
2. use the new path and URL setting
|
|
||||||
|
|
||||||
If You are updating from version 0.9.2 or later, please see section
|
|
||||||
"Updating from version 0.9.2 or later" below.
|
|
||||||
|
|
||||||
|
|
||||||
Keep the old path and URL settings
|
|
||||||
----------------------------------
|
|
||||||
|
|
||||||
If You choose this way, You will keep path (/usr/local/nagios-ext) and URL
|
|
||||||
(http://yourhost.example.com/nagios-ext/...) as they were in previous versions.
|
|
||||||
This has the advantage, that You do not need to change any links.
|
|
||||||
|
|
||||||
Do the following steps:
|
|
||||||
|
|
||||||
Save the files of Your nagios-ext/etc directory.
|
|
||||||
|
|
||||||
Change to the directory directly above nagios-ext, by default
|
|
||||||
/usr/local
|
|
||||||
cd /usr/local
|
|
||||||
Delete nagios-ext
|
|
||||||
rm -f nagios-ext
|
|
||||||
If You did create a separate session directory, e. g.
|
|
||||||
/var/www/nagios_bp.sessions
|
|
||||||
You can remove this directory too:
|
|
||||||
cd /var/www
|
|
||||||
rm -Rf nagios_bp.sessions
|
|
||||||
|
|
||||||
Install this version as described in INSTALL and README.
|
|
||||||
As options for configure You should use something like
|
|
||||||
./configure --with-cgiurl=/nagios-ext/cgi-bin --with-htmurl=/nagios-ext --prefix=/usr/local/nagios-ext --with-cron-d-dir=/usr/local/nagios-ext/etc/cron.d --with-httpd-conf=/usr/local/nagios-ext/etc/apache-conf.d
|
|
||||||
|
|
||||||
Restore the files in nagios-ext/etc
|
|
||||||
|
|
||||||
One change in configuration You have to do: The file which was named
|
|
||||||
ndo_db_readonly.cfg before is now ndo.cfg and has more settings.
|
|
||||||
The best solution would be to copy ndo.cfg-sample to ndo.cfg
|
|
||||||
cd etc
|
|
||||||
cp ndo.cfg-sample ndo.cfg
|
|
||||||
Afterwards You take over the values You did define in ndo_db_readonly.cfg
|
|
||||||
into ndo.cfg.
|
|
||||||
|
|
||||||
If You are updating from version 0.9.0 and Your NDO database is running on
|
|
||||||
another host than Nagios Business Process View, You might want to completely
|
|
||||||
reconfigure Your values in the new ndo.cfg, because it's more easy now to
|
|
||||||
configure a different host and port for the database.
|
|
||||||
|
|
||||||
Now You can delete the old ndo_db_readonly.cfg.
|
|
||||||
|
|
||||||
If You did map Your Business Processes to Nagios service, please note,
|
|
||||||
that You also have to change the service templates and the command You did
|
|
||||||
define in some nagios config file:
|
|
||||||
The command check_bp_status must get two parameters now, see README.
|
|
||||||
|
|
||||||
The files *-sample in nagios-ext/etc can be removed.
|
|
||||||
|
|
||||||
The symlinks You added to Your system's perl INC path pointing to *.pm files
|
|
||||||
in /usr/local/nagios-ext/sbin/ should be removed. They are not needed any
|
|
||||||
longer (Nagios Business Process AddOns use local libs now only).
|
|
||||||
If You are unsure, which directories are in the INC path, type
|
|
||||||
perl -e 'print join("\n", @INC) . "\n"'
|
|
||||||
|
|
||||||
That's it. Now it should work.
|
|
||||||
If You have problems, see section Help in README.
|
|
||||||
|
|
||||||
|
|
||||||
Use the new path and URL setting
|
|
||||||
--------------------------------
|
|
||||||
|
|
||||||
If You choose this way, You will install into the new default path
|
|
||||||
(/usr/local/nagiosbp) and URL (http://yourhost.example.com/nagiosbp/...)
|
|
||||||
This has the advantage, that You are closer to the standard of 0.9.2
|
|
||||||
and further versions.
|
|
||||||
|
|
||||||
Do the following steps:
|
|
||||||
|
|
||||||
Save the files of Your nagios-ext/etc directory.
|
|
||||||
|
|
||||||
Change to the directory directly above nagios-ext, by default
|
|
||||||
/usr/local
|
|
||||||
cd /usr/local
|
|
||||||
Delete nagios-ext
|
|
||||||
rm -f nagios-ext
|
|
||||||
If You did create a separate session directory, e. g.
|
|
||||||
/var/www/nagios_bp.sessions
|
|
||||||
You can remove this directory too:
|
|
||||||
cd /var/www
|
|
||||||
rm -Rf nagios_bp.sessions
|
|
||||||
|
|
||||||
If You did create a cronjob, for cleaning up old session information, You
|
|
||||||
can remove this one now. You probably have some line like
|
|
||||||
*/10 * * * * /usr/local/nagios-ext/bin/nagios_bp_session_timeout 2>&1 | logger -t nagios_bp_session_timeout
|
|
||||||
in the crontab of the user Your webserver is running under.
|
|
||||||
Remove it.
|
|
||||||
|
|
||||||
On install of Your previous version, You did add some lines in Your httpd.conf
|
|
||||||
(one ScriptAlias, one Alias and two directory directives - search for the string
|
|
||||||
nagios-ext). Remove them. You will get a separate config file in apache's conf.d
|
|
||||||
directory afterwards, when installing the new version.
|
|
||||||
|
|
||||||
Now Your installation is as clean as we need it for the installation of the
|
|
||||||
new version.
|
|
||||||
(the only things we left over are Links in Nagios's side.html and some host
|
|
||||||
and service templates and commands You did define in some Nagios config
|
|
||||||
file - You will change them later)
|
|
||||||
|
|
||||||
Now it's time to install this new version as described in INSTALL and README.
|
|
||||||
|
|
||||||
When You are at the point to add two links to Nagios' side.html remember to
|
|
||||||
just change the links there instead of inserting them.
|
|
||||||
|
|
||||||
If You come to the section
|
|
||||||
Business Process representation as Nagios services
|
|
||||||
and You did map Your Business Processes to Nagios service before, please note,
|
|
||||||
that You also have to change the service templates and the command You did
|
|
||||||
define in some nagios config file:
|
|
||||||
The command check_bp_status must get two parameters now, see README.
|
|
||||||
|
|
||||||
Now You can restore the files in nagios-ext/etc
|
|
||||||
|
|
||||||
One change in configuration You have to do: The file which was named
|
|
||||||
ndo_db_readonly.cfg before is now ndo.cfg and has more settings.
|
|
||||||
The best solution would be to copy ndo.cfg-sample to ndo.cfg
|
|
||||||
cd etc
|
|
||||||
cp ndo.cfg-sample ndo.cfg
|
|
||||||
Afterwards You take over the values You did define in ndo_db_readonly.cfg
|
|
||||||
into ndo.cfg.
|
|
||||||
|
|
||||||
If You are updating from version 0.9.0 and Your NDO database is running on
|
|
||||||
another host than Nagios Business Process View, You might want to completely
|
|
||||||
reconfigure Your values in the new ndo.cfg, because it's more easy now to
|
|
||||||
configure a different host and port for the database.
|
|
||||||
|
|
||||||
Now You can delete the old ndo_db_readonly.cfg.
|
|
||||||
|
|
||||||
The files *-sample in nagios-ext/etc can be removed.
|
|
||||||
|
|
||||||
The symlinks You added to Your system's perl INC path pointing to *.pm files
|
|
||||||
in /usr/local/nagios-ext/sbin/ should be removed. They are not needed any
|
|
||||||
longer (Nagios Business Process AddOns use local libs now only).
|
|
||||||
If You are unsure, which directories are in the INC path, type
|
|
||||||
perl -e 'print join("\n", @INC) . "\n"'
|
|
||||||
|
|
||||||
That's it. Now it should work.
|
|
||||||
If You have problems, see section Help in README.
|
|
||||||
|
|
||||||
|
|
||||||
Updating from version 0.9.2 or later
|
|
||||||
------------------------------------
|
|
||||||
|
|
||||||
Save the files of Your nagiosbp/etc/ directory and share/stylesheets/user.css
|
|
||||||
(just to be sure).
|
|
||||||
|
|
||||||
Now You do an normal installation, see INSTALL.
|
|
||||||
As parameters for the configure script You should use the same parameters
|
|
||||||
You did use when installing the previous version!
|
|
||||||
The section about editing side.html: You do not have to do this again!
|
|
||||||
Also You did already create the read-only user for the database last time.
|
|
||||||
|
|
||||||
One change in configuration You have to do: The file which was named
|
|
||||||
ndo_db_readonly.cfg before in 0.9.2 is now ndo.cfg and has more settings.
|
|
||||||
The best solution would be to copy ndo.cfg-sample to ndo.cfg
|
|
||||||
cd etc
|
|
||||||
cp ndo.cfg-sample ndo.cfg
|
|
||||||
Afterwards You take over the values You did define in ndo_db_readonly.cfg
|
|
||||||
into ndo.cfg. The other settings in ndo.cfg You do not need to change.
|
|
||||||
|
|
||||||
Now You can delete the old ndo_db_readonly.cfg and all *-sample config files.
|
|
||||||
|
|
||||||
That's it. Now You should be on the new version and everything should be working.
|
|
||||||
If You have problems, see section Help in README.
|
|
@ -1,30 +0,0 @@
|
|||||||
prefix=@prefix@
|
|
||||||
exec_prefix=@exec_prefix@
|
|
||||||
LOGDIR=@localstatedir@
|
|
||||||
CFGDIR=@sysconfdir@
|
|
||||||
BINDIR=@bindir@
|
|
||||||
CGIDIR=@sbindir@
|
|
||||||
DATAROOTDIR=@datarootdir@
|
|
||||||
LIBEXECDIR=@libexecdir@
|
|
||||||
|
|
||||||
INSTALL=@INSTALL@
|
|
||||||
INSTALL_OPTS=@INSTALL_OPTS@
|
|
||||||
|
|
||||||
CP=@CP@
|
|
||||||
|
|
||||||
all html:
|
|
||||||
|
|
||||||
clean:
|
|
||||||
-rm bp_cfg2service_cfg.pl
|
|
||||||
-rm nagios-bp-consistency-check.pl
|
|
||||||
|
|
||||||
distclean: clean
|
|
||||||
-rm Makefile
|
|
||||||
|
|
||||||
devclean: distclean
|
|
||||||
|
|
||||||
install:
|
|
||||||
$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(BINDIR)
|
|
||||||
$(INSTALL) -m 755 $(INSTALL_OPTS) *.pl $(BINDIR)
|
|
||||||
$(INSTALL) -m 755 $(INSTALL_OPTS) nagios_bp_session_timeout $(BINDIR)
|
|
||||||
|
|
@ -1,212 +0,0 @@
|
|||||||
#!@PERL@
|
|
||||||
|
|
||||||
# Nagios Business Process View and Nagios Business Process Analysis
|
|
||||||
# Copyright (C) 2003-2010 Sparda-Datenverarbeitung eG, Nuernberg, Germany
|
|
||||||
# Bernd Stroessreuther <berny1@users.sourceforge.net>
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; version 2 of the License.
|
|
||||||
#
|
|
||||||
# This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
|
|
||||||
#Load modules
|
|
||||||
use strict;
|
|
||||||
use lib ('@libdir@');
|
|
||||||
use settings;
|
|
||||||
|
|
||||||
#Configuration
|
|
||||||
#default template which should be used for top level business processes
|
|
||||||
#it has to be defined somewhere in nagios, e. g. services.cfg
|
|
||||||
my $template_toplevel = "generic-bp-service";
|
|
||||||
|
|
||||||
#default template which should be used for minor business processes
|
|
||||||
#it has to be defined somewhere in nagios, e. g. services.cfg
|
|
||||||
#may be the same als template_toplevel, if you do not want to have different
|
|
||||||
#parameters for them
|
|
||||||
my $template_minor = "generic-bp-detail-service";
|
|
||||||
|
|
||||||
#Parameters
|
|
||||||
my ($in, $name, $description, $status, $nagios_bp_conf, $service_cfg, $help, $i, %individual_templates, $create_sub_bp, $output_file, $generate_notes);
|
|
||||||
my $settings = getSettings();
|
|
||||||
|
|
||||||
for ($i=0; $i<@ARGV; $i++)
|
|
||||||
{
|
|
||||||
if ($ARGV[$i] eq "-f") { $nagios_bp_conf = $ARGV[++$i] }
|
|
||||||
if ($ARGV[$i] eq "-tt") { $template_toplevel = $ARGV[++$i] }
|
|
||||||
if ($ARGV[$i] eq "-tm") { $template_minor = $ARGV[++$i] }
|
|
||||||
if ($ARGV[$i] eq "-s") { $create_sub_bp = $ARGV[++$i] }
|
|
||||||
if ($ARGV[$i] eq "-o") { $output_file = $ARGV[++$i] }
|
|
||||||
if ($ARGV[$i] eq "-n") { $generate_notes = $ARGV[++$i] }
|
|
||||||
if ($ARGV[$i] eq "-h" || $ARGV[$i] eq "--help") { $help = 1 }
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($create_sub_bp ne "0") { $create_sub_bp = 1 }
|
|
||||||
if ($generate_notes ne "1") { $generate_notes = 0 }
|
|
||||||
|
|
||||||
#determin path/filename of resulting cfg file
|
|
||||||
if ($output_file eq "")
|
|
||||||
{
|
|
||||||
if ($nagios_bp_conf eq "")
|
|
||||||
{
|
|
||||||
# Default values if no config file is given
|
|
||||||
$nagios_bp_conf = "$settings->{'NAGIOSBP_ETC'}/nagios-bp.conf";
|
|
||||||
$service_cfg = "$settings->{'NAGIOS_ETC'}/services-bp.cfg";
|
|
||||||
}
|
|
||||||
elsif ($nagios_bp_conf =~ m/.+\.conf$/)
|
|
||||||
{
|
|
||||||
#print "DEBUG: non standard config\n";
|
|
||||||
$service_cfg = $nagios_bp_conf;
|
|
||||||
$service_cfg =~ s#^.*/##;
|
|
||||||
$service_cfg =~ s/\.conf$//;
|
|
||||||
$service_cfg =~ s/^nagios-bp-?//;
|
|
||||||
$service_cfg = "$settings->{'NAGIOS_ETC'}/services-bp-$service_cfg.cfg";
|
|
||||||
#print "DEBUG: nagios_bp_conf $nagios_bp_conf\n";
|
|
||||||
#print "DEBUG: service_cfg $service_cfg\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$service_cfg = $output_file;
|
|
||||||
if ($nagios_bp_conf eq "")
|
|
||||||
{
|
|
||||||
# Default values if no config file is given
|
|
||||||
$nagios_bp_conf = "$settings->{'NAGIOSBP_ETC'}/nagios-bp.conf";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#help
|
|
||||||
if ($service_cfg eq "" || $help == 1)
|
|
||||||
{
|
|
||||||
print "\ncall using:\n";
|
|
||||||
print "$0\n";
|
|
||||||
print "for use with default parameters\n";
|
|
||||||
print "(generate $settings->{'NAGIOS_ETC'}/services-bp.cfg from $settings->{'NAGIOSBP_ETC'}/nagios-bp.conf\n";
|
|
||||||
print "using default templates and default dummy hostnames)\n\n";
|
|
||||||
print "or\n";
|
|
||||||
print "$0 [-f \<config_file\>] [-tt \<template_toplevel\>] [-tm \<template_minor\>] [-o \<output_file\>] [-s 0|1] [-n 0|1]\n";
|
|
||||||
print "where\n";
|
|
||||||
print "\<config_file\> is the file where You defined Your business processes\n";
|
|
||||||
print " it must be named *.conf\n";
|
|
||||||
print "\<template_toplevel\> is the service template You want to use for all business processes\n";
|
|
||||||
print " displayed in the toplevel view\n";
|
|
||||||
print " default: generic-bp-service\n";
|
|
||||||
print "\<template_minor\> is the service template You want to use for all other business processes\n";
|
|
||||||
print " You may use the same value as for \<template_toplevel\>\n";
|
|
||||||
print " default: generic-bp-detail-service\n";
|
|
||||||
print "\<output_file\> tells under which path and filename the resulting cfg file should be\n";
|
|
||||||
print " generated\n";
|
|
||||||
print " defaults to $settings->{'NAGIOS_ETC'}/services-bp.cfg if You use the default\n";
|
|
||||||
print " config file (that means if You did not give -f parameter)\n";
|
|
||||||
print " or to $settings->{'NAGIOS_ETC'}/services-bp-\<name_of_config_file\>.cfg\n";
|
|
||||||
print " otherwise\n";
|
|
||||||
print "-s 0 means: create services only for business processes displayed in\n";
|
|
||||||
print " the top level view\n";
|
|
||||||
print "-s 1 means: create services also for business processes with display 0\n";
|
|
||||||
print " default is 1\n";
|
|
||||||
print "-n 1 means: for each service we generate, this script should add an additional notes\n";
|
|
||||||
print " line containing the description You did define in nagios-bp.conf\n";
|
|
||||||
print "-n 0 means: do not add a notes line, this is the default\n";
|
|
||||||
print " (same behavior as in versions up to 0.9.5)\n";
|
|
||||||
print "\nFor further information see README, section \"Business Process representation as Nagios services\"\n\n";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
#some infos on stdout
|
|
||||||
print "\ngenerating $service_cfg from $nagios_bp_conf\n";
|
|
||||||
if ($create_sub_bp == 1)
|
|
||||||
{
|
|
||||||
print "using templates $template_toplevel / $template_minor\n";
|
|
||||||
print "services for sub-level Business Processes are also created\n\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print "using template $template_toplevel\n";
|
|
||||||
print "service only for Business Processes of top level view are created\n\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#parse nagios-bp.conf (our own config file)
|
|
||||||
# look for bp's who have an own template defined
|
|
||||||
open (IN, "<$nagios_bp_conf") or die "unable to read $nagios_bp_conf";
|
|
||||||
while ($in = <IN>)
|
|
||||||
{
|
|
||||||
if ($in =~ m/^\s*template\s+/)
|
|
||||||
{
|
|
||||||
#print "DEBUG: $in";
|
|
||||||
$in =~ s/^\s*template\s+//;
|
|
||||||
($name, $description) = split(/;/, $in);
|
|
||||||
chomp($description);
|
|
||||||
#print "DEBUG name: $name desc:$description\n";
|
|
||||||
$individual_templates{$name} = $description;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
close(IN);
|
|
||||||
|
|
||||||
# make services for every bp named in a display statement
|
|
||||||
open (IN, "<$nagios_bp_conf") or die "unable to read $nagios_bp_conf";
|
|
||||||
open (OUT, ">$service_cfg") or die "unable to write to $service_cfg";
|
|
||||||
print OUT '##################################################################################' . "\n";
|
|
||||||
print OUT '#' . "\n";
|
|
||||||
print OUT '# !!! DO NOT MODIFY THIS FILE !!!' . "\n";
|
|
||||||
print OUT '#' . "\n";
|
|
||||||
print OUT '# It is script generated!' . "\n";
|
|
||||||
print OUT '# Change the file ' . "$nagios_bp_conf\n";
|
|
||||||
print OUT '# and run the command ' . "$0 afterwards\n";
|
|
||||||
print OUT '#' . "\n";
|
|
||||||
print OUT '# If not doing so, Your changes will be lost on the next update' . "\n";
|
|
||||||
print OUT '#' . "\n";
|
|
||||||
print OUT '##################################################################################' . "\n\n\n";
|
|
||||||
|
|
||||||
while ($in = <IN>)
|
|
||||||
{
|
|
||||||
# filter comments (starting with #) and blank lines
|
|
||||||
if ($in !~ m/^#/ && $in !~ m/^ *$/)
|
|
||||||
{
|
|
||||||
#print "$in";
|
|
||||||
|
|
||||||
# for all display definitions (lines starting with "display")
|
|
||||||
if ($in =~ m/^\s*display\s+/)
|
|
||||||
{
|
|
||||||
$in =~ s/^\s*display\s+//;
|
|
||||||
($status, $name, $description) = split(/;/, $in);
|
|
||||||
chomp($description);
|
|
||||||
#do not display business processes with status 0 if configured so (see section configuration)
|
|
||||||
if ($status > 0 || $create_sub_bp == 1)
|
|
||||||
{
|
|
||||||
#print "$status : $name : $description\n";
|
|
||||||
print OUT "define service{\n";
|
|
||||||
if (defined $individual_templates{$name})
|
|
||||||
{
|
|
||||||
print OUT " use $individual_templates{$name}\n";
|
|
||||||
}
|
|
||||||
elsif ($status > 0)
|
|
||||||
{
|
|
||||||
print OUT " use $template_toplevel\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print OUT " use $template_minor\n";
|
|
||||||
}
|
|
||||||
print OUT " service_description $name\n";
|
|
||||||
if ($generate_notes == 1)
|
|
||||||
{
|
|
||||||
print OUT " notes $description\n";
|
|
||||||
}
|
|
||||||
print OUT " check_command check_bp_status!$name!$nagios_bp_conf\n";
|
|
||||||
print OUT " }\n\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
close(OUT);
|
|
||||||
close(IN);
|
|
||||||
|
|
@ -1,64 +0,0 @@
|
|||||||
#!@PERL@
|
|
||||||
|
|
||||||
# Nagios Business Process View and Nagios Business Process Analysis
|
|
||||||
# Copyright (C) 2003-2010 Sparda-Datenverarbeitung eG, Nuernberg, Germany
|
|
||||||
# Bernd Stroessreuther <berny1@users.sourceforge.net>
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; version 2 of the License.
|
|
||||||
#
|
|
||||||
# This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use lib ('@libdir@');
|
|
||||||
use strict;
|
|
||||||
use bsutils;
|
|
||||||
use ndodb;
|
|
||||||
use settings;
|
|
||||||
|
|
||||||
#my $settings = getSettings();
|
|
||||||
#my $nagiosbpcfg="$settings->{'NAGIOSBP_ETC'}/nagios-bp.conf";
|
|
||||||
|
|
||||||
my ($hardstates, $statusinfos, $key, $maxlen, %dbparam);
|
|
||||||
my %backend_description = (
|
|
||||||
"db" => "NDO Database",
|
|
||||||
"merlin" => "Merlin Database",
|
|
||||||
"fs" => "NDO2FS Filesystem",
|
|
||||||
"mk_livestatus" => "mk_livestatus",
|
|
||||||
"icinga-web" => "Icinga-Web API HTTP/JSON"
|
|
||||||
);
|
|
||||||
|
|
||||||
($hardstates, $statusinfos) = &getStates();
|
|
||||||
%dbparam = &getDbParam();
|
|
||||||
|
|
||||||
#printHash($hardstates);
|
|
||||||
#printHash($statusinfos);
|
|
||||||
|
|
||||||
print "\nReport of actual status information in NDO\n";
|
|
||||||
print "------------------------------------------\n\n";
|
|
||||||
print "Backend is $dbparam{'ndo'} ($backend_description{$dbparam{'ndo'}})\n";
|
|
||||||
print "which got it's last update at " . &getLastUpdateServiceStatus() . "\n\n";
|
|
||||||
|
|
||||||
foreach $key (keys %$statusinfos)
|
|
||||||
{
|
|
||||||
if (length($key) > $maxlen)
|
|
||||||
{
|
|
||||||
$maxlen = length($key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#print "max: $maxlen\n";
|
|
||||||
|
|
||||||
foreach $key (sort keys %$statusinfos)
|
|
||||||
{
|
|
||||||
#if ($key !~ m/business_process/)
|
|
||||||
#{
|
|
||||||
print fixedLen("[$key]", $maxlen+2, "left") . " [" . fixedLen($hardstates->{$key}, 8, "right") . "] $statusinfos->{$key}\n";
|
|
||||||
#}
|
|
||||||
}
|
|
@ -1,166 +0,0 @@
|
|||||||
#!@PERL@
|
|
||||||
|
|
||||||
# Nagios Business Process View and Nagios Business Process Analysis
|
|
||||||
# Copyright (C) 2003-2010 Sparda-Datenverarbeitung eG, Nuernberg, Germany
|
|
||||||
# Bernd Stroessreuther <berny1@users.sourceforge.net>
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; version 2 of the License.
|
|
||||||
#
|
|
||||||
# This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
use lib ('@libdir@');
|
|
||||||
use strict;
|
|
||||||
use bsutils;
|
|
||||||
use ndodb;
|
|
||||||
use settings;
|
|
||||||
|
|
||||||
my $settings = getSettings();
|
|
||||||
my $nagiosbpcfg="$settings->{'NAGIOSBP_ETC'}/nagios-bp.conf";
|
|
||||||
|
|
||||||
if ( $ARGV[0] ne "" )
|
|
||||||
{
|
|
||||||
$nagiosbpcfg=$ARGV[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
my ($hardstates, $statusinfos, $tmp1, $tmp2, $in, @used_services, $i, $num_of_operators);
|
|
||||||
my $linenum=0;
|
|
||||||
my $rc=0;
|
|
||||||
my $undef_count=0;
|
|
||||||
|
|
||||||
($hardstates, $statusinfos) = &getStates();
|
|
||||||
#printHash($hardstates);
|
|
||||||
|
|
||||||
print "Checking consistency of $nagiosbpcfg\n";
|
|
||||||
open(IN, "<$nagiosbpcfg") or die "unable to read file $nagiosbpcfg\n";
|
|
||||||
while($in = <IN>)
|
|
||||||
{
|
|
||||||
$linenum++;
|
|
||||||
# exclude comments and empty lines
|
|
||||||
if ($in !~ m/(^\s*#)|(^\s*$)/)
|
|
||||||
{
|
|
||||||
if ($in =~ m/^\s*display \d+;([A-Za-z0-9_-]+);/)
|
|
||||||
{
|
|
||||||
if (&checkForValidService($1) != 1)
|
|
||||||
{
|
|
||||||
print " the display line on line $linenum uses a non existing business process: $1\n";
|
|
||||||
$rc=1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elsif ($in =~ m/^\s*external_info ([A-Za-z0-9_-]+);/)
|
|
||||||
{
|
|
||||||
if (&checkForValidService($1) != 1)
|
|
||||||
{
|
|
||||||
print " the external_info line on line $linenum uses a non existing business process: $1\n";
|
|
||||||
$rc=1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elsif ($in =~ m/^\s*info_url ([A-Za-z0-9_-]+);/)
|
|
||||||
{
|
|
||||||
if (&checkForValidService($1) != 1)
|
|
||||||
{
|
|
||||||
print " the info_url line on line $linenum uses a non existing business process: $1\n";
|
|
||||||
$rc=1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elsif ($in =~ m/^\s*template ([A-Za-z0-9_-]+);/)
|
|
||||||
{
|
|
||||||
if (&checkForValidService($1) != 1)
|
|
||||||
{
|
|
||||||
print " the template line on line $linenum uses a non existing business process: $1\n";
|
|
||||||
$rc=1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elsif ($in =~ m/=/)
|
|
||||||
{
|
|
||||||
($tmp1, $tmp2) = split(/ *= */, $in);
|
|
||||||
chomp($tmp2);
|
|
||||||
$tmp2 =~ s/^ *\d+ *of: *//;
|
|
||||||
|
|
||||||
# look if all used services are defined in Nagios
|
|
||||||
@used_services = split(/ *&|\||\+ */, $tmp2);
|
|
||||||
#print "$linenum: " . join(/ /, @used_services) . "\n";
|
|
||||||
for ($i=0; $i<@used_services; $i++)
|
|
||||||
{
|
|
||||||
#if ($used_services[$i] !~ m/;/) { next; };
|
|
||||||
$used_services[$i] =~ s/^ *//;
|
|
||||||
$used_services[$i] =~ s/ *$//;
|
|
||||||
if (&checkForValidService($used_services[$i]) == 0)
|
|
||||||
{
|
|
||||||
print " Service \"$used_services[$i]\" used on line $linenum is not a defined anywhere\n";
|
|
||||||
$undef_count++;
|
|
||||||
$rc = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$tmp1 =~ s/^ *//;
|
|
||||||
$tmp1 =~ s/ *$//;
|
|
||||||
$hardstates->{$tmp1} = "DEFINED";
|
|
||||||
#print "DEBUG: pushing $tmp1\n";
|
|
||||||
|
|
||||||
# find formula with different operators
|
|
||||||
$num_of_operators=0;
|
|
||||||
if ($tmp2 =~ m/\|/) { $num_of_operators++ };
|
|
||||||
if ($tmp2 =~ m/\+/) { $num_of_operators++ };
|
|
||||||
if ($tmp2 =~ m/&/) { $num_of_operators++ };
|
|
||||||
if ($num_of_operators > 1)
|
|
||||||
{
|
|
||||||
print " Line $linenum: Formula is mixing up different operators. This is not defined.\n";
|
|
||||||
print " " . $in;
|
|
||||||
$rc = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
# find formula with "of:" and wrong operator
|
|
||||||
if ($in =~ m/= *\d+ *of: */ && $in =~ m/&|\|/)
|
|
||||||
{
|
|
||||||
print " Line $linenum: In a formula using the keyword \"of:\" the only allowed operator is +\n";
|
|
||||||
print " " . $in;
|
|
||||||
$rc = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print " Syntax Error on line $linenum:\n";
|
|
||||||
print " " . $in;
|
|
||||||
$rc=1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
close(IN);
|
|
||||||
|
|
||||||
if ($rc == 0)
|
|
||||||
{
|
|
||||||
print " OK\n";
|
|
||||||
}
|
|
||||||
elsif ($undef_count > 0)
|
|
||||||
{
|
|
||||||
print "\n Please note: You must define a host or service in nagios first of all,\n";
|
|
||||||
print " than You have to reload nagios, wait a minute and after this, You can use it\n";
|
|
||||||
print " in a Business Process.\n";
|
|
||||||
print " (The Nagios reload makes sure new defined services and hosts are known in\n";
|
|
||||||
print " NDO from where they are used by Business Processes.)\n\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
#printHash($hardstates);
|
|
||||||
exit($rc);
|
|
||||||
|
|
||||||
sub checkForValidService()
|
|
||||||
{
|
|
||||||
my $service = shift;
|
|
||||||
|
|
||||||
if (defined $hardstates->{$service})
|
|
||||||
{
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Nagios Business Process View and Nagios Business Process Analysis
|
|
||||||
# Copyright (C) 2003-2010 Sparda-Datenverarbeitung eG, Nuernberg, Germany
|
|
||||||
# Bernd Stroessreuther <berny1@users.sourceforge.net>
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; version 2 of the License.
|
|
||||||
#
|
|
||||||
# This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
|
|
||||||
# 2006-04-01 Bernd Stroessenreuther
|
|
||||||
# script is regularly executed by cron under the same user as apache
|
|
||||||
# and cleans old sessions from Nagios Business Impact Analysis
|
|
||||||
|
|
||||||
for file in `find @localstatedir@/nagios_bp.sessions -amin +30 -type f`
|
|
||||||
do
|
|
||||||
rm -f $file
|
|
||||||
done
|
|
||||||
|
|
222
configure.ac
222
configure.ac
@ -1,222 +0,0 @@
|
|||||||
# -*- Autoconf -*-
|
|
||||||
# Process this file with autoconf to produce a configure script.
|
|
||||||
|
|
||||||
AC_PREREQ(2.59)
|
|
||||||
AC_INIT(nagiosbp, 0.9.6, NagiosBP-Users@lists.nagiosforge.org)
|
|
||||||
|
|
||||||
dnl For later filesystem permissions
|
|
||||||
AC_DEFINE([DEFAULT_USER], [root], [Default User])
|
|
||||||
AC_DEFINE([DEFAULT_GROUP], [root], [Default Group])
|
|
||||||
|
|
||||||
AC_PREFIX_DEFAULT(/usr/local/nagiosbp)
|
|
||||||
|
|
||||||
dnl Some information about the project
|
|
||||||
PKG_NAME=nagiosbp
|
|
||||||
PKG_VERSION="0.9.6"
|
|
||||||
PKG_HOME_URL="http://nagiosbp.projects.nagiosforge.org"
|
|
||||||
PKG_REL_DATE="29-09-2010"
|
|
||||||
|
|
||||||
AC_SUBST(PKG_NAME)
|
|
||||||
AC_SUBST(PKG_VERSION)
|
|
||||||
AC_SUBST(PKG_HOME_URL)
|
|
||||||
AC_SUBST(PKG_REL_DATE)
|
|
||||||
|
|
||||||
|
|
||||||
# Checks for programs.
|
|
||||||
AC_PROG_MAKE_SET
|
|
||||||
AC_PATH_PROG([STRIP],[strip],[true])
|
|
||||||
|
|
||||||
dnl maybe we need cp
|
|
||||||
AC_PATH_PROG(CP,cp)
|
|
||||||
AC_PATH_PROG(TOUCH,touch)
|
|
||||||
|
|
||||||
dnl Figure out how to invoke "install" and what install options to use.
|
|
||||||
AC_PROG_INSTALL
|
|
||||||
AC_SUBST(INSTALL)
|
|
||||||
|
|
||||||
dnl we definitely need perl
|
|
||||||
AC_PATH_PROG(PERL,perl)
|
|
||||||
|
|
||||||
# Checks for libraries.
|
|
||||||
|
|
||||||
# Checks for header files.
|
|
||||||
|
|
||||||
# Checks for typedefs, structures, and compiler characteristics.
|
|
||||||
|
|
||||||
# Checks for library functions.
|
|
||||||
|
|
||||||
# Checks for file permissions
|
|
||||||
|
|
||||||
AC_ARG_WITH(nagiosbp_user,[ --with-nagiosbp-user=<user> sets the owner of installed files],nagiosbp_user=$withval,nagiosbp_user=root)
|
|
||||||
AC_ARG_WITH(nagiosbp_group,[ --with-nagiosbp-group=<grp> sets group of installed files],nagiosbp_grp=$withval,nagiosbp_grp=root)
|
|
||||||
|
|
||||||
AC_SUBST(nagiosbp_user)
|
|
||||||
AC_SUBST(nagiosbp_grp)
|
|
||||||
|
|
||||||
AC_DEFINE_UNQUOTED(DEFAULT_USER,"$nagiosbp_user")
|
|
||||||
AC_DEFINE_UNQUOTED(DEFAULT_GROUP,"$nagiosbp_grp")
|
|
||||||
|
|
||||||
INSTALL_OPTS="-o $nagiosbp_user -g $nagiosbp_grp"
|
|
||||||
AC_SUBST(INSTALL_OPTS)
|
|
||||||
|
|
||||||
|
|
||||||
#if test "$prefix" = "NONE" ;then
|
|
||||||
# PRE="/usr/local/nagiosbp"
|
|
||||||
# LIB_DIR=$PRE/lib
|
|
||||||
# CFG_DIR=$PRE/etc
|
|
||||||
#else
|
|
||||||
# PRE=$prefix
|
|
||||||
# LIB_DIR=$libdir
|
|
||||||
# CFG_DIR=$sysconfdir
|
|
||||||
#fi
|
|
||||||
|
|
||||||
AC_ARG_WITH(cgiurl,[ --with-cgiurl=<local-url> sets URL for cgi programs],cgiurl=$withval,cgiurl=/nagiosbp/cgi-bin)
|
|
||||||
AC_ARG_WITH(htmurl,[ --with-htmurl=<local-url> sets URL for public html],htmurl=$withval,htmurl=/nagiosbp)
|
|
||||||
AC_SUBST(htmurl)
|
|
||||||
AC_SUBST(cgiurl)
|
|
||||||
|
|
||||||
dnl Check for location of Apache conf.d directory
|
|
||||||
HTTP_CONF=no
|
|
||||||
AC_ARG_WITH(httpd_conf,[ --with-httpd-conf=<path_to_conf> sets path to Apache conf.d directory],HTTPD_CONF=$withval,HTTPD_CONF=no)
|
|
||||||
if test x$HTTPD_CONF = xno; then
|
|
||||||
if test -d /etc/httpd/conf.d; then
|
|
||||||
HTTPD_CONF="/etc/httpd/conf.d"
|
|
||||||
elif test -d /etc/apache2/conf.d; then
|
|
||||||
HTTPD_CONF="/etc/apache2/conf.d"
|
|
||||||
elif test -d /etc/apache/conf.d; then
|
|
||||||
HTTPD_CONF="/etc/apache/conf.d"
|
|
||||||
else
|
|
||||||
HTTPD_CONF="$sysconfdir/apache-conf.d/"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
AC_SUBST(HTTPD_CONF)
|
|
||||||
|
|
||||||
dnl Check for Apache user
|
|
||||||
apache_user=no
|
|
||||||
AC_ARG_WITH(apache_user,[ --with-apache-user=<user> sets path Apache runs with],apache_user=$withval,apache_user=no)
|
|
||||||
if test x$apache_user = xno; then
|
|
||||||
if grep -e "^apache:" /etc/passwd >/dev/null ; then
|
|
||||||
# RedHat, Fedora, CentOS
|
|
||||||
apache_user="apache"
|
|
||||||
elif grep -e "^www-data:" /etc/passwd >/dev/null ; then
|
|
||||||
# Debian, Ubuntu, derivates of them
|
|
||||||
apache_user="www-data"
|
|
||||||
elif grep -e "^wwwrun:" /etc/passwd >/dev/null ; then
|
|
||||||
# SuSE
|
|
||||||
apache_user="wwwrun"
|
|
||||||
else
|
|
||||||
apache_user="root"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
AC_SUBST(apache_user)
|
|
||||||
|
|
||||||
dnl Check for location of cron.d directory
|
|
||||||
CRON_D_DIR=no
|
|
||||||
AC_ARG_WITH(cron_d_dir,[ --with-cron-d-dir=<path_to_conf> sets path to cron.d directory],CRON_D_DIR=$withval,CRON_D_DIR=no)
|
|
||||||
if test x$CRON_D_DIR = xno; then
|
|
||||||
if test -d /etc/cron.d; then
|
|
||||||
CRON_D_DIR="/etc/cron.d"
|
|
||||||
else
|
|
||||||
CRON_D_DIR="$sysconfdir/cron.d/"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
AC_SUBST(CRON_D_DIR)
|
|
||||||
|
|
||||||
#AC_ARG_WITH(cgidir,[ --with-cgidir=/path/for/cgi-bin/ sets directory for cgi programs],cgidir=$withval,cgidir=/usr/local/nagiosbp/sbin)
|
|
||||||
#AC_SUBST(cgidir)
|
|
||||||
|
|
||||||
#langdir=no
|
|
||||||
#AC_ARG_WITH(langdir,[ --with-langdir=/path/for/lang/ sets directory for language files],langdir=$withval,langdir=no)
|
|
||||||
#if test x$langdir = xno; then
|
|
||||||
# echo langdir $langdir
|
|
||||||
# echo exec_prefix ${exec_prefix}
|
|
||||||
# langdir=${exec_prefix}/lang
|
|
||||||
#fi
|
|
||||||
#AC_SUBST(langdir)
|
|
||||||
|
|
||||||
AC_ARG_WITH(nagetc,[ --with-nagetc=/path/to/nagios/etc sets path to nagios etc directory],nagetc=$withval,nagetc=/usr/local/nagios/etc)
|
|
||||||
AC_SUBST(nagetc)
|
|
||||||
|
|
||||||
AC_ARG_WITH(naghtmurl,[ --with-naghtmurl=<local-url> sets URL for Nagios HTM URL],naghtmurl=$withval,naghtmurl=/nagios)
|
|
||||||
AC_SUBST(naghtmurl)
|
|
||||||
|
|
||||||
AC_ARG_WITH(nagcgiurl,[ --with-nagcgiurl=<local-url> sets URL for Nagios cgi programs],nagcgiurl=$withval,nagcgiurl=/nagios/cgi-bin)
|
|
||||||
AC_SUBST(nagcgiurl)
|
|
||||||
|
|
||||||
dnl AuthName directive in apache config
|
|
||||||
apache_authname="Nagios Access"
|
|
||||||
AC_ARG_WITH(apache_authname,[ --with-apache-authname=<authname> sets value of AuthName directive in Apache config],apache_authname=$withval,apache_authname="Nagios Access")
|
|
||||||
if test $(echo $naghtmurl | grep -i icinga | wc -l) -gt 0 -a "x$apache_authname" = "xNagios Access"; then
|
|
||||||
apache_authname="Icinga Access"
|
|
||||||
fi
|
|
||||||
AC_SUBST(apache_authname)
|
|
||||||
|
|
||||||
AC_SUBST(LIB_DIR)
|
|
||||||
AC_SUBST(CFG_DIR)
|
|
||||||
|
|
||||||
AC_CONFIG_FILES(
|
|
||||||
subst
|
|
||||||
Makefile
|
|
||||||
bin/Makefile
|
|
||||||
sbin/Makefile
|
|
||||||
etc/Makefile
|
|
||||||
etc/apache-conf.d/Makefile
|
|
||||||
etc/cron.d/Makefile
|
|
||||||
lib/Makefile
|
|
||||||
libexec/Makefile
|
|
||||||
var/nagios_bp.sessions/Makefile
|
|
||||||
var/cache/Makefile
|
|
||||||
share/Makefile
|
|
||||||
share/stylesheets/Makefile
|
|
||||||
share/lang/Makefile)
|
|
||||||
|
|
||||||
AC_OUTPUT
|
|
||||||
|
|
||||||
$PERL subst sbin/nagios-bp.cgi
|
|
||||||
$PERL subst sbin/whereUsed.cgi
|
|
||||||
$PERL subst lib/nagiosBp.pm
|
|
||||||
$PERL subst lib/ndodb.pm
|
|
||||||
$PERL subst lib/bsutils.pm
|
|
||||||
$PERL subst lib/settings.pm
|
|
||||||
$PERL subst libexec/check_bp_status.pl
|
|
||||||
$PERL subst bin/bp_cfg2service_cfg.pl
|
|
||||||
$PERL subst bin/nagios-bp-consistency-check.pl
|
|
||||||
$PERL subst bin/nagios-bp-check-ndo-connection.pl
|
|
||||||
$PERL subst bin/nagios_bp_session_timeout
|
|
||||||
$PERL subst etc/settings.cfg
|
|
||||||
$PERL subst etc/ndo.cfg-sample
|
|
||||||
$PERL subst etc/apache-conf.d/nagiosbp.conf
|
|
||||||
$PERL subst etc/cron.d/nagiosbp
|
|
||||||
|
|
||||||
dnl Review options
|
|
||||||
echo ""
|
|
||||||
echo ""
|
|
||||||
AC_MSG_RESULT([*** Configuration summary for $PKG_NAME $PKG_VERSION $PKG_REL_DATE ***:])
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo " General Options:"
|
|
||||||
echo " -------------------------"
|
|
||||||
|
|
||||||
AC_MSG_RESULT([ Install user/group: $nagiosbp_user,$nagiosbp_grp])
|
|
||||||
AC_MSG_RESULT([ Install \${prefix}: $prefix])
|
|
||||||
AC_MSG_RESULT([ Install \${exec_prefix}: $exec_prefix])
|
|
||||||
AC_MSG_RESULT([ LIB Dir: $libdir])
|
|
||||||
AC_MSG_RESULT([ Config Dir: $sysconfdir])
|
|
||||||
#AC_MSG_RESULT([ Share Dir: $datarootdir])
|
|
||||||
AC_MSG_RESULT([ Data Dir: $datadir])
|
|
||||||
#AC_MSG_RESULT([ Language Dir: $langdir])
|
|
||||||
#AC_MSG_RESULT([ CGI Dir: $cgidir])
|
|
||||||
AC_MSG_RESULT([ HTM URL: $htmurl])
|
|
||||||
AC_MSG_RESULT([ CGI URL: $cgiurl])
|
|
||||||
AC_MSG_RESULT([ Nagios Config Dir: $nagetc])
|
|
||||||
AC_MSG_RESULT([ Nagios HTM URL: $naghtmurl])
|
|
||||||
AC_MSG_RESULT([ Nagios CGI URL: $nagcgiurl])
|
|
||||||
AC_MSG_RESULT([ Apache conf.d Dir: $HTTPD_CONF])
|
|
||||||
AC_MSG_RESULT([ Apache User: $apache_user])
|
|
||||||
AC_MSG_RESULT([ Apache AuthName: $apache_authname])
|
|
||||||
AC_MSG_RESULT([ cron.d Dir: $CRON_D_DIR])
|
|
||||||
echo ""
|
|
||||||
echo ""
|
|
||||||
echo "Review the options above for accuracy. If they look okay,"
|
|
||||||
echo "type 'make install' to install."
|
|
||||||
echo ""
|
|
19
debian/README.Debian
vendored
19
debian/README.Debian
vendored
@ -1,19 +0,0 @@
|
|||||||
nagios-business-process-addon for Debian
|
|
||||||
----------------------------------------
|
|
||||||
|
|
||||||
This package currently does not handle any auto configuration or integration.
|
|
||||||
|
|
||||||
It is configured to use Icinga by default, use --no-install-recommends to use
|
|
||||||
it with another monitoring system.
|
|
||||||
|
|
||||||
See following files to change paths or permissions:
|
|
||||||
* /etc/nagios-plugins/bp-addon/settings.cfg
|
|
||||||
* /etc/apache2/conf(.d|-available)/bp-addon.conf
|
|
||||||
|
|
||||||
The check_bp_status plugin can be found here:
|
|
||||||
/usr/lib/nagios/plugins/check_bp_status.pl
|
|
||||||
|
|
||||||
You still need to configure the NDO adapter:
|
|
||||||
/etc/nagios-plugins/bp-addon/ndo.cfg
|
|
||||||
|
|
||||||
-- Markus Frosch <lazyfrosch@debian.org> Tue, 05 Aug 2014 13:58:04 +0200
|
|
8
debian/TODO
vendored
8
debian/TODO
vendored
@ -1,8 +0,0 @@
|
|||||||
TODOs for Debian packaging
|
|
||||||
--------------------------
|
|
||||||
|
|
||||||
* currently only Icinga is supported
|
|
||||||
(can be changed by the user manually)
|
|
||||||
* auto configure ndo.cfg ?
|
|
||||||
|
|
||||||
-- Markus Frosch <lazyfrosch@debian.org> Tue, 05 Aug 2014 13:45:55 +0200
|
|
16
debian/bp-addon.conf
vendored
16
debian/bp-addon.conf
vendored
@ -1,16 +0,0 @@
|
|||||||
ScriptAlias /cgi-bin/bp-addon /usr/lib/cgi-bin/bp-addon
|
|
||||||
|
|
||||||
Alias /bp-addon/stylesheets /etc/nagios-plugins/bp-addon/stylesheets
|
|
||||||
Alias /bp-addon /usr/share/bp-addon/htdocs
|
|
||||||
|
|
||||||
RedirectMatch ^/bp-addon/?$ /cgi-bin/bp-addon/nagios-bp.cgi
|
|
||||||
|
|
||||||
<DirectoryMatch "^(?:/usr/share/bp-addon/htdocs|/usr/lib/cgi-bin/bp-addon|/etc/nagios-plugins/bp-addon/stylesheets)/">
|
|
||||||
AuthName "Icinga Access"
|
|
||||||
#AuthName "Nagios Access"
|
|
||||||
AuthType Basic
|
|
||||||
AuthUserFile /etc/icinga/htpasswd.users
|
|
||||||
#AuthUserFile /etc/nagios3/htpasswd.users
|
|
||||||
|
|
||||||
Require valid-user
|
|
||||||
</DirectoryMatch>
|
|
11
debian/changelog
vendored
11
debian/changelog
vendored
@ -1,11 +0,0 @@
|
|||||||
nagios-business-process-addon (0.9.6-2) netways-wheezy; urgency=medium
|
|
||||||
|
|
||||||
* UNRELEASED
|
|
||||||
|
|
||||||
-- jenkins-debian-glue Autobuilder <jenkins@debbuild.disconnected-by-peer.at> Fri, 20 May 2016 13:31:33 +0200
|
|
||||||
|
|
||||||
nagios-business-process-addon (0.9.6-1~netways70+1~preview+1) netways-wheezy; urgency=low
|
|
||||||
|
|
||||||
* Initial release for NETWAYS Debian repository
|
|
||||||
|
|
||||||
-- Markus Frosch <lazyfrosch@debian.org> Tue, 05 Aug 2014 14:09:32 +0200
|
|
1
debian/compat
vendored
1
debian/compat
vendored
@ -1 +0,0 @@
|
|||||||
9
|
|
32
debian/control
vendored
32
debian/control
vendored
@ -1,32 +0,0 @@
|
|||||||
Source: nagios-business-process-addon
|
|
||||||
Section: net
|
|
||||||
Priority: extra
|
|
||||||
Maintainer: Markus Frosch <lazyfrosch@debian.org>
|
|
||||||
Build-Depends:
|
|
||||||
debhelper (>= 9),
|
|
||||||
dh-autoreconf,
|
|
||||||
autotools-dev
|
|
||||||
Standards-Version: 3.9.5
|
|
||||||
Homepage: http://bp-addon.monitoringexchange.org
|
|
||||||
Vcs-Git: git://git.netways.org/debian/nagios-business-process-addon.git
|
|
||||||
Vcs-Browser: https://git.netways.org/debian/nagios-business-process-addon
|
|
||||||
|
|
||||||
Package: monitoring-plugin-business-process
|
|
||||||
Architecture: all
|
|
||||||
Depends:
|
|
||||||
adduser,
|
|
||||||
libcgi-simple-perl,
|
|
||||||
libjson-xs-perl,
|
|
||||||
libwww-perl,
|
|
||||||
monitoring-plugins-common | nagios-plugins-common,
|
|
||||||
perl,
|
|
||||||
${misc:Depends},
|
|
||||||
${perl:Depends}
|
|
||||||
Recommends: icinga, apache2 | httpd
|
|
||||||
Description: Business Process monitoring for Icinga or Nagios
|
|
||||||
The Business Process AddOn takes results of individual Icinga or Nagios checks
|
|
||||||
and builds aggregated states from them.
|
|
||||||
.
|
|
||||||
How they are associated is described in one or more config files.
|
|
||||||
.
|
|
||||||
There is the possibility to make "and" conjuctions, "or" conjunction and more.
|
|
28
debian/copyright
vendored
28
debian/copyright
vendored
@ -1,28 +0,0 @@
|
|||||||
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
|
||||||
Upstream-Name: Nagios Business Process AddOn
|
|
||||||
Source: <http://bp-addon.monitoringexchange.org/>
|
|
||||||
|
|
||||||
Files: *
|
|
||||||
Copyright: 2007-2010 Bernd Stroessenreuther <berny1@users.sourceforge.net>
|
|
||||||
License: GPL-2+
|
|
||||||
|
|
||||||
Files: debian/*
|
|
||||||
Copyright: 2014 Markus Frosch <lazyfrosch@debian.org>
|
|
||||||
License: GPL-2+
|
|
||||||
|
|
||||||
License: GPL-2+
|
|
||||||
This package is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
.
|
|
||||||
This package 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, see <http://www.gnu.org/licenses/>
|
|
||||||
.
|
|
||||||
On Debian systems, the complete text of the GNU General
|
|
||||||
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
|
|
3
debian/docs
vendored
3
debian/docs
vendored
@ -1,3 +0,0 @@
|
|||||||
AUTHORS
|
|
||||||
API-DOC
|
|
||||||
README
|
|
1
debian/install
vendored
1
debian/install
vendored
@ -1 +0,0 @@
|
|||||||
debian/bp-addon.conf etc/apache2/conf-available/
|
|
6
debian/lintian-overrides
vendored
6
debian/lintian-overrides
vendored
@ -1,6 +0,0 @@
|
|||||||
# ignoring apache2 warning
|
|
||||||
# this is actually not a problem, because the handling is backwards compatible
|
|
||||||
apache2-reverse-dependency-calls-invoke-rc.d postrm
|
|
||||||
apache2-reverse-dependency-calls-invoke-rc.d postinst
|
|
||||||
|
|
||||||
non-standard-apache2-configuration-name
|
|
87
debian/patches/00_destdir_fixes
vendored
87
debian/patches/00_destdir_fixes
vendored
@ -1,87 +0,0 @@
|
|||||||
Description: Fix missing DESTDIR in Makefiles
|
|
||||||
Author: Markus Frosch <lazyfrosch@debian.org>
|
|
||||||
Last-Update: 2014-08-01
|
|
||||||
---
|
|
||||||
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
|
|
||||||
--- a/share/lang/Makefile.in
|
|
||||||
+++ b/share/lang/Makefile.in
|
|
||||||
@@ -22,6 +22,6 @@
|
|
||||||
devclean: distclean
|
|
||||||
|
|
||||||
install:
|
|
||||||
- $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DATADIR)/lang
|
|
||||||
+ $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(DATADIR)/lang
|
|
||||||
for file in ./*.txt; \
|
|
||||||
- do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DATADIR)/lang; done
|
|
||||||
+ do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(DATADIR)/lang; done
|
|
||||||
--- a/libexec/Makefile.in
|
|
||||||
+++ b/libexec/Makefile.in
|
|
||||||
@@ -23,6 +23,6 @@
|
|
||||||
devclean: distclean
|
|
||||||
|
|
||||||
install:
|
|
||||||
- $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(LIBEXECDIR)
|
|
||||||
- $(INSTALL) -m 755 $(INSTALL_OPTS) check_bp_status.pl $(LIBEXECDIR)
|
|
||||||
+ $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(LIBEXECDIR)
|
|
||||||
+ $(INSTALL) -m 755 $(INSTALL_OPTS) check_bp_status.pl $(DESTDIR)$(LIBEXECDIR)
|
|
||||||
|
|
||||||
--- a/bin/Makefile.in
|
|
||||||
+++ b/bin/Makefile.in
|
|
||||||
@@ -24,7 +24,7 @@
|
|
||||||
devclean: distclean
|
|
||||||
|
|
||||||
install:
|
|
||||||
- $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(BINDIR)
|
|
||||||
- $(INSTALL) -m 755 $(INSTALL_OPTS) *.pl $(BINDIR)
|
|
||||||
- $(INSTALL) -m 755 $(INSTALL_OPTS) nagios_bp_session_timeout $(BINDIR)
|
|
||||||
+ $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(BINDIR)
|
|
||||||
+ $(INSTALL) -m 755 $(INSTALL_OPTS) *.pl $(DESTDIR)$(BINDIR)
|
|
||||||
+ $(INSTALL) -m 755 $(INSTALL_OPTS) nagios_bp_session_timeout $(DESTDIR)$(BINDIR)
|
|
||||||
|
|
||||||
--- a/share/Makefile.in
|
|
||||||
+++ b/share/Makefile.in
|
|
||||||
@@ -22,7 +22,7 @@
|
|
||||||
devclean: distclean
|
|
||||||
|
|
||||||
install:
|
|
||||||
- $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DATADIR)
|
|
||||||
+ $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(DATADIR)
|
|
||||||
for file in ./*.gif; \
|
|
||||||
- do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DATADIR); done
|
|
||||||
+ do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(DATADIR); done
|
|
||||||
|
|
||||||
--- a/share/stylesheets/Makefile.in
|
|
||||||
+++ b/share/stylesheets/Makefile.in
|
|
||||||
@@ -23,7 +23,7 @@
|
|
||||||
devclean: distclean
|
|
||||||
|
|
||||||
install:
|
|
||||||
- $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DATADIR)/stylesheets
|
|
||||||
+ $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(DATADIR)/stylesheets
|
|
||||||
for file in ./*.css; \
|
|
||||||
- do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DATADIR)/stylesheets; done
|
|
||||||
- ${TOUCH} $(DATADIR)/stylesheets/user.css
|
|
||||||
+ do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DESTDIR)$(DATADIR)/stylesheets; done
|
|
||||||
+ ${TOUCH} $(DESTDIR)$(DATADIR)/stylesheets/user.css
|
|
||||||
--- a/var/cache/Makefile.in
|
|
||||||
+++ b/var/cache/Makefile.in
|
|
||||||
@@ -22,6 +22,6 @@
|
|
||||||
devclean: distclean
|
|
||||||
|
|
||||||
install:
|
|
||||||
- $(INSTALL) -m 755 $(INSTALL_OPTS) -d $(LOGDIR)/cache
|
|
||||||
- $(INSTALL) -m 666 $(INSTALL_OPTS) ndo_backend_cache $(LOGDIR)/cache/
|
|
||||||
+ $(INSTALL) -m 755 $(INSTALL_OPTS) -d $(DESTDIR)$(LOGDIR)/cache
|
|
||||||
+ $(INSTALL) -m 666 $(INSTALL_OPTS) ndo_backend_cache $(DESTDIR)$(LOGDIR)/cache/
|
|
||||||
|
|
||||||
--- a/var/nagios_bp.sessions/Makefile.in
|
|
||||||
+++ b/var/nagios_bp.sessions/Makefile.in
|
|
||||||
@@ -22,6 +22,6 @@
|
|
||||||
devclean: distclean
|
|
||||||
|
|
||||||
install:
|
|
||||||
- $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(LOGDIR)
|
|
||||||
- $(INSTALL) -m 1777 $(INSTALL_OPTS) -d $(LOGDIR)/nagios_bp.sessions
|
|
||||||
+ $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(LOGDIR)
|
|
||||||
+ $(INSTALL) -m 1777 $(INSTALL_OPTS) -d $(DESTDIR)$(LOGDIR)/nagios_bp.sessions
|
|
||||||
|
|
1
debian/patches/series
vendored
1
debian/patches/series
vendored
@ -1 +0,0 @@
|
|||||||
00_destdir_fixes
|
|
72
debian/postinst
vendored
72
debian/postinst
vendored
@ -1,72 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
setperm() {
|
|
||||||
user="$1"
|
|
||||||
group="$2"
|
|
||||||
mode="$3"
|
|
||||||
file="$4"
|
|
||||||
shift 4
|
|
||||||
# only do something when no setting exists
|
|
||||||
if ! dpkg-statoverride --list "$file" >/dev/null 2>&1; then
|
|
||||||
chown "$user":"$group" "$file"
|
|
||||||
chmod "$mode" "$file"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
configure)
|
|
||||||
# Make sure user nagios exists
|
|
||||||
if ! getent passwd nagios > /dev/null ; then
|
|
||||||
echo 'Adding system-user for nagios' 1>&2
|
|
||||||
adduser --system --group --home /var/lib/nagios \
|
|
||||||
--disabled-login --force-badname nagios > /dev/null
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Apache2 handling
|
|
||||||
COMMON_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true)
|
|
||||||
|
|
||||||
# NEW method for Apache >= 2.4
|
|
||||||
if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then
|
|
||||||
. /usr/share/apache2/apache2-maintscript-helper
|
|
||||||
|
|
||||||
apache2_invoke enmod cgi
|
|
||||||
apache2_invoke enconf bp-addon
|
|
||||||
|
|
||||||
# remove OLD Apache 2.2 link
|
|
||||||
[ -L /etc/apache2/conf.d/bp-addon.conf ] && rm /etc/apache2/conf.d/bp-addon.conf
|
|
||||||
|
|
||||||
# OLD methods for Apache < 2.4
|
|
||||||
elif [ "$COMMON_STATE" = "installed" ] || [ "$COMMON_STATE" = "unpacked" ] ; then
|
|
||||||
|
|
||||||
# create symlink if not existing
|
|
||||||
[ -f /etc/apache2/conf.d/bp-addon.conf ] || \
|
|
||||||
ln -vs /etc/apache2/conf-available/bp-addon.conf /etc/apache2/conf.d/bp-addon.conf
|
|
||||||
|
|
||||||
if [ -f /etc/init.d/apache2 ] ; then
|
|
||||||
if [ -x /usr/sbin/invoke-rc.d ]; then
|
|
||||||
invoke-rc.d apache2 reload 3>/dev/null || true
|
|
||||||
else
|
|
||||||
/etc/init.d/apache2 reload 3>/dev/null || true
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# setting cache permissions
|
|
||||||
setperm nagios nagios 0750 /var/cache/bp-addon
|
|
||||||
|
|
||||||
;;
|
|
||||||
|
|
||||||
abort-upgrade|abort-remove|abort-deconfigure)
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
echo "postinst called with unknown argument \`$1'" >&2
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
#DEBHELPER#
|
|
||||||
|
|
||||||
exit 0
|
|
38
debian/postrm
vendored
38
debian/postrm
vendored
@ -1,38 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
purge|remove)
|
|
||||||
|
|
||||||
# Apache2
|
|
||||||
if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
|
|
||||||
echo "disabling Apache2 configuration ..."
|
|
||||||
. /usr/share/apache2/apache2-maintscript-helper
|
|
||||||
apache2_invoke disconf bp-addon ||true
|
|
||||||
fi
|
|
||||||
if [ -L /etc/apache2/conf.d/bp-addon.conf ]; then
|
|
||||||
echo "removing link /etc/apache2/conf.d/bp-addon.conf ..."
|
|
||||||
# remove link to config
|
|
||||||
rm -f /etc/apache2/conf.d/bp-addon.conf
|
|
||||||
# reload webserver
|
|
||||||
[ -x $(which invoke-rc.d) ] && invoke-rc.d apache2 reload || true
|
|
||||||
fi
|
|
||||||
|
|
||||||
;;
|
|
||||||
|
|
||||||
upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
echo "postrm called with unknown argument \`$1'" >&2
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# dh_installdeb will replace this with shell code automatically
|
|
||||||
# generated by other debhelper scripts.
|
|
||||||
|
|
||||||
#DEBHELPER#
|
|
||||||
|
|
||||||
exit 0
|
|
60
debian/rules
vendored
60
debian/rules
vendored
@ -1,60 +0,0 @@
|
|||||||
#!/usr/bin/make -f
|
|
||||||
|
|
||||||
#DH_VERBOSE = 1
|
|
||||||
|
|
||||||
DPKG_EXPORT_BUILDFLAGS = 1
|
|
||||||
include /usr/share/dpkg/default.mk
|
|
||||||
|
|
||||||
%:
|
|
||||||
dh $@ --with autotools-dev --with autoreconf
|
|
||||||
|
|
||||||
B = debian/monitoring-plugin-business-process
|
|
||||||
|
|
||||||
override_dh_auto_configure:
|
|
||||||
dh_auto_configure -- \
|
|
||||||
--sysconfdir='/etc/nagios-plugins/bp-addon' \
|
|
||||||
--bindir='/usr/lib/bp-addon/bin' \
|
|
||||||
--sbindir='/usr/lib/cgi-bin/bp-addon' \
|
|
||||||
--libdir='/usr/lib/bp-addon' \
|
|
||||||
--libexecdir='/usr/lib/nagios/plugins' \
|
|
||||||
--datadir='/usr/share/bp-addon/htdocs' \
|
|
||||||
--datarootdir='/usr/share/bp-addon' \
|
|
||||||
--localstatedir='/var/cache/bp-addon' \
|
|
||||||
--with-cron-d-dir=/etc/cron.d \
|
|
||||||
--with-cgiurl=/cgi-bin/bp-addon \
|
|
||||||
--with-htmurl=/bp-addon \
|
|
||||||
--with-apache-user=www-data \
|
|
||||||
--with-httpd-conf=/etc/apache2/conf-available \
|
|
||||||
--with-naghtmurl=/icinga \
|
|
||||||
--with-nagcgiurl=/cgi-bin/icinga \
|
|
||||||
--with-nagetc=/etc/icinga
|
|
||||||
|
|
||||||
override_dh_auto_install:
|
|
||||||
dh_auto_install
|
|
||||||
# clean weird files in PREFIX
|
|
||||||
rm $B/usr/[A-Z]*
|
|
||||||
# move stylesheets to etc
|
|
||||||
mv $B/usr/share/bp-addon/htdocs/stylesheets $B/etc/nagios-plugins/bp-addon/
|
|
||||||
# rename configs
|
|
||||||
mv $B/etc/nagios-plugins/bp-addon/nagios-bp.conf-sample \
|
|
||||||
$B/etc/nagios-plugins/bp-addon/nagios-bp.conf
|
|
||||||
mv $B/etc/nagios-plugins/bp-addon/ndo.cfg-sample \
|
|
||||||
$B/etc/nagios-plugins/bp-addon/ndo.cfg
|
|
||||||
# rename cron
|
|
||||||
mv $B/etc/cron.d/nagiosbp $B/etc/cron.d/bp-addon
|
|
||||||
# remove upstream apache config
|
|
||||||
rm $B/etc/apache2/conf-available/nagiosbp.conf
|
|
||||||
# clean trash in cache
|
|
||||||
rm -r $B/var/cache/bp-addon/*
|
|
||||||
|
|
||||||
override_dh_auto_clean:
|
|
||||||
dh_auto_clean
|
|
||||||
rm -f \
|
|
||||||
bin/nagios-bp-check-ndo-connection.pl \
|
|
||||||
bin/nagios_bp_session_timeout \
|
|
||||||
etc/apache-conf.d/nagiosbp.conf \
|
|
||||||
etc/cron.d/nagiosbp \
|
|
||||||
etc/ndo.cfg-sample \
|
|
||||||
etc/settings.cfg
|
|
||||||
|
|
||||||
# vi: noexpandtab :
|
|
1
debian/source/format
vendored
1
debian/source/format
vendored
@ -1 +0,0 @@
|
|||||||
3.0 (quilt)
|
|
2
debian/watch
vendored
2
debian/watch
vendored
@ -1,2 +0,0 @@
|
|||||||
version=3
|
|
||||||
http://bp-addon.monitoringexchange.org/download.shtml .*/nagios-business-process-addon-(.*)\.tar\.gz
|
|
@ -1,29 +0,0 @@
|
|||||||
prefix=@prefix@
|
|
||||||
exec_prefix=@exec_prefix@
|
|
||||||
LOGDIR=@localstatedir@
|
|
||||||
CFGDIR=@sysconfdir@
|
|
||||||
BINDIR=@bindir@
|
|
||||||
CGIDIR=@sbindir@
|
|
||||||
LIBDIR=@libdir@
|
|
||||||
#DATAROOTDIR=@datarootdir@
|
|
||||||
|
|
||||||
INSTALL=@INSTALL@
|
|
||||||
INSTALL_OPTS=@INSTALL_OPTS@
|
|
||||||
|
|
||||||
CP=@CP@
|
|
||||||
|
|
||||||
all html:
|
|
||||||
|
|
||||||
clean:
|
|
||||||
|
|
||||||
distclean: clean
|
|
||||||
-rm Makefile
|
|
||||||
|
|
||||||
devclean: distclean
|
|
||||||
|
|
||||||
install:
|
|
||||||
$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(CFGDIR)
|
|
||||||
$(INSTALL) -m 664 $(INSTALL_OPTS) nagios-bp.conf-sample $(DESTDIR)$(CFGDIR)
|
|
||||||
$(INSTALL) -m 664 $(INSTALL_OPTS) ndo.cfg-sample $(DESTDIR)$(CFGDIR)
|
|
||||||
$(INSTALL) -m 664 $(INSTALL_OPTS) settings.cfg $(DESTDIR)$(CFGDIR)
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
|||||||
prefix=@prefix@
|
|
||||||
exec_prefix=@exec_prefix@
|
|
||||||
LOGDIR=@localstatedir@
|
|
||||||
CFGDIR=@sysconfdir@
|
|
||||||
BINDIR=@bindir@
|
|
||||||
CGIDIR=@sbindir@
|
|
||||||
LIBDIR=@libdir@
|
|
||||||
DATAROOTDIR=@datarootdir@
|
|
||||||
HTTPD_CONF=@HTTPD_CONF@
|
|
||||||
|
|
||||||
INSTALL=@INSTALL@
|
|
||||||
INSTALL_OPTS=@INSTALL_OPTS@
|
|
||||||
|
|
||||||
CP=@CP@
|
|
||||||
|
|
||||||
all html:
|
|
||||||
|
|
||||||
clean:
|
|
||||||
|
|
||||||
distclean: clean
|
|
||||||
-rm Makefile
|
|
||||||
|
|
||||||
devclean: distclean
|
|
||||||
|
|
||||||
install:
|
|
||||||
$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(HTTPD_CONF)
|
|
||||||
$(INSTALL) -m 664 $(INSTALL_OPTS) nagiosbp.conf $(DESTDIR)$(HTTPD_CONF)
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
|||||||
ScriptAlias @cgiurl@ "@sbindir@"
|
|
||||||
|
|
||||||
<Directory "@sbindir@">
|
|
||||||
Options ExecCGI
|
|
||||||
AllowOverride None
|
|
||||||
Order allow,deny
|
|
||||||
Allow from all
|
|
||||||
AuthName "@apache_authname@"
|
|
||||||
AuthType Basic
|
|
||||||
AuthUserFile @nagetc@/htpasswd.users
|
|
||||||
Require valid-user
|
|
||||||
</Directory>
|
|
||||||
|
|
||||||
Alias @htmurl@ "@datarootdir@"
|
|
||||||
|
|
||||||
<Directory "@datarootdir@">
|
|
||||||
Options None
|
|
||||||
AllowOverride None
|
|
||||||
Order allow,deny
|
|
||||||
Allow from all
|
|
||||||
AuthName "@apache_authname@"
|
|
||||||
AuthType Basic
|
|
||||||
AuthUserFile @nagetc@/htpasswd.users
|
|
||||||
Require valid-user
|
|
||||||
</Directory>
|
|
||||||
|
|
||||||
RedirectMatch ^@htmurl@/?$ @cgiurl@/nagios-bp.cgi
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
|||||||
prefix=@prefix@
|
|
||||||
exec_prefix=@exec_prefix@
|
|
||||||
LOGDIR=@localstatedir@
|
|
||||||
CFGDIR=@sysconfdir@
|
|
||||||
BINDIR=@bindir@
|
|
||||||
CGIDIR=@sbindir@
|
|
||||||
LIBDIR=@libdir@
|
|
||||||
DATAROOTDIR=@datarootdir@
|
|
||||||
CRON_D_DIR=@CRON_D_DIR@
|
|
||||||
|
|
||||||
INSTALL=@INSTALL@
|
|
||||||
INSTALL_OPTS=@INSTALL_OPTS@
|
|
||||||
|
|
||||||
CP=@CP@
|
|
||||||
|
|
||||||
all html:
|
|
||||||
|
|
||||||
clean:
|
|
||||||
|
|
||||||
distclean: clean
|
|
||||||
-rm Makefile
|
|
||||||
|
|
||||||
devclean: distclean
|
|
||||||
|
|
||||||
install:
|
|
||||||
$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(CRON_D_DIR)
|
|
||||||
$(INSTALL) -m 640 $(INSTALL_OPTS) nagiosbp $(DESTDIR)$(CRON_D_DIR)
|
|
||||||
|
|
@ -1 +0,0 @@
|
|||||||
*/10 * * * * @apache_user@ @bindir@/nagios_bp_session_timeout 2>&1 | logger -t nagios_bp_session_timeout
|
|
@ -1,92 +0,0 @@
|
|||||||
########################################################################################################################
|
|
||||||
#
|
|
||||||
# configuration file for Nagios Business Processes
|
|
||||||
# Syntax description see README
|
|
||||||
# THIS IS AN EXAMPLE
|
|
||||||
# You have to define Your own processes using services defined in Your Nagios configuration
|
|
||||||
#
|
|
||||||
########################################################################################################################
|
|
||||||
|
|
||||||
#
|
|
||||||
# base components
|
|
||||||
#
|
|
||||||
internetconnection = internetconnection;Provider 1 | internetconnection;Provider 2
|
|
||||||
display 0;internetconnection;Internet Connection
|
|
||||||
|
|
||||||
loadbalancers = loadbalancer1;System Health | loadbalancer2;System Health
|
|
||||||
display 0;loadbalancers;Loadbalancer Cluster
|
|
||||||
|
|
||||||
#dns = dns1;DNS | dns2;DNS | dns3;DNS
|
|
||||||
dns = 2 of: dns1;DNS + dns2;DNS + dns3;DNS
|
|
||||||
display 0;dns;DNS Cluster
|
|
||||||
|
|
||||||
#
|
|
||||||
# ERP System
|
|
||||||
#
|
|
||||||
erp_system = erp;System Check & db;Select & dns
|
|
||||||
display 3;erp_system;ERP System
|
|
||||||
info_url erp_system;/handlungsanweisungen/erp.html
|
|
||||||
external_info erp_system;echo "system resource usage 34%"
|
|
||||||
|
|
||||||
#
|
|
||||||
# BP Webshop
|
|
||||||
#
|
|
||||||
webshop_frontend_line1 = webserver1;HTTPS & webserver1;HTTPD Slots & appserver1;HTTP
|
|
||||||
webshop_frontend_line2 = webserver2;HTTPS & webserver2;HTTPD Slots & appserver2;HTTP
|
|
||||||
webshop_frontend = webshop_frontend_line1 | webshop_frontend_line2
|
|
||||||
webshop = internetconnection & loadbalancers & dns & webshop_frontend & erp_system
|
|
||||||
|
|
||||||
display 0;webshop_frontend_line1;WebShop Frontend Servers Line1
|
|
||||||
display 0;webshop_frontend_line2;WebShop Frontend Servers Line2
|
|
||||||
display 0;webshop_frontend;WebShop Frontend Servers
|
|
||||||
display 1;webshop;WebShop
|
|
||||||
#template webshop_frontend_line1;webshop-bp-service
|
|
||||||
#template webshop_frontend_line2;webshop-bp-service
|
|
||||||
#template webshop_frontend;webshop-bp-service
|
|
||||||
#template webshop;webshop-bp-service
|
|
||||||
info_url webshop;/handlungsanweisungen/webshop.html
|
|
||||||
external_info webshop;echo "currently 48 user sessions, 17 anonymous sessions"
|
|
||||||
|
|
||||||
#
|
|
||||||
# BP WebSite
|
|
||||||
#
|
|
||||||
website_webserver1 = webserver1;HTTP & webserver1;HTTPD Slots
|
|
||||||
website_webserver2 = webserver2;HTTP & webserver2;HTTPD Slots
|
|
||||||
website_webservers = website_webserver1 | website_webserver2
|
|
||||||
website = internetconnection & loadbalancers & dns & website_webservers
|
|
||||||
|
|
||||||
display 0;website_webserver1;WebServer 1
|
|
||||||
display 0;website_webserver2;WebServer 2
|
|
||||||
display 0;website_webservers;WebServer Cluster
|
|
||||||
display 1;website;WebSite
|
|
||||||
external_info website;echo '<b>Please note:</b> This afternoon maintainance on WebServer1,<br>Production only on WebServer2'
|
|
||||||
info_url website;/handlungsanweisungen/website.html
|
|
||||||
|
|
||||||
#
|
|
||||||
# BP eMail
|
|
||||||
#
|
|
||||||
mailgateways = mailgateway1;SMTP | mailgateway2;SMTP
|
|
||||||
mail = internetconnection & dns & mailgateways & groupwareserver;SMTP & groupwareserver;IMAP & groupwareserver;GroupDAV & groupwareserver;HTTPS
|
|
||||||
|
|
||||||
display 0;mailgateways;Mail Gateways
|
|
||||||
display 2;mail;eMail
|
|
||||||
info_url mail;/handlungsanweisungen/mail.html
|
|
||||||
|
|
||||||
#
|
|
||||||
# BP Intranet Portal
|
|
||||||
#
|
|
||||||
intranetportal = intranetwebserver;HTTPS & intranetwebserver;HTTPD Slots & intranetportalserver;HTTP & erp_system
|
|
||||||
display 3;intranetportal;Intranet Portal
|
|
||||||
external_info intranetportal;echo "currently 61 user sessions"
|
|
||||||
info_url intranetportal;/handlungsanweisungen/intranet-portal.html
|
|
||||||
|
|
||||||
#
|
|
||||||
# Test Systems
|
|
||||||
#
|
|
||||||
testsystem1 = dummyhost;dummyservice
|
|
||||||
testsystem2 = dummyhost;dummyservice
|
|
||||||
testsystem3 = dummyhost;dummyservice
|
|
||||||
|
|
||||||
display 4;testsystem1;Testsystem 1
|
|
||||||
display 4;testsystem2;Testsystem 2
|
|
||||||
display 4;testsystem3;Testsystem 3
|
|
@ -1,98 +0,0 @@
|
|||||||
# Business Process AddOns for Nagios and Icinga get actual data from Nagios or Icinga
|
|
||||||
# via the NDO or IDO interface
|
|
||||||
# Nagios or Icinga can write the NDO/IDO data into a database (ndo2db) or into the
|
|
||||||
# filesystem (ndo2fs) or use Merlin database or the Icinga-Web JSON API
|
|
||||||
# also they can be asked for directly from Nagios/Icinga using mk_livestatus
|
|
||||||
#
|
|
||||||
# this file configures, where to take this information from
|
|
||||||
# in releases up to 0.9.2 this file was called ndo_db_readonly.cfg
|
|
||||||
# (because up to this point, the database was the only supported interface)
|
|
||||||
|
|
||||||
# tells if NDO/IDO data is to be taken from a NDO database (db), from Merlin database
|
|
||||||
# (merlin), from the filesystem (fs), from mk_livestatus (mk_livestatus)
|
|
||||||
# or Icinga-Web API (icinga-web)
|
|
||||||
# allowed values are db, merlin, fs, mk_livestatus or icinga-web
|
|
||||||
ndo=db
|
|
||||||
# ndo=merlin
|
|
||||||
# ndo=fs
|
|
||||||
# ndo=mk_livestatus
|
|
||||||
# ndo=icinga-web
|
|
||||||
|
|
||||||
#
|
|
||||||
# settings if You use ndo=fs
|
|
||||||
#
|
|
||||||
|
|
||||||
# ndofs_basedir is the directory where ndo2fs stores status information
|
|
||||||
# (this directory has the two subdirectories PERSISTENT and VOLATILE)
|
|
||||||
ndofs_basedir=/usr/local/ndo2fs/var
|
|
||||||
|
|
||||||
# the instance name of ndo2fs
|
|
||||||
# (this is the name of the subdirectory in <ndofs_basedir>/PERSISTENT You want to use)
|
|
||||||
ndofs_instance_name=default
|
|
||||||
|
|
||||||
#
|
|
||||||
# settings if You use ndo=mk_livestatus
|
|
||||||
#
|
|
||||||
|
|
||||||
# ndo_livestatus_socket gives the full path of mk_livestatus' unix socket
|
|
||||||
ndo_livestatus_socket=/usr/local/nagios/var/rw/live
|
|
||||||
|
|
||||||
#
|
|
||||||
# settings if You use ndo=db or ndo=merlin
|
|
||||||
#
|
|
||||||
|
|
||||||
# The hostname or IP and the port of the server running Your NDO or Merlin database
|
|
||||||
ndodb_host=localhost
|
|
||||||
ndodb_port=3306
|
|
||||||
|
|
||||||
# Name of Your NDO or Merlin database (instance name)
|
|
||||||
ndodb_database=nagios
|
|
||||||
#ndodb_database=icinga
|
|
||||||
|
|
||||||
# Username and password to connect to the database
|
|
||||||
ndodb_username=nagiosro
|
|
||||||
ndodb_password=dummy
|
|
||||||
|
|
||||||
# Prefix
|
|
||||||
# all tablenames of Your NDO or Merlin database start with the same prefix
|
|
||||||
# enter this prefix here (default for NDO: nagios_, for Merlin: NULL)
|
|
||||||
# e. g. look for a table calles
|
|
||||||
# <something>objects
|
|
||||||
# enter <something> here
|
|
||||||
#ndodb_prefix=ndo_
|
|
||||||
ndodb_prefix=nagios_
|
|
||||||
#ndodb_prefix=icinga_
|
|
||||||
|
|
||||||
#
|
|
||||||
# settings if You use ndo=icinga-web
|
|
||||||
#
|
|
||||||
|
|
||||||
# the URL of Your Icinga-Web interface
|
|
||||||
ndo_icinga_web_url_prefix=http://localhost/icinga-web/
|
|
||||||
|
|
||||||
# auth_key to connect to Icinga-Web
|
|
||||||
# (add one additional user in the Icinga Web especially for the
|
|
||||||
# Business Process Addons, select Auth by auth_key,
|
|
||||||
# choose an auth_key and enter it in the field "Authkey for API"
|
|
||||||
# add the principal appkit.api.access and create the user
|
|
||||||
# the auth_key you did choose is to be entered below)
|
|
||||||
ndo_icinga_web_auth_key=dummydummy
|
|
||||||
|
|
||||||
#
|
|
||||||
# common settings
|
|
||||||
# (valid for all backends)
|
|
||||||
#
|
|
||||||
|
|
||||||
# Cache
|
|
||||||
# starting with version 0.9.4 You can configure to cache states we just got from
|
|
||||||
# the database or filesystem so that the next process can use them
|
|
||||||
# especially if You have a big installation of Nagios Business Process AddOns
|
|
||||||
# and have configured the business processes to be Nagios Services, this can
|
|
||||||
# bring You much speed with much lower load on Your monitoring server
|
|
||||||
# but the results are not so fresh as they could be
|
|
||||||
# so You decide!
|
|
||||||
|
|
||||||
# for this time in seconds states are cached
|
|
||||||
cache_time=0
|
|
||||||
# where to store cached states
|
|
||||||
cache_file=@localstatedir@/cache/ndo_backend_cache
|
|
@ -1,23 +0,0 @@
|
|||||||
# Path settings, where to find files of Nagios Business Process AddOns
|
|
||||||
NAGIOSBP_BIN=@bindir@
|
|
||||||
NAGIOSBP_ETC=@sysconfdir@
|
|
||||||
NAGIOSBP_LIBEXEC=@libexecdir@
|
|
||||||
NAGIOSBP_LIB=@libdir@
|
|
||||||
NAGIOSBP_SBIN=@sbindir@
|
|
||||||
NAGIOSBP_SHARE=@datarootdir@
|
|
||||||
NAGIOSBP_LANG=@datarootdir@/lang
|
|
||||||
NAGIOSBP_VAR=@localstatedir@
|
|
||||||
NAGIOSBP_HTML_URL=@htmurl@
|
|
||||||
NAGIOSBP_CGI_URL=@cgiurl@
|
|
||||||
|
|
||||||
# Path settings, where to find files of Nagios
|
|
||||||
NAGIOS_ETC=@nagetc@
|
|
||||||
|
|
||||||
# Base URL settings
|
|
||||||
# if You do not call Your Nagios http://<host>/nagios/
|
|
||||||
# than You have to change this setting
|
|
||||||
# e. g. if You use http://<host>/monitoring/netsaint/
|
|
||||||
# You should set
|
|
||||||
# NAGIOS_BASE_URL=/monitoring/netsaint
|
|
||||||
NAGIOS_BASE_URL=@naghtmurl@
|
|
||||||
NAGIOS_CGI_URL=@nagcgiurl@
|
|
507
install-sh
507
install-sh
@ -1,507 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# install - install a program, script, or datafile
|
|
||||||
|
|
||||||
scriptversion=2006-10-14.15
|
|
||||||
|
|
||||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
|
||||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
|
||||||
# following copyright and license.
|
|
||||||
#
|
|
||||||
# Copyright (C) 1994 X Consortium
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
# of this software and associated documentation files (the "Software"), to
|
|
||||||
# deal in the Software without restriction, including without limitation the
|
|
||||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
||||||
# sell copies of the Software, and to permit persons to whom the Software is
|
|
||||||
# furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in
|
|
||||||
# all copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
||||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
|
||||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
#
|
|
||||||
# Except as contained in this notice, the name of the X Consortium shall not
|
|
||||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
|
||||||
# ings in this Software without prior written authorization from the X Consor-
|
|
||||||
# tium.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# FSF changes to this file are in the public domain.
|
|
||||||
#
|
|
||||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
|
||||||
# `make' implicit rules from creating a file called install from it
|
|
||||||
# when there is no Makefile.
|
|
||||||
#
|
|
||||||
# This script is compatible with the BSD install script, but was written
|
|
||||||
# from scratch.
|
|
||||||
|
|
||||||
nl='
|
|
||||||
'
|
|
||||||
IFS=" "" $nl"
|
|
||||||
|
|
||||||
# set DOITPROG to echo to test this script
|
|
||||||
|
|
||||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
|
||||||
doit="${DOITPROG-}"
|
|
||||||
if test -z "$doit"; then
|
|
||||||
doit_exec=exec
|
|
||||||
else
|
|
||||||
doit_exec=$doit
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Put in absolute file names if you don't have them in your path;
|
|
||||||
# or use environment vars.
|
|
||||||
|
|
||||||
mvprog="${MVPROG-mv}"
|
|
||||||
cpprog="${CPPROG-cp}"
|
|
||||||
chmodprog="${CHMODPROG-chmod}"
|
|
||||||
chownprog="${CHOWNPROG-chown}"
|
|
||||||
chgrpprog="${CHGRPPROG-chgrp}"
|
|
||||||
stripprog="${STRIPPROG-strip}"
|
|
||||||
rmprog="${RMPROG-rm}"
|
|
||||||
mkdirprog="${MKDIRPROG-mkdir}"
|
|
||||||
|
|
||||||
posix_glob=
|
|
||||||
posix_mkdir=
|
|
||||||
|
|
||||||
# Desired mode of installed file.
|
|
||||||
mode=0755
|
|
||||||
|
|
||||||
chmodcmd=$chmodprog
|
|
||||||
chowncmd=
|
|
||||||
chgrpcmd=
|
|
||||||
stripcmd=
|
|
||||||
rmcmd="$rmprog -f"
|
|
||||||
mvcmd="$mvprog"
|
|
||||||
src=
|
|
||||||
dst=
|
|
||||||
dir_arg=
|
|
||||||
dstarg=
|
|
||||||
no_target_directory=
|
|
||||||
|
|
||||||
usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
|
||||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
|
||||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
|
||||||
or: $0 [OPTION]... -d DIRECTORIES...
|
|
||||||
|
|
||||||
In the 1st form, copy SRCFILE to DSTFILE.
|
|
||||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
|
||||||
In the 4th, create DIRECTORIES.
|
|
||||||
|
|
||||||
Options:
|
|
||||||
-c (ignored)
|
|
||||||
-d create directories instead of installing files.
|
|
||||||
-g GROUP $chgrpprog installed files to GROUP.
|
|
||||||
-m MODE $chmodprog installed files to MODE.
|
|
||||||
-o USER $chownprog installed files to USER.
|
|
||||||
-s $stripprog installed files.
|
|
||||||
-t DIRECTORY install into DIRECTORY.
|
|
||||||
-T report an error if DSTFILE is a directory.
|
|
||||||
--help display this help and exit.
|
|
||||||
--version display version info and exit.
|
|
||||||
|
|
||||||
Environment variables override the default commands:
|
|
||||||
CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
|
|
||||||
"
|
|
||||||
|
|
||||||
while test $# -ne 0; do
|
|
||||||
case $1 in
|
|
||||||
-c) shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-d) dir_arg=true
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-g) chgrpcmd="$chgrpprog $2"
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
--help) echo "$usage"; exit $?;;
|
|
||||||
|
|
||||||
-m) mode=$2
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
case $mode in
|
|
||||||
*' '* | *' '* | *'
|
|
||||||
'* | *'*'* | *'?'* | *'['*)
|
|
||||||
echo "$0: invalid mode: $mode" >&2
|
|
||||||
exit 1;;
|
|
||||||
esac
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-o) chowncmd="$chownprog $2"
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-s) stripcmd=$stripprog
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-t) dstarg=$2
|
|
||||||
shift
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
-T) no_target_directory=true
|
|
||||||
shift
|
|
||||||
continue;;
|
|
||||||
|
|
||||||
--version) echo "$0 $scriptversion"; exit $?;;
|
|
||||||
|
|
||||||
--) shift
|
|
||||||
break;;
|
|
||||||
|
|
||||||
-*) echo "$0: invalid option: $1" >&2
|
|
||||||
exit 1;;
|
|
||||||
|
|
||||||
*) break;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if test $# -ne 0 && test -z "$dir_arg$dstarg"; then
|
|
||||||
# When -d is used, all remaining arguments are directories to create.
|
|
||||||
# When -t is used, the destination is already specified.
|
|
||||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
|
||||||
for arg
|
|
||||||
do
|
|
||||||
if test -n "$dstarg"; then
|
|
||||||
# $@ is not empty: it contains at least $arg.
|
|
||||||
set fnord "$@" "$dstarg"
|
|
||||||
shift # fnord
|
|
||||||
fi
|
|
||||||
shift # arg
|
|
||||||
dstarg=$arg
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test $# -eq 0; then
|
|
||||||
if test -z "$dir_arg"; then
|
|
||||||
echo "$0: no input file specified." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
# It's OK to call `install-sh -d' without argument.
|
|
||||||
# This can happen when creating conditional directories.
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -z "$dir_arg"; then
|
|
||||||
trap '(exit $?); exit' 1 2 13 15
|
|
||||||
|
|
||||||
# Set umask so as not to create temps with too-generous modes.
|
|
||||||
# However, 'strip' requires both read and write access to temps.
|
|
||||||
case $mode in
|
|
||||||
# Optimize common cases.
|
|
||||||
*644) cp_umask=133;;
|
|
||||||
*755) cp_umask=22;;
|
|
||||||
|
|
||||||
*[0-7])
|
|
||||||
if test -z "$stripcmd"; then
|
|
||||||
u_plus_rw=
|
|
||||||
else
|
|
||||||
u_plus_rw='% 200'
|
|
||||||
fi
|
|
||||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
|
||||||
*)
|
|
||||||
if test -z "$stripcmd"; then
|
|
||||||
u_plus_rw=
|
|
||||||
else
|
|
||||||
u_plus_rw=,u+rw
|
|
||||||
fi
|
|
||||||
cp_umask=$mode$u_plus_rw;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
for src
|
|
||||||
do
|
|
||||||
# Protect names starting with `-'.
|
|
||||||
case $src in
|
|
||||||
-*) src=./$src ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if test -n "$dir_arg"; then
|
|
||||||
dst=$src
|
|
||||||
dstdir=$dst
|
|
||||||
test -d "$dstdir"
|
|
||||||
dstdir_status=$?
|
|
||||||
else
|
|
||||||
|
|
||||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
|
||||||
# might cause directories to be created, which would be especially bad
|
|
||||||
# if $src (and thus $dsttmp) contains '*'.
|
|
||||||
if test ! -f "$src" && test ! -d "$src"; then
|
|
||||||
echo "$0: $src does not exist." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -z "$dstarg"; then
|
|
||||||
echo "$0: no destination specified." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
dst=$dstarg
|
|
||||||
# Protect names starting with `-'.
|
|
||||||
case $dst in
|
|
||||||
-*) dst=./$dst ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# If destination is a directory, append the input filename; won't work
|
|
||||||
# if double slashes aren't ignored.
|
|
||||||
if test -d "$dst"; then
|
|
||||||
if test -n "$no_target_directory"; then
|
|
||||||
echo "$0: $dstarg: Is a directory" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
dstdir=$dst
|
|
||||||
dst=$dstdir/`basename "$src"`
|
|
||||||
dstdir_status=0
|
|
||||||
else
|
|
||||||
# Prefer dirname, but fall back on a substitute if dirname fails.
|
|
||||||
dstdir=`
|
|
||||||
(dirname "$dst") 2>/dev/null ||
|
|
||||||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|
|
||||||
X"$dst" : 'X\(//\)[^/]' \| \
|
|
||||||
X"$dst" : 'X\(//\)$' \| \
|
|
||||||
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
|
|
||||||
echo X"$dst" |
|
|
||||||
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
|
|
||||||
s//\1/
|
|
||||||
q
|
|
||||||
}
|
|
||||||
/^X\(\/\/\)[^/].*/{
|
|
||||||
s//\1/
|
|
||||||
q
|
|
||||||
}
|
|
||||||
/^X\(\/\/\)$/{
|
|
||||||
s//\1/
|
|
||||||
q
|
|
||||||
}
|
|
||||||
/^X\(\/\).*/{
|
|
||||||
s//\1/
|
|
||||||
q
|
|
||||||
}
|
|
||||||
s/.*/./; q'
|
|
||||||
`
|
|
||||||
|
|
||||||
test -d "$dstdir"
|
|
||||||
dstdir_status=$?
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
obsolete_mkdir_used=false
|
|
||||||
|
|
||||||
if test $dstdir_status != 0; then
|
|
||||||
case $posix_mkdir in
|
|
||||||
'')
|
|
||||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
|
||||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
|
||||||
umask=`umask`
|
|
||||||
case $stripcmd.$umask in
|
|
||||||
# Optimize common cases.
|
|
||||||
*[2367][2367]) mkdir_umask=$umask;;
|
|
||||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
|
||||||
|
|
||||||
*[0-7])
|
|
||||||
mkdir_umask=`expr $umask + 22 \
|
|
||||||
- $umask % 100 % 40 + $umask % 20 \
|
|
||||||
- $umask % 10 % 4 + $umask % 2
|
|
||||||
`;;
|
|
||||||
*) mkdir_umask=$umask,go-w;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# With -d, create the new directory with the user-specified mode.
|
|
||||||
# Otherwise, rely on $mkdir_umask.
|
|
||||||
if test -n "$dir_arg"; then
|
|
||||||
mkdir_mode=-m$mode
|
|
||||||
else
|
|
||||||
mkdir_mode=
|
|
||||||
fi
|
|
||||||
|
|
||||||
posix_mkdir=false
|
|
||||||
case $umask in
|
|
||||||
*[123567][0-7][0-7])
|
|
||||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
|
||||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
|
||||||
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
|
|
||||||
|
|
||||||
if (umask $mkdir_umask &&
|
|
||||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
|
|
||||||
then
|
|
||||||
if test -z "$dir_arg" || {
|
|
||||||
# Check for POSIX incompatibilities with -m.
|
|
||||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
|
||||||
# other-writeable bit of parent directory when it shouldn't.
|
|
||||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
|
||||||
ls_ld_tmpdir=`ls -ld "$tmpdir"`
|
|
||||||
case $ls_ld_tmpdir in
|
|
||||||
d????-?r-*) different_mode=700;;
|
|
||||||
d????-?--*) different_mode=755;;
|
|
||||||
*) false;;
|
|
||||||
esac &&
|
|
||||||
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
|
|
||||||
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
|
|
||||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
then posix_mkdir=:
|
|
||||||
fi
|
|
||||||
rmdir "$tmpdir/d" "$tmpdir"
|
|
||||||
else
|
|
||||||
# Remove any dirs left behind by ancient mkdir implementations.
|
|
||||||
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
|
|
||||||
fi
|
|
||||||
trap '' 0;;
|
|
||||||
esac;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if
|
|
||||||
$posix_mkdir && (
|
|
||||||
umask $mkdir_umask &&
|
|
||||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
|
||||||
)
|
|
||||||
then :
|
|
||||||
else
|
|
||||||
|
|
||||||
# The umask is ridiculous, or mkdir does not conform to POSIX,
|
|
||||||
# or it failed possibly due to a race condition. Create the
|
|
||||||
# directory the slow way, step by step, checking for races as we go.
|
|
||||||
|
|
||||||
case $dstdir in
|
|
||||||
/*) prefix=/ ;;
|
|
||||||
-*) prefix=./ ;;
|
|
||||||
*) prefix= ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case $posix_glob in
|
|
||||||
'')
|
|
||||||
if (set -f) 2>/dev/null; then
|
|
||||||
posix_glob=true
|
|
||||||
else
|
|
||||||
posix_glob=false
|
|
||||||
fi ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
oIFS=$IFS
|
|
||||||
IFS=/
|
|
||||||
$posix_glob && set -f
|
|
||||||
set fnord $dstdir
|
|
||||||
shift
|
|
||||||
$posix_glob && set +f
|
|
||||||
IFS=$oIFS
|
|
||||||
|
|
||||||
prefixes=
|
|
||||||
|
|
||||||
for d
|
|
||||||
do
|
|
||||||
test -z "$d" && continue
|
|
||||||
|
|
||||||
prefix=$prefix$d
|
|
||||||
if test -d "$prefix"; then
|
|
||||||
prefixes=
|
|
||||||
else
|
|
||||||
if $posix_mkdir; then
|
|
||||||
(umask=$mkdir_umask &&
|
|
||||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
|
||||||
# Don't fail if two instances are running concurrently.
|
|
||||||
test -d "$prefix" || exit 1
|
|
||||||
else
|
|
||||||
case $prefix in
|
|
||||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
|
||||||
*) qprefix=$prefix;;
|
|
||||||
esac
|
|
||||||
prefixes="$prefixes '$qprefix'"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
prefix=$prefix/
|
|
||||||
done
|
|
||||||
|
|
||||||
if test -n "$prefixes"; then
|
|
||||||
# Don't fail if two instances are running concurrently.
|
|
||||||
(umask $mkdir_umask &&
|
|
||||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
|
||||||
test -d "$dstdir" || exit 1
|
|
||||||
obsolete_mkdir_used=true
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -n "$dir_arg"; then
|
|
||||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
|
||||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
|
||||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
|
||||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
|
||||||
else
|
|
||||||
|
|
||||||
# Make a couple of temp file names in the proper directory.
|
|
||||||
dsttmp=$dstdir/_inst.$$_
|
|
||||||
rmtmp=$dstdir/_rm.$$_
|
|
||||||
|
|
||||||
# Trap to clean up those temp files at exit.
|
|
||||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
|
||||||
|
|
||||||
# Copy the file name to the temp name.
|
|
||||||
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
|
|
||||||
|
|
||||||
# and set any options; do chmod last to preserve setuid bits.
|
|
||||||
#
|
|
||||||
# If any of these fail, we abort the whole thing. If we want to
|
|
||||||
# ignore errors from any of these, just make sure not to ignore
|
|
||||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
|
||||||
#
|
|
||||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
|
|
||||||
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
|
|
||||||
&& { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
|
|
||||||
&& { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
|
||||||
|
|
||||||
# Now rename the file to the real destination.
|
|
||||||
{ $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \
|
|
||||||
|| {
|
|
||||||
# The rename failed, perhaps because mv can't rename something else
|
|
||||||
# to itself, or perhaps because mv is so ancient that it does not
|
|
||||||
# support -f.
|
|
||||||
|
|
||||||
# Now remove or move aside any old file at destination location.
|
|
||||||
# We try this two ways since rm can't unlink itself on some
|
|
||||||
# systems and the destination file might be busy for other
|
|
||||||
# reasons. In this case, the final cleanup might fail but the new
|
|
||||||
# file should still install successfully.
|
|
||||||
{
|
|
||||||
if test -f "$dst"; then
|
|
||||||
$doit $rmcmd -f "$dst" 2>/dev/null \
|
|
||||||
|| { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \
|
|
||||||
&& { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\
|
|
||||||
|| {
|
|
||||||
echo "$0: cannot unlink or rename $dst" >&2
|
|
||||||
(exit 1); exit 1
|
|
||||||
}
|
|
||||||
else
|
|
||||||
:
|
|
||||||
fi
|
|
||||||
} &&
|
|
||||||
|
|
||||||
# Now rename the file to the real destination.
|
|
||||||
$doit $mvcmd "$dsttmp" "$dst"
|
|
||||||
}
|
|
||||||
} || exit 1
|
|
||||||
|
|
||||||
trap '' 0
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Local variables:
|
|
||||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
|
||||||
# time-stamp-start: "scriptversion="
|
|
||||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
|
||||||
# time-stamp-end: "$"
|
|
||||||
# End:
|
|
@ -1,30 +0,0 @@
|
|||||||
prefix=@prefix@
|
|
||||||
DATAROOTDIR=@datarootdir@
|
|
||||||
exec_prefix=@exec_prefix@
|
|
||||||
LOGDIR=@localstatedir@
|
|
||||||
CFGDIR=@sysconfdir@
|
|
||||||
BINDIR=@bindir@
|
|
||||||
CGIDIR=@sbindir@
|
|
||||||
LIBDIR=@libdir@
|
|
||||||
|
|
||||||
INSTALL=@INSTALL@
|
|
||||||
INSTALL_OPTS=@INSTALL_OPTS@
|
|
||||||
|
|
||||||
CP=@CP@
|
|
||||||
|
|
||||||
all html:
|
|
||||||
|
|
||||||
clean:
|
|
||||||
-rm nagiosBp.pm
|
|
||||||
-rm ndodb.pm
|
|
||||||
-rm bsutils.pm
|
|
||||||
-rm settings.pm
|
|
||||||
|
|
||||||
distclean: clean
|
|
||||||
-rm Makefile
|
|
||||||
|
|
||||||
devclean: distclean
|
|
||||||
|
|
||||||
install:
|
|
||||||
$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(LIBDIR)
|
|
||||||
$(INSTALL) -m 664 $(INSTALL_OPTS) *.pm $(DESTDIR)$(LIBDIR)
|
|
@ -1,290 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
# Nagios Business Process View and Nagios Business Process Analysis
|
|
||||||
# Copyright (C) 2003-2010 Sparda-Datenverarbeitung eG, Nuernberg, Germany
|
|
||||||
# Bernd Stroessreuther <berny1@users.sourceforge.net>
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; version 2 of the License.
|
|
||||||
#
|
|
||||||
# This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
|
|
||||||
package bsutils;
|
|
||||||
|
|
||||||
use Exporter;
|
|
||||||
@ISA = qw(Exporter);
|
|
||||||
@EXPORT = qw(printArray printHash fixedLen cutOffSpaces getHostnameFromUrl getProtocolFromUrl);
|
|
||||||
|
|
||||||
|
|
||||||
=head1 NAME
|
|
||||||
|
|
||||||
bsutils - Some functions quite often used (I do not want to rewrite every time)
|
|
||||||
|
|
||||||
=head1 SYNOPSIS
|
|
||||||
|
|
||||||
use bsutils;
|
|
||||||
|
|
||||||
printArray(\@a);
|
|
||||||
printArray(\@a, "DEBUG: ");
|
|
||||||
|
|
||||||
printHash(\%h);
|
|
||||||
printHash(\%h, " "); # e. g. if you want to print intended
|
|
||||||
|
|
||||||
print fixedLen("aVeryLongStringWithoutAnySpace", 20, "right") . "\n";
|
|
||||||
# prints out: aVeryLongStringWitho
|
|
||||||
|
|
||||||
$c = "short";
|
|
||||||
$c = fixedLen($c, 20, undef, ".");
|
|
||||||
# $c is now: short...............
|
|
||||||
|
|
||||||
$string = cutOffSpaces("foo ");
|
|
||||||
# $string = "foo"
|
|
||||||
|
|
||||||
$hostname = getHostnameFromUrl("http://www.example.com:80/foo/");
|
|
||||||
# $hostname = "www.example.com";
|
|
||||||
$hostname = getHostnameFromUrl("http://myworkstation.example.com", "s");
|
|
||||||
# $hostname = "myworkstation";
|
|
||||||
|
|
||||||
print getProtocolFromUrl("https://www.example.com/test/") ."\n";
|
|
||||||
# https
|
|
||||||
$p = getProtocolFromUrl("www.example.com");
|
|
||||||
# $p = "http";
|
|
||||||
|
|
||||||
=head1 DESCRIPTION
|
|
||||||
|
|
||||||
=head2 bsutils::printArray
|
|
||||||
|
|
||||||
bsutils::printArray(\@array [, $prefix])
|
|
||||||
|
|
||||||
prints out the content of an array in a structured way
|
|
||||||
|
|
||||||
parameter 1: reference to an array
|
|
||||||
parameter 2: prefix for every line of output
|
|
||||||
returns: nothing of value
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub printArray
|
|
||||||
{
|
|
||||||
my $array = shift;
|
|
||||||
my $prefix = shift;
|
|
||||||
my ($i, $len);
|
|
||||||
|
|
||||||
$len=length(@$array - 1);
|
|
||||||
#print "len: $len\n";
|
|
||||||
for ($i=0; $i<@$array; $i++)
|
|
||||||
{
|
|
||||||
$i = sprintf("%0${len}d", $i);
|
|
||||||
print "${prefix}[$i]: $array->[$i]\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
=head2 bsutils::printHash
|
|
||||||
|
|
||||||
bsutils::printHash(\%hash [, $prefix])
|
|
||||||
|
|
||||||
prints out the content of a hash in a structured way
|
|
||||||
|
|
||||||
parameter 1: reference to a hash
|
|
||||||
parameter 2: prefix for every line of output
|
|
||||||
returns: nothing of value
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub printHash
|
|
||||||
{
|
|
||||||
my $hash = shift;
|
|
||||||
my $prefix = shift || "";
|
|
||||||
my ($key);
|
|
||||||
my $maxlen = 0;
|
|
||||||
|
|
||||||
foreach $key (keys %$hash)
|
|
||||||
{
|
|
||||||
if (length($key) > $maxlen)
|
|
||||||
{
|
|
||||||
$maxlen = length($key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#print "max: $maxlen\n";
|
|
||||||
|
|
||||||
foreach $key (keys %$hash)
|
|
||||||
{
|
|
||||||
print "${prefix}" . fixedLen("[$key]", $maxlen+2, "left") . " => $hash->{$key}\n";
|
|
||||||
# print "${prefix}[$key] => $hash->{$key}\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
=head2 bsutils::fixedLen
|
|
||||||
|
|
||||||
bsutils::fixedLen($string [, $len [, "left"|"right" [, $fillchar]]])
|
|
||||||
|
|
||||||
brings a given string to a fixed length and returns the string afterwards
|
|
||||||
no matter if it is shorter or longer before
|
|
||||||
|
|
||||||
parameter 1: the string
|
|
||||||
parameter 2: the desired length (integer), defaults to 10 if omitted
|
|
||||||
parameter 3: "left" or "right": tells on which side blanks are appended or characters are cut off
|
|
||||||
parameter 4: fillcharacter: 1 character, which should be used to fill up short strings
|
|
||||||
defaults to blank " "
|
|
||||||
returns: the resulting string
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub fixedLen
|
|
||||||
{
|
|
||||||
my $string = shift;
|
|
||||||
my $len = shift || 10;
|
|
||||||
my $side = shift || "right";
|
|
||||||
my $fillchar = shift || " ";
|
|
||||||
my $fillstring;
|
|
||||||
|
|
||||||
if (length($string) > $len)
|
|
||||||
{
|
|
||||||
if ($side eq "left")
|
|
||||||
{
|
|
||||||
$string = substr($string, $len*(-1));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$string = substr($string, 0, $len);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (length($string) < $len)
|
|
||||||
{
|
|
||||||
$fillchar = substr($fillchar, 0, 1);
|
|
||||||
$fillstring = $fillchar x ($len-length($string));
|
|
||||||
if ($side eq "left")
|
|
||||||
{
|
|
||||||
$string = $fillstring . $string;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$string .= $fillstring;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $string;
|
|
||||||
}
|
|
||||||
|
|
||||||
=head2 bsutils::cutOffSpaces
|
|
||||||
|
|
||||||
bsutils::cutOffSpaces($string)
|
|
||||||
|
|
||||||
cuts of leading and trailing whitespace characters of a given string
|
|
||||||
|
|
||||||
parameter 1: the string
|
|
||||||
returns: the resulting string
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub cutOffSpaces
|
|
||||||
{
|
|
||||||
my $string = shift;
|
|
||||||
$string =~ s/^\s*//;
|
|
||||||
$string =~ s/\s*$//;
|
|
||||||
# does the same as the two lines above, but takes twice as long
|
|
||||||
#$string =~ s/^\s*(.*?)\s*$/$1/;
|
|
||||||
return ($string);
|
|
||||||
}
|
|
||||||
|
|
||||||
=head2 bsutils::getHostnameFromUrl
|
|
||||||
|
|
||||||
bsutils::getHostnameFromUrl($URL [, "s"|"l"])
|
|
||||||
|
|
||||||
from a given URL, we extract the hostname
|
|
||||||
give "s" as second parameter to get the short hostname (everything before the first dot)
|
|
||||||
give "l" or leave empty, to get the full qualified hostname, if it is in the URL as full qualified name
|
|
||||||
|
|
||||||
parameter 1: the URL
|
|
||||||
parameter 2: the return modifier
|
|
||||||
returns: the hostname as string
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub getHostnameFromUrl
|
|
||||||
{
|
|
||||||
my $url = shift;
|
|
||||||
my $switch = shift;
|
|
||||||
|
|
||||||
if ($switch eq "s")
|
|
||||||
{
|
|
||||||
# if an IP is used instead a hostname there is no sense in cutting after the first dot
|
|
||||||
if ($url =~ m/^(.+:\/\/)?(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/)
|
|
||||||
{
|
|
||||||
if (defined($2))
|
|
||||||
{
|
|
||||||
return($2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return($1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$url =~ m/^(.+:\/\/)?([^.:\/]+)/;
|
|
||||||
if (defined($2))
|
|
||||||
{
|
|
||||||
return($2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return($1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$url =~ m/^(.+:\/\/)?([^:\/]+)/;
|
|
||||||
if (defined($2))
|
|
||||||
{
|
|
||||||
return($2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return($1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return(undef);
|
|
||||||
}
|
|
||||||
|
|
||||||
=head2 bsutils::getProtocolFromUrl
|
|
||||||
|
|
||||||
bsutils::getProtocolFromUrl($URL)
|
|
||||||
|
|
||||||
from a given URL, we extract the protocol
|
|
||||||
|
|
||||||
parameter 1: the URL
|
|
||||||
returns: the protocol as string
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub getProtocolFromUrl
|
|
||||||
{
|
|
||||||
my $url = shift;
|
|
||||||
$url =~ m/^(.+):\/\//;
|
|
||||||
if (defined($1))
|
|
||||||
{
|
|
||||||
return($1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return("http");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
=head1 AUTHOR
|
|
||||||
|
|
||||||
Bernd Stroessreuther <berny1@users.sourceforge.net>
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
|
|
||||||
return (1);
|
|
@ -1,434 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
# Nagios Business Process View and Nagios Business Process Analysis
|
|
||||||
# Copyright (C) 2003-2010 Sparda-Datenverarbeitung eG, Nuernberg, Germany
|
|
||||||
# Bernd Stroessreuther <berny1@users.sourceforge.net>
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; version 2 of the License.
|
|
||||||
#
|
|
||||||
# This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
|
|
||||||
package nagiosBp;
|
|
||||||
|
|
||||||
use lib ('@libdir@');
|
|
||||||
use Exporter;
|
|
||||||
use strict;
|
|
||||||
use bsutils;
|
|
||||||
use settings;
|
|
||||||
our $settings = getSettings();
|
|
||||||
our %i18n;
|
|
||||||
our @ISA = qw(Exporter);
|
|
||||||
our @EXPORT = qw(getBPs read_language_file get_lang_string getAvaiableLanguages and listAllComponentsOf);
|
|
||||||
|
|
||||||
|
|
||||||
#parse nagios-bp.conf (our own config file)
|
|
||||||
# parameter 1: the path of nagios-bp.conf file to be used
|
|
||||||
# parameter 2: a reference to the hardstates hash
|
|
||||||
# this hash is extended by this function (states of business processes are added)
|
|
||||||
# parameter 3: "true" or "false", should external scripts be executed
|
|
||||||
# defaults to "true"
|
|
||||||
# returns: hash reference with descriptions of all business processes
|
|
||||||
# returns: hash reference with priorities of all business processes
|
|
||||||
# returns: hash reference with the outputs of all external-info scripts
|
|
||||||
# empty if parameter 3 is "false"
|
|
||||||
# returns: hash reference with all info-urls
|
|
||||||
# returns: hash reference with the formula for each business process
|
|
||||||
sub getBPs()
|
|
||||||
{
|
|
||||||
my $nagios_bp_conf = shift;
|
|
||||||
my $hardstates = shift;
|
|
||||||
my $execute_external_scripts = shift || "true";
|
|
||||||
|
|
||||||
my (@fields, @fields_state, $in, $formula, $num_of_operators, $result, %display_status, %display, %script_out, %info_url, %components, $description, $i, $min_ok, $name_ext, $name, $script, $status, $url, $var);
|
|
||||||
|
|
||||||
open (IN, "<$nagios_bp_conf") or nagdie("unable to read $nagios_bp_conf");
|
|
||||||
while ($in = <IN>)
|
|
||||||
{
|
|
||||||
# filter comments (starting with #) and blank lines
|
|
||||||
if ($in !~ m/^#/ && $in !~ m/^ *$/)
|
|
||||||
{
|
|
||||||
#print "$in";
|
|
||||||
|
|
||||||
# for all display definitions (lines starting with "display")
|
|
||||||
if ($in =~ m/^display/)
|
|
||||||
{
|
|
||||||
$in = substr($in, 8);
|
|
||||||
($status, $name, $description) = split(/;/, $in);
|
|
||||||
chomp($description);
|
|
||||||
$display{$name} = $description;
|
|
||||||
$display_status{$name} = $status;
|
|
||||||
#print "name: $name description: $description\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
# for all external_info definitions (lines starting with "external_info")
|
|
||||||
elsif ($in =~ m/^external_info/)
|
|
||||||
{
|
|
||||||
if ($execute_external_scripts ne "false")
|
|
||||||
{
|
|
||||||
$in = substr($in, 14);
|
|
||||||
($name_ext, $script) = split(/;/, $in);
|
|
||||||
chomp($script);
|
|
||||||
open(SCRIPT, "$script |") or die "unable to execute script $script";
|
|
||||||
$script_out{$name_ext} = <SCRIPT>;
|
|
||||||
close(SCRIPT);
|
|
||||||
#print "name: $name_ext out: $script_out{$name_ext}\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# for all info_url definitions (lines starting with "info_url")
|
|
||||||
elsif ($in =~ m/^info_url/)
|
|
||||||
{
|
|
||||||
$in = substr($in, 9);
|
|
||||||
($name_ext, $url) = split(/;/, $in);
|
|
||||||
chomp($url);
|
|
||||||
$info_url{$name_ext} = $url;
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
# for all variable definitions (containing a =)
|
|
||||||
if ($in =~ m/=/)
|
|
||||||
{
|
|
||||||
@fields = split(/ *= */, $in);
|
|
||||||
$var = cutOffSpaces($fields[0]);
|
|
||||||
if ($var =~ m/;/ ) { nagdie("variable names are not allowed to contain semicolon") }
|
|
||||||
chomp($fields[1]);
|
|
||||||
$formula = cutOffSpaces($fields[1]);
|
|
||||||
|
|
||||||
$num_of_operators=0;
|
|
||||||
if ($formula =~ m/\|/) { $num_of_operators++ };
|
|
||||||
if ($formula =~ m/\+/) { $num_of_operators++ };
|
|
||||||
if ($formula =~ m/&/) { $num_of_operators++ };
|
|
||||||
if ($num_of_operators > 1) { nagdie("no formulas mixing up the different operators") }
|
|
||||||
# formulas containig only one element are used the same way as "and" formulas
|
|
||||||
if ($formula !~ m/\|/ && $formula !~ m/&/ && $formula !~ m/\+/) { $formula .= " &" }
|
|
||||||
#remember every single variable definition for later reverse lookup
|
|
||||||
$components{$var} = $formula;
|
|
||||||
|
|
||||||
# for formulas with "or"
|
|
||||||
if ($formula =~ m/\|/)
|
|
||||||
{
|
|
||||||
@fields = split(/ *\| */, $formula);
|
|
||||||
@fields_state = ();
|
|
||||||
for ($i=0; $i<@fields; $i++)
|
|
||||||
{
|
|
||||||
@fields_state[$i] = $hardstates->{$fields[$i]};
|
|
||||||
#print "$i: $fields[$i]: $hardstates{$fields[$i]}\n";
|
|
||||||
}
|
|
||||||
$result = &or(@fields_state);
|
|
||||||
#print "$var $result\n";
|
|
||||||
$hardstates->{$var} = $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
# for formulas with "and"
|
|
||||||
if ($formula =~ m/&/)
|
|
||||||
{
|
|
||||||
@fields = split(/ *& */, $formula);
|
|
||||||
@fields_state = ();
|
|
||||||
for ($i=0; $i<@fields; $i++)
|
|
||||||
{
|
|
||||||
@fields_state[$i] = $hardstates->{$fields[$i]};
|
|
||||||
#print "$i: $fields[$i]: $hardstates{$fields[$i]}\n";
|
|
||||||
}
|
|
||||||
$result = &and(@fields_state);
|
|
||||||
#print "$var $result\n";
|
|
||||||
$hardstates->{$var} = $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
# for formulas "x of y" (symbol +)
|
|
||||||
if ($formula =~ m/\+/)
|
|
||||||
{
|
|
||||||
if ($formula =~ m/^(\d+) *of: *(.+)/)
|
|
||||||
{
|
|
||||||
$formula = $2;
|
|
||||||
$min_ok = $1;
|
|
||||||
@fields = split(/ *\+ */, $formula);
|
|
||||||
@fields_state = ();
|
|
||||||
for ($i=0; $i<@fields; $i++)
|
|
||||||
{
|
|
||||||
@fields_state[$i] = $hardstates->{$fields[$i]};
|
|
||||||
#print "$i: $fields[$i]: $hardstates{$fields[$i]}\n";
|
|
||||||
}
|
|
||||||
$result = &x_of_y($min_ok, @fields_state);
|
|
||||||
#print "debug: $var $result\n";
|
|
||||||
$hardstates->{$var} = $result;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nagdie('syntax must be: <var> = <num> of: <var1> + <var2> [+ <varn>]*');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
close(IN);
|
|
||||||
#&printHash(\%components, "DEBUG components: ");
|
|
||||||
return(\%display, \%display_status, \%script_out, \%info_url, \%components);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# making an "and" conjuctions of states
|
|
||||||
sub and()
|
|
||||||
{
|
|
||||||
my @params = @_;
|
|
||||||
my %states = ( 0 => "UNKNOWN", 1 => "OK", 2 => "UNKNOWN", 3 => "WARNING", 4 => "CRITICAL" );
|
|
||||||
my %statesrev = ( "OK" => 1, "UNKNOWN" => 2, "WARNING" => 3, "CRITICAL" => 4);
|
|
||||||
my $i;
|
|
||||||
my $max = 0;
|
|
||||||
my $value;
|
|
||||||
|
|
||||||
for ($i=0; $i<@params; $i++)
|
|
||||||
{
|
|
||||||
$value = $statesrev{$params[$i]};
|
|
||||||
if ($value eq "") {$value = 2}
|
|
||||||
if ($value > $max) { $max = $value }
|
|
||||||
#print "$params[$i]: $value\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
#return
|
|
||||||
$states{$max};
|
|
||||||
}
|
|
||||||
|
|
||||||
# making an "or" conjuctions of states
|
|
||||||
sub or()
|
|
||||||
{
|
|
||||||
my @params = @_;
|
|
||||||
my %states = ( 1 => "OK", 2 => "UNKNOWN", 3 => "WARNING", 4 => "CRITICAL", 5 => "UNKNOWN" );
|
|
||||||
my %statesrev = ( "OK" => 1, "UNKNOWN" => 2, "WARNING" => 3, "CRITICAL" => 4);
|
|
||||||
my $i;
|
|
||||||
my $min = 5;
|
|
||||||
my $value;
|
|
||||||
|
|
||||||
for ($i=0; $i<@params; $i++)
|
|
||||||
{
|
|
||||||
$value = $statesrev{$params[$i]};
|
|
||||||
if ($value eq "") {$value = 2}
|
|
||||||
if ($value < $min) { $min = $value }
|
|
||||||
#print "$params[$i]: $value\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
#return
|
|
||||||
$states{$min};
|
|
||||||
}
|
|
||||||
|
|
||||||
# making an "x_of_y" conjuctions of states
|
|
||||||
sub x_of_y()
|
|
||||||
{
|
|
||||||
my @params = @_;
|
|
||||||
my $i;
|
|
||||||
my %state_counts;
|
|
||||||
my $return = "UNKNOWN";
|
|
||||||
my $min_ok = shift(@params);
|
|
||||||
#print "min_ok: $min_ok\n";
|
|
||||||
|
|
||||||
for ($i=0; $i<@params; $i++)
|
|
||||||
{
|
|
||||||
$state_counts{$params[$i]}++;
|
|
||||||
#print "parm $i: \"$params[$i]\"\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($state_counts{"OK"} >= $min_ok) { $return="OK" }
|
|
||||||
elsif ($state_counts{"OK"} + $state_counts{"WARNING"} >= $min_ok) { $return="WARNING" }
|
|
||||||
else { $return="CRITICAL" }
|
|
||||||
|
|
||||||
#return
|
|
||||||
$return;
|
|
||||||
}
|
|
||||||
|
|
||||||
# internationalization: read the different output strings in a given language
|
|
||||||
# and store the strings in global hash i18n
|
|
||||||
# there it can be accessed by get_lang_string()
|
|
||||||
# param 1: the language, can be a single language abreviation like "de", "en",...
|
|
||||||
# or a string like a Accept-Language HTTP Header
|
|
||||||
# HTTP_ACCEPT_LANGUAGE='en,en-us;q=0.8,de-de;q=0.5,de;q=0.3'
|
|
||||||
# param 2: default language e. g. "en"
|
|
||||||
# if the given language is unavailable
|
|
||||||
sub read_language_file()
|
|
||||||
{
|
|
||||||
my $lang = shift;
|
|
||||||
my $default_lang = shift;
|
|
||||||
|
|
||||||
my ($in, $name, $value, $filename, @languagepriority, $i, @searchresult, $available_lang);
|
|
||||||
|
|
||||||
die "default_lang is not valid\n" if ($default_lang !~ m/^[a-z][a-z]$/);
|
|
||||||
|
|
||||||
chomp($lang);
|
|
||||||
|
|
||||||
$available_lang = &getAvaiableLanguages();
|
|
||||||
|
|
||||||
#print "lang: $lang\n";
|
|
||||||
#print "default_lang: $default_lang\n";
|
|
||||||
#print "available_lang: " . join(", ", @$available_lang) . "\n";
|
|
||||||
|
|
||||||
# extract language out of accept language header
|
|
||||||
if ($lang !~ m/^[a-z][a-z]$/)
|
|
||||||
{
|
|
||||||
#print "lang: $lang\n";
|
|
||||||
@languagepriority = split(/[,;]/, $lang);
|
|
||||||
for ($i=0; $i<@languagepriority; $i++)
|
|
||||||
{
|
|
||||||
next if ($languagepriority[$i] =~ m/^q=/);
|
|
||||||
$languagepriority[$i] =~ s/-[a-z][a-z]//;
|
|
||||||
next if ($languagepriority[$i] !~ m/^[a-z][a-z]$/);
|
|
||||||
#print "$languagepriority[$i]\n";
|
|
||||||
@searchresult = grep(/$languagepriority[$i]/, @$available_lang);
|
|
||||||
#print scalar @searchresult . "\n";
|
|
||||||
if (@searchresult > 0)
|
|
||||||
{
|
|
||||||
$lang = $languagepriority[$i];
|
|
||||||
last;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($lang !~ m/^[a-z][a-z]$/)
|
|
||||||
{
|
|
||||||
$lang = $default_lang;
|
|
||||||
}
|
|
||||||
#print "lang: $lang\n";
|
|
||||||
|
|
||||||
# load the best matching language file
|
|
||||||
$filename = "$settings->{'NAGIOSBP_LANG'}/i18n_$lang.txt";
|
|
||||||
|
|
||||||
if ( ! -r $filename )
|
|
||||||
{
|
|
||||||
$lang = $default_lang;
|
|
||||||
$filename = "$settings->{'NAGIOSBP_LANG'}/i18n_$lang.txt";
|
|
||||||
}
|
|
||||||
|
|
||||||
open(IN, "<$filename") or die "unable to read language file $filename\n";
|
|
||||||
while($in = <IN>)
|
|
||||||
{
|
|
||||||
if ($in !~ m/^\s*#/ && $in !~ m/^\s*$/)
|
|
||||||
{
|
|
||||||
#print $in;
|
|
||||||
chomp($in);
|
|
||||||
($name, $value) = split(/\s*=\s*/, $in);
|
|
||||||
#print "name: $name, value: $value\n";
|
|
||||||
$i18n{$name} = $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
close(IN);
|
|
||||||
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub get_lang_string()
|
|
||||||
{
|
|
||||||
my $string = shift;
|
|
||||||
my $substituted = "";
|
|
||||||
my $i=1;
|
|
||||||
my $var="";
|
|
||||||
|
|
||||||
if (defined $i18n{$string})
|
|
||||||
{
|
|
||||||
# allow variable susbstitution
|
|
||||||
$substituted = $i18n{$string};
|
|
||||||
while ($var = shift)
|
|
||||||
{
|
|
||||||
$substituted =~ s/__var${i}__/$var/g;
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return($substituted);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return($string);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# build a list of available languages
|
|
||||||
sub getAvaiableLanguages()
|
|
||||||
{
|
|
||||||
my (@available_lang, $fname);
|
|
||||||
|
|
||||||
opendir(DIR, $settings->{'NAGIOSBP_LANG'}) or die "unable to open directory for language files $settings->{'NAGIOSBP_LANG'}\n";
|
|
||||||
while ($fname = readdir(DIR))
|
|
||||||
{
|
|
||||||
if (-f "$settings->{'NAGIOSBP_LANG'}/$fname" && $fname =~ m/i18n_([a-z][a-z]).txt$/)
|
|
||||||
{
|
|
||||||
#print "available_lang: $1\n";
|
|
||||||
push(@available_lang, $1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
closedir(DIR);
|
|
||||||
|
|
||||||
return(\@available_lang);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub nagdie()
|
|
||||||
{
|
|
||||||
print $_[0] . "\n";
|
|
||||||
exit(3);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub listAllComponentsOf()
|
|
||||||
{
|
|
||||||
my $bp = shift;
|
|
||||||
my $bps_hashref = shift;
|
|
||||||
|
|
||||||
my (@act_bp_components, $k, %result_list, $act_component, $bps_left_in_result);
|
|
||||||
|
|
||||||
#print "DEBUG starting func listAllComponentsOf for $bp\n";
|
|
||||||
$result_list{$bp} = 1;
|
|
||||||
$bps_left_in_result = 1;
|
|
||||||
#print "DEBUG func bp: resultlist now contains $bps_left_in_result bps:\n";
|
|
||||||
#printHash(\%result_list);
|
|
||||||
|
|
||||||
while ($bps_left_in_result > 0)
|
|
||||||
{
|
|
||||||
$bps_left_in_result = 0;
|
|
||||||
foreach $act_component (keys %result_list)
|
|
||||||
{
|
|
||||||
if ($act_component !~ m/;/)
|
|
||||||
{
|
|
||||||
$bps_left_in_result++;
|
|
||||||
#print "DEBUG func bp: is bp $act_component\n";
|
|
||||||
$bps_hashref->{$act_component} =~ s/\s*\d+\s+of:\s*//;
|
|
||||||
@act_bp_components = split(/\s*&|\||\+\s*/, $bps_hashref->{$act_component});
|
|
||||||
#print "DEBUG func bp: $act_component contains " . join(/,/, @act_bp_components) . "\n";
|
|
||||||
#print "DEBUG func bp: deleting \"$act_component\"\n";
|
|
||||||
delete($result_list{$act_component});
|
|
||||||
|
|
||||||
for ($k=0; $k<@act_bp_components; $k++)
|
|
||||||
{
|
|
||||||
$act_bp_components[$k] = cutOffSpaces($act_bp_components[$k]);
|
|
||||||
#print "DEBUG func bp: adding \"$act_bp_components[$k]\"\n";
|
|
||||||
$result_list{$act_bp_components[$k]} = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#print "DEBUG func bp: there were $bps_left_in_result bps\n";
|
|
||||||
#print "DEBUG func bp: resultlist now contains:\n";
|
|
||||||
#printHash(\%result_list);
|
|
||||||
}
|
|
||||||
#foreach $act_bp (keys %$bps_hashref)
|
|
||||||
#{
|
|
||||||
# print "DEBUG func act_bp: $act_bp\n";
|
|
||||||
# #printArray(\@act_bp_components);
|
|
||||||
# for ($k=0; $k<@act_bp_components; $k++)
|
|
||||||
# {
|
|
||||||
# $act_bp_components[$k] = &cutOffSpaces($act_bp_components[$k]);
|
|
||||||
# #print "DEBUG func: act_bp_components \"$act_bp_components[$k]\"\n";
|
|
||||||
# }
|
|
||||||
# #@match = grep(/^$search$/, @component_list);
|
|
||||||
# #printArray(\@match);
|
|
||||||
#}
|
|
||||||
|
|
||||||
return(keys %result_list);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(1);
|
|
687
lib/ndodb.pm.in
687
lib/ndodb.pm.in
@ -1,687 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
# Nagios Business Process View and Nagios Business Process Analysis
|
|
||||||
# Copyright (C) 2003-2010 Sparda-Datenverarbeitung eG, Nuernberg, Germany
|
|
||||||
# Bernd Stroessreuther <berny1@users.sourceforge.net>
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; version 2 of the License.
|
|
||||||
#
|
|
||||||
# This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
|
|
||||||
package ndodb;
|
|
||||||
|
|
||||||
use Exporter;
|
|
||||||
use strict;
|
|
||||||
use DBI;
|
|
||||||
use IO::Socket;
|
|
||||||
use LWP::UserAgent;
|
|
||||||
use JSON::XS;
|
|
||||||
#use Data::Dumper;
|
|
||||||
use Fcntl qw(:DEFAULT :flock);
|
|
||||||
use lib ('@libdir@');
|
|
||||||
use settings;
|
|
||||||
#use bsutils;
|
|
||||||
our $settings = getSettings();
|
|
||||||
our @ISA = qw(Exporter);
|
|
||||||
our @EXPORT = qw(getStates getLastUpdateServiceStatus getDbParam);
|
|
||||||
|
|
||||||
my ($dbh, %dbparam, $sql, $sth, @fields, %hardstates, %statusinfos, $hostdirname, $servicedirname, $parentdirname, $servicelist, $in, $line, $servicename, $hostname, $lasthardstate, $currentstate, $output, $lastservicecheck, @lastservicecheck_local, $rc, $jsonref, $subhash);
|
|
||||||
my $dbConfigFile = $settings->{'NAGIOSBP_ETC'} . "/ndo.cfg";
|
|
||||||
my @services_state=("OK", "WARNING", "CRITICAL", "UNKNOWN");
|
|
||||||
my @host_state=("OK", "CRITICAL", "UNKNOWN");
|
|
||||||
|
|
||||||
|
|
||||||
sub getStates()
|
|
||||||
{
|
|
||||||
my %dbparam = &getDbParam();
|
|
||||||
my $socket;
|
|
||||||
#print STDERR "DEBUG: num of hardstates " . scalar %hardstates . "\n";
|
|
||||||
#print STDERR "DEBUG: num of statusinfos " . scalar %statusinfos . "\n";
|
|
||||||
if ($dbparam{'cache_time'} > 0)
|
|
||||||
{
|
|
||||||
checkCache();
|
|
||||||
#print STDERR "DEBUG: num of hardstates " . scalar %hardstates . "\n";
|
|
||||||
#print STDERR "DEBUG: num of statusinfos " . scalar %statusinfos . "\n";
|
|
||||||
if (scalar %hardstates ne "0")
|
|
||||||
{
|
|
||||||
#print STDERR "DEBUG: using from cache\n";
|
|
||||||
return(\%hardstates, \%statusinfos);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#print STDERR "DEBUG: fetching info from storage backend\n";
|
|
||||||
#print "DEBUG1: ndo=\"$dbparam{'ndo'}\"\n";
|
|
||||||
if ($dbparam{'ndo'} eq "db")
|
|
||||||
{
|
|
||||||
#print "DEBUG2: ndo=db\n";
|
|
||||||
my $db_prefix = $dbparam{'ndodb_prefix'};
|
|
||||||
|
|
||||||
$dbh = DBI->connect("DBI:mysql:$dbparam{'ndodb_database'}:$dbparam{'ndodb_host'}:$dbparam{'ndodb_port'}", $dbparam{'ndodb_username'}, $dbparam{'ndodb_password'});
|
|
||||||
die "Error: $DBI::errstr\n" unless $dbh;
|
|
||||||
|
|
||||||
#$sql = "select host_name,service_description,last_hard_state,plugin_output from servicestatus";
|
|
||||||
#$sql = "select ${db_prefix}objects.name1,${db_prefix}objects.name2,${db_prefix}servicestatus.current_state,${db_prefix}servicestatus.output from ${db_prefix}objects,${db_prefix}servicestatus where ${db_prefix}objects.objecttype_id=2 and ${db_prefix}objects.is_active=1 and ${db_prefix}objects.object_id=${db_prefix}servicestatus.service_object_id";
|
|
||||||
$sql = "select ${db_prefix}objects.name1,${db_prefix}objects.name2,${db_prefix}servicestatus.last_hard_state,${db_prefix}servicestatus.output from ${db_prefix}objects,${db_prefix}servicestatus where ${db_prefix}objects.objecttype_id=2 and ${db_prefix}objects.is_active=1 and ${db_prefix}objects.object_id=${db_prefix}servicestatus.service_object_id";
|
|
||||||
|
|
||||||
#print STDERR "$sql\n";
|
|
||||||
$sth = $dbh->prepare($sql);
|
|
||||||
die "Error: $DBI::errstr\n" if $DBI::err;
|
|
||||||
|
|
||||||
$sth->execute();
|
|
||||||
die "Error: $DBI::errstr\n" if $DBI::err;
|
|
||||||
|
|
||||||
while (@fields = $sth->fetchrow_array())
|
|
||||||
{
|
|
||||||
#print join("\t", @fields), "\n";
|
|
||||||
$hardstates{"$fields[0];$fields[1]"} = $services_state[$fields[2]] || "UNKNOWN";
|
|
||||||
$statusinfos{"$fields[0];$fields[1]"} = $fields[3];
|
|
||||||
}
|
|
||||||
|
|
||||||
#$sql = "select host_name,host_status,plugin_output from hoststatus";
|
|
||||||
$sql = "select ${db_prefix}objects.name1,${db_prefix}hoststatus.current_state,${db_prefix}hoststatus.output from ${db_prefix}objects,${db_prefix}hoststatus where ${db_prefix}objects.objecttype_id=1 and ${db_prefix}objects.is_active=1 and ${db_prefix}objects.object_id=${db_prefix}hoststatus.host_object_id";
|
|
||||||
#$sql = "select ${db_prefix}objects.name1,${db_prefix}hoststatus.last_hard_state,${db_prefix}hoststatus.output from ${db_prefix}objects,${db_prefix}hoststatus where ${db_prefix}objects.objecttype_id=1 and ${db_prefix}objects.is_active=1 and ${db_prefix}objects.object_id=${db_prefix}hoststatus.host_object_id";
|
|
||||||
|
|
||||||
$sth = $dbh->prepare($sql);
|
|
||||||
die "Error: $DBI::errstr\n" if $DBI::err;
|
|
||||||
|
|
||||||
$sth->execute();
|
|
||||||
die "Error: $DBI::errstr\n" if $DBI::err;
|
|
||||||
|
|
||||||
while (@fields = $sth->fetchrow_array())
|
|
||||||
{
|
|
||||||
#print join("\t", @fields), "\n";
|
|
||||||
$hardstates{"$fields[0];Hoststatus"} = $host_state[$fields[1]] || "UNKNOWN";
|
|
||||||
$statusinfos{"$fields[0];Hoststatus"} = $fields[2];
|
|
||||||
}
|
|
||||||
|
|
||||||
$sth->finish();
|
|
||||||
$dbh->disconnect();
|
|
||||||
}
|
|
||||||
elsif ($dbparam{'ndo'} eq "fs")
|
|
||||||
{
|
|
||||||
#print "DEBUG2: ndo=fs\n";
|
|
||||||
#print "DEBUG: basedir: $dbparam{'ndofs_basedir'}\n";
|
|
||||||
#print "DEBUG: instance: $dbparam{'ndofs_instance_name'}\n\n";
|
|
||||||
|
|
||||||
$servicelist = $dbparam{'ndofs_basedir'} . "/VOLATILE/" . $dbparam{'ndofs_instance_name'} . "/VIEWS/SERVICELIST";
|
|
||||||
$parentdirname="$dbparam{'ndofs_basedir'}/VOLATILE/$dbparam{'ndofs_instance_name'}/HOSTS";
|
|
||||||
|
|
||||||
open (LIST, "<$servicelist") or die "unable to read from file $servicelist\n";
|
|
||||||
flock(LIST, LOCK_SH);
|
|
||||||
|
|
||||||
while ($line = <LIST>)
|
|
||||||
{
|
|
||||||
chomp($line);
|
|
||||||
# print "DEBUG: servicelist: $in\n";
|
|
||||||
# DEBUG: servicelist: "internetconnection":[
|
|
||||||
# DEBUG: servicelist: "Provider 1",
|
|
||||||
# DEBUG: servicelist: "Provider 2"
|
|
||||||
# DEBUG: servicelist: ],
|
|
||||||
if ($line =~ m/"(.+)":\[/)
|
|
||||||
{
|
|
||||||
$hostname = cleanup_for_ndo2fs($1);
|
|
||||||
#print "DEBUG: hostname: $hostname\n";
|
|
||||||
getStatusFromFS($hostname);
|
|
||||||
}
|
|
||||||
if ($line =~ m/"(.+)",?\s*$/)
|
|
||||||
{
|
|
||||||
$servicename = cleanup_for_ndo2fs($1);
|
|
||||||
#print "DEBUG: servicename: $hostname:$servicename\n";
|
|
||||||
getStatusFromFS($hostname, $servicename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
close(LIST);
|
|
||||||
}
|
|
||||||
elsif ($dbparam{'ndo'} eq "merlin")
|
|
||||||
{
|
|
||||||
#print "DEBUG2: ndo=db\n";
|
|
||||||
my $db_prefix = $dbparam{'ndodb_prefix'};
|
|
||||||
|
|
||||||
$dbh = DBI->connect("DBI:mysql:$dbparam{'ndodb_database'}:$dbparam{'ndodb_host'}:$dbparam{'ndodb_port'}", $dbparam{'ndodb_username'}, $dbparam{'ndodb_password'});
|
|
||||||
die "Error: $DBI::errstr\n" unless $dbh;
|
|
||||||
|
|
||||||
#$sql = "select host_name,service_description,last_hard_state,plugin_output from servicestatus";
|
|
||||||
#$sql = "select ${db_prefix}objects.name1,${db_prefix}objects.name2,${db_prefix}servicestatus.last_hard_state,${db_prefix}servicestatus.output from ${db_prefix}objects,${db_prefix}servicestatus where ${db_prefix}objects.objecttype_id=2 and ${db_prefix}objects.is_active=1 and ${db_prefix}objects.object_id=${db_prefix}servicestatus.service_object_id";
|
|
||||||
$sql = "select host_name,service_description,last_hard_state,output from service";
|
|
||||||
|
|
||||||
#print STDERR "$sql\n";
|
|
||||||
$sth = $dbh->prepare($sql);
|
|
||||||
die "Error: $DBI::errstr\n" if $DBI::err;
|
|
||||||
|
|
||||||
$sth->execute();
|
|
||||||
die "Error: $DBI::errstr\n" if $DBI::err;
|
|
||||||
|
|
||||||
while (@fields = $sth->fetchrow_array())
|
|
||||||
{
|
|
||||||
#print join("\t", @fields), "\n";
|
|
||||||
$hardstates{"$fields[0];$fields[1]"} = $services_state[$fields[2]] || "UNKNOWN";
|
|
||||||
$statusinfos{"$fields[0];$fields[1]"} = $fields[3];
|
|
||||||
}
|
|
||||||
|
|
||||||
#$sql = "select host_name,host_status,plugin_output from hoststatus";
|
|
||||||
#$sql = "select ${db_prefix}objects.name1,${db_prefix}hoststatus.current_state,${db_prefix}hoststatus.output from ${db_prefix}objects,${db_prefix}hoststatus where ${db_prefix}objects.objecttype_id=1 and ${db_prefix}objects.is_active=1 and ${db_prefix}objects.object_id=${db_prefix}hoststatus.host_object_id";
|
|
||||||
#$sql = "select host_name,last_hard_state,output from host";
|
|
||||||
$sql = "select host_name,current_state,output from host";
|
|
||||||
|
|
||||||
$sth = $dbh->prepare($sql);
|
|
||||||
die "Error: $DBI::errstr\n" if $DBI::err;
|
|
||||||
|
|
||||||
$sth->execute();
|
|
||||||
die "Error: $DBI::errstr\n" if $DBI::err;
|
|
||||||
|
|
||||||
while (@fields = $sth->fetchrow_array())
|
|
||||||
{
|
|
||||||
#print join("\t", @fields), "\n";
|
|
||||||
$hardstates{"$fields[0];Hoststatus"} = $host_state[$fields[1]] || "UNKNOWN";
|
|
||||||
$statusinfos{"$fields[0];Hoststatus"} = $fields[2];
|
|
||||||
}
|
|
||||||
|
|
||||||
$sth->finish();
|
|
||||||
$dbh->disconnect();
|
|
||||||
}
|
|
||||||
elsif ($dbparam{'ndo'} eq "mk_livestatus")
|
|
||||||
{
|
|
||||||
$socket = IO::Socket::UNIX->new ("Peer" => $dbparam{'ndo_livestatus_socket'}, "Type" => SOCK_STREAM, "Timeout" => 15) or die "unable to connect to unix socket \"" . $dbparam{'ndo_livestatus_socket'} . "\": $!\n";
|
|
||||||
|
|
||||||
print $socket "GET services\n";
|
|
||||||
print $socket "Columns: host_name description last_hard_state plugin_output\n\n";
|
|
||||||
|
|
||||||
while ($in = <$socket>)
|
|
||||||
{
|
|
||||||
chomp($in);
|
|
||||||
#print STDERR "DEBUG: $in\n";
|
|
||||||
|
|
||||||
@fields = split(/;/, $in);
|
|
||||||
$hardstates{"$fields[0];$fields[1]"} = $services_state[$fields[2]] || "UNKNOWN";
|
|
||||||
$statusinfos{"$fields[0];$fields[1]"} = $fields[3];
|
|
||||||
}
|
|
||||||
|
|
||||||
$socket = IO::Socket::UNIX->new ("Peer" => $dbparam{'ndo_livestatus_socket'}, "Type" => SOCK_STREAM, "Timeout" => 15) or die "unable to connect to unix socket \"" . $dbparam{'ndo_livestatus_socket'} . "\": $!\n";
|
|
||||||
|
|
||||||
print $socket "GET hosts\n";
|
|
||||||
print $socket "Columns: name state plugin_output\n\n";
|
|
||||||
|
|
||||||
while ($in = <$socket>)
|
|
||||||
{
|
|
||||||
chomp($in);
|
|
||||||
#print STDERR "DEBUG: $in\n";
|
|
||||||
|
|
||||||
@fields = split(/;/, $in);
|
|
||||||
$hardstates{"$fields[0];Hoststatus"} = $host_state[$fields[1]] || "UNKNOWN";
|
|
||||||
$statusinfos{"$fields[0];Hoststatus"} = $fields[2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elsif ($dbparam{'ndo'} eq "icinga-web")
|
|
||||||
{
|
|
||||||
#print "DEBUG2: ndo=icinga-web\n";
|
|
||||||
my $maxConnectionTime = 10;
|
|
||||||
#print STDERR "URL prefix: " . $dbparam{'ndo_icinga_web_url_prefix'} . "\n";
|
|
||||||
if(substr($dbparam{'ndo_icinga_web_url_prefix'}, -1) eq "/")
|
|
||||||
{
|
|
||||||
$dbparam{'ndo_icinga_web_url_prefix'} = substr($dbparam{'ndo_icinga_web_url_prefix'}, 0, length($dbparam{'ndo_icinga_web_url_prefix'}) -1);
|
|
||||||
}
|
|
||||||
#print STDERR "URL prefix: " . $dbparam{'ndo_icinga_web_url_prefix'} . "\n";
|
|
||||||
my $services_url = $dbparam{'ndo_icinga_web_url_prefix'} . "/web/api/service/columns%5BSERVICE_NAME%7CHOST_NAME%7CSERVICE_LAST_HARD_STATE%7CSERVICE_OUTPUT%5D/authkey=" . $dbparam{'ndo_icinga_web_auth_key'} . "/json";
|
|
||||||
my $hosts_url = $dbparam{'ndo_icinga_web_url_prefix'} . "/web/api/host/columns%5BHOST_NAME%7CHOST_CURRENT_STATE%7CHOST_OUTPUT%5D/authkey=" . $dbparam{'ndo_icinga_web_auth_key'} . "/json";
|
|
||||||
my ($ua, $request, $result, $content);
|
|
||||||
|
|
||||||
#print STDERR "URL: $services_url\n";
|
|
||||||
$ua = new LWP::UserAgent ( 'timeout' => $maxConnectionTime );
|
|
||||||
$request = new HTTP::Request ('GET' => "$services_url");
|
|
||||||
$result = $ua->request($request);
|
|
||||||
#print STDERR "Response Services: " . $result->code() . " " . $result->message() . "\n";
|
|
||||||
|
|
||||||
if ($result->code() >= 400)
|
|
||||||
{
|
|
||||||
die "Error when requesting service information from icinga API, response code: " . $result->code() . ", message: " . $result->message() . "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
$content = $result->decoded_content();
|
|
||||||
$content =~ s/\r\n/\n/g;
|
|
||||||
#print STDERR "Content: $content\n";
|
|
||||||
|
|
||||||
$jsonref = decode_json($content);
|
|
||||||
|
|
||||||
#print "DEBUG: $jsonref\n";
|
|
||||||
#print "DEBUG: " . Dumper($jsonref) . "\n";
|
|
||||||
#print "DEBUG ref: " . ref($jsonref) . "\n";
|
|
||||||
if (ref($jsonref) eq "HASH" && defined $jsonref->{'error'})
|
|
||||||
{
|
|
||||||
die "Error when requesting service information from icinga API, message: $jsonref->{'error'}->[0]->{'message'}\nerrors: $jsonref->{'error'}->[0]->{'errors'}->[0]\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach $subhash (@$jsonref)
|
|
||||||
{
|
|
||||||
#print "\nDEBUG subhash: $subhash\n";
|
|
||||||
#print "DEBUG service: $subhash->{'HOST_NAME'};$subhash->{'SERVICE_NAME'} = $services_state[$subhash->{'SERVICE_LAST_HARD_STATE'}]\n";
|
|
||||||
#SERVICE_LAST_HARD_STATE
|
|
||||||
#SERVICE_NAME
|
|
||||||
#HOST_NAME
|
|
||||||
$hardstates{"$subhash->{'HOST_NAME'};$subhash->{'SERVICE_NAME'}"} = $services_state[$subhash->{'SERVICE_LAST_HARD_STATE'}] || "UNKNOWN";
|
|
||||||
$statusinfos{"$subhash->{'HOST_NAME'};$subhash->{'SERVICE_NAME'}"} = $subhash->{'SERVICE_OUTPUT'}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#print STDERR "URL: $hosts_url\n";
|
|
||||||
$request = new HTTP::Request ('GET' => "$hosts_url");
|
|
||||||
$result = $ua->request($request);
|
|
||||||
#print STDERR "Response Hosts: " . $result->code() . " " . $result->message() . "\n";
|
|
||||||
|
|
||||||
if ($result->code() >= 400)
|
|
||||||
{
|
|
||||||
die "Error when requesting host information from icinga API, response code: " . $result->code() . ", message: " . $result->message() . "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
$content = $result->decoded_content();
|
|
||||||
$content =~ s/\r\n/\n/g;
|
|
||||||
#print STDERR "Content: $content\n";
|
|
||||||
|
|
||||||
$jsonref = decode_json($content);
|
|
||||||
|
|
||||||
#print "DEBUG: $jsonref\n";
|
|
||||||
#print "DEBUG: " . Dumper($jsonref) . "\n";
|
|
||||||
if (ref($jsonref) eq "HASH" && defined $jsonref->{'error'})
|
|
||||||
{
|
|
||||||
die "Error when requesting host information from icinga API, message: $jsonref->{'error'}->[0]->{'message'}\nerrors: $jsonref->{'error'}->[0]->{'errors'}->[0]\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach $subhash (@$jsonref)
|
|
||||||
{
|
|
||||||
#print "DEBUG subhash: $subhash\n";
|
|
||||||
#print "DEBUG host: $subhash->{'HOST_NAME'};Hoststatus = $services_state[$subhash->{'HOST_CURRENT_STATE'}]\n";
|
|
||||||
#HOST_NAME
|
|
||||||
#HOST_CURRENT_STATE
|
|
||||||
#HOST_OUTPUT
|
|
||||||
$hardstates{"$subhash->{'HOST_NAME'};Hoststatus"} = $host_state[$subhash->{'HOST_CURRENT_STATE'}] || "UNKNOWN";
|
|
||||||
$statusinfos{"$subhash->{'HOST_NAME'};Hoststatus"} = $subhash->{'HOST_OUTPUT'}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($dbparam{'cache_time'} > 0)
|
|
||||||
{
|
|
||||||
updateCache(\%hardstates, \%statusinfos);
|
|
||||||
}
|
|
||||||
return(\%hardstates, \%statusinfos);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub getLastUpdateServiceStatus()
|
|
||||||
{
|
|
||||||
my %dbparam = &getDbParam();
|
|
||||||
my ($db_prefix, $return, $socket);
|
|
||||||
|
|
||||||
if ($dbparam{'ndo'} eq "db")
|
|
||||||
{
|
|
||||||
$db_prefix = $dbparam{'ndodb_prefix'};
|
|
||||||
$dbh = DBI->connect("DBI:mysql:$dbparam{'ndodb_database'}:$dbparam{'ndodb_host'}:$dbparam{'ndodb_port'}", $dbparam{'ndodb_username'}, $dbparam{'ndodb_password'});
|
|
||||||
die "Error: $DBI::errstr\n" unless $dbh;
|
|
||||||
|
|
||||||
$sql = "select max(last_check) from ${db_prefix}servicestatus";
|
|
||||||
|
|
||||||
$sth = $dbh->prepare($sql);
|
|
||||||
die "Error: $DBI::errstr\n" if $DBI::err;
|
|
||||||
|
|
||||||
$sth->execute();
|
|
||||||
die "Error: $DBI::errstr\n" if $DBI::err;
|
|
||||||
|
|
||||||
while (@fields = $sth->fetchrow_array())
|
|
||||||
{
|
|
||||||
#print join("\t", @fields), "\n";
|
|
||||||
$return = $fields[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
$sth->finish();
|
|
||||||
$dbh->disconnect();
|
|
||||||
}
|
|
||||||
elsif ($dbparam{'ndo'} eq "fs")
|
|
||||||
{
|
|
||||||
$servicelist = $dbparam{'ndofs_basedir'} . "/VOLATILE/" . $dbparam{'ndofs_instance_name'} . "/VIEWS/SERVICELIST";
|
|
||||||
$parentdirname="$dbparam{'ndofs_basedir'}/VOLATILE/$dbparam{'ndofs_instance_name'}/HOSTS";
|
|
||||||
|
|
||||||
open (LIST, "<$servicelist") or die "unable to read from file $servicelist\n";
|
|
||||||
flock(LIST, LOCK_SH);
|
|
||||||
|
|
||||||
while ($line = <LIST>)
|
|
||||||
{
|
|
||||||
chomp($line);
|
|
||||||
# print "DEBUG: servicelist: $in\n";
|
|
||||||
# DEBUG: servicelist: "internetconnection":[
|
|
||||||
# DEBUG: servicelist: "Provider 1",
|
|
||||||
# DEBUG: servicelist: "Provider 2"
|
|
||||||
# DEBUG: servicelist: ],
|
|
||||||
if ($line =~ m/"(.+)":\[/)
|
|
||||||
{
|
|
||||||
$hostname = cleanup_for_ndo2fs($1);
|
|
||||||
#print "DEBUG: hostname: $hostname\n";
|
|
||||||
}
|
|
||||||
if ($line =~ m/"(.+)",?\s*$/)
|
|
||||||
{
|
|
||||||
$servicename = cleanup_for_ndo2fs($1);
|
|
||||||
#print "DEBUG: servicename: $hostname:$servicename\n";
|
|
||||||
|
|
||||||
if (-e "$parentdirname/$hostname/$servicename/STATUS")
|
|
||||||
{
|
|
||||||
open (IN, "<$parentdirname/$hostname/$servicename/STATUS") or die "unable to read file $parentdirname/$hostname/$servicename/STATUS: $!\n";
|
|
||||||
flock(IN, LOCK_SH);
|
|
||||||
while ($in = <IN>)
|
|
||||||
{
|
|
||||||
if ($in =~ m/"LASTSERVICECHECK":\s*"(.*)"/)
|
|
||||||
{
|
|
||||||
#print "$1\n";
|
|
||||||
if ($1 > $lastservicecheck)
|
|
||||||
{
|
|
||||||
$lastservicecheck = $1;
|
|
||||||
#print "$lastservicecheck\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
close(IN);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
close(LIST);
|
|
||||||
|
|
||||||
@lastservicecheck_local = localtime($lastservicecheck);
|
|
||||||
$lastservicecheck_local[5]+=1900;
|
|
||||||
$lastservicecheck_local[4] = sprintf("%02d", ++$lastservicecheck_local[4]);
|
|
||||||
$lastservicecheck_local[3] = sprintf("%02d", $lastservicecheck_local[3]);
|
|
||||||
$lastservicecheck_local[2] = sprintf("%02d", $lastservicecheck_local[2]);
|
|
||||||
$lastservicecheck_local[1] = sprintf("%02d", $lastservicecheck_local[1]);
|
|
||||||
$lastservicecheck_local[0] = sprintf("%02d", $lastservicecheck_local[0]);
|
|
||||||
|
|
||||||
$return = "$lastservicecheck_local[5]-$lastservicecheck_local[4]-$lastservicecheck_local[3] $lastservicecheck_local[2]:$lastservicecheck_local[1]:$lastservicecheck_local[0]";
|
|
||||||
}
|
|
||||||
elsif ($dbparam{'ndo'} eq "merlin")
|
|
||||||
{
|
|
||||||
$db_prefix = $dbparam{'ndodb_prefix'};
|
|
||||||
$dbh = DBI->connect("DBI:mysql:$dbparam{'ndodb_database'}:$dbparam{'ndodb_host'}:$dbparam{'ndodb_port'}", $dbparam{'ndodb_username'}, $dbparam{'ndodb_password'});
|
|
||||||
die "Error: $DBI::errstr\n" unless $dbh;
|
|
||||||
|
|
||||||
#$sql = "select max(last_check) from ${db_prefix}service";
|
|
||||||
$sql = "select max(last_check) from service";
|
|
||||||
|
|
||||||
$sth = $dbh->prepare($sql);
|
|
||||||
die "Error: $DBI::errstr\n" if $DBI::err;
|
|
||||||
|
|
||||||
$sth->execute();
|
|
||||||
die "Error: $DBI::errstr\n" if $DBI::err;
|
|
||||||
|
|
||||||
while (@fields = $sth->fetchrow_array())
|
|
||||||
{
|
|
||||||
#print join("\t", @fields), "\n";
|
|
||||||
$return = $fields[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
$sth->finish();
|
|
||||||
$dbh->disconnect();
|
|
||||||
}
|
|
||||||
elsif ($dbparam{'ndo'} eq "mk_livestatus")
|
|
||||||
{
|
|
||||||
$socket = IO::Socket::UNIX->new ("Peer" => $dbparam{'ndo_livestatus_socket'}, "Type" => SOCK_STREAM, "Timeout" => 15) or die "unable to connect to unix socket \"" . $dbparam{'ndo_livestatus_socket'} . "\": $!\n";
|
|
||||||
|
|
||||||
print $socket "GET services\n";
|
|
||||||
print $socket "Stats: max last_check\n\n";
|
|
||||||
|
|
||||||
$return = <$socket> || 0;
|
|
||||||
chomp($return);
|
|
||||||
#print STDERR "DEBUG: $return\n";
|
|
||||||
}
|
|
||||||
elsif ($dbparam{'ndo'} eq "icinga-web")
|
|
||||||
{
|
|
||||||
$return = 0;
|
|
||||||
my $maxConnectionTime = 10;
|
|
||||||
my ($ua, $request, $result, $content);
|
|
||||||
if(substr($dbparam{'ndo_icinga_web_url_prefix'}, -1) eq "/")
|
|
||||||
{
|
|
||||||
$dbparam{'ndo_icinga_web_url_prefix'} = substr($dbparam{'ndo_icinga_web_url_prefix'}, 0, length($dbparam{'ndo_icinga_web_url_prefix'}) -1);
|
|
||||||
}
|
|
||||||
my $services_url = $dbparam{'ndo_icinga_web_url_prefix'} . "/web/api/service/columns%5BSERVICE_LAST_CHECK%5D/authkey=" . $dbparam{'ndo_icinga_web_auth_key'} . "/json";
|
|
||||||
|
|
||||||
#print STDERR "URL: $services_url\n";
|
|
||||||
$ua = new LWP::UserAgent ( 'timeout' => $maxConnectionTime );
|
|
||||||
$request = new HTTP::Request ('GET' => "$services_url");
|
|
||||||
$result = $ua->request($request);
|
|
||||||
|
|
||||||
if ($result->code() >= 400)
|
|
||||||
{
|
|
||||||
die "Error when requesting service information from icinga API, response code: " . $result->code() . ", message: " . $result->message() . "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
#print STDERR "Response Services: " . $result->code() . " " . $result->message() . "\n";
|
|
||||||
$content = $result->decoded_content();
|
|
||||||
$content =~ s/\r\n/\n/g;
|
|
||||||
#print STDERR "Content: $content\n";
|
|
||||||
|
|
||||||
$jsonref = decode_json($content);
|
|
||||||
|
|
||||||
#print "DEBUG: $jsonref\n";
|
|
||||||
#print "DEBUG: " . Dumper($jsonref) . "\n";
|
|
||||||
foreach $subhash (@$jsonref)
|
|
||||||
{
|
|
||||||
#print "DEBUG update: $subhash->{'SERVICE_LAST_CHECK'}\n";
|
|
||||||
if ($subhash->{'SERVICE_LAST_CHECK'} gt $return)
|
|
||||||
{
|
|
||||||
$return = $subhash->{'SERVICE_LAST_CHECK'};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return($return);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub getDbParam()
|
|
||||||
{
|
|
||||||
my (%dbparam, $in, $param, $value);
|
|
||||||
|
|
||||||
open(IN, "<$dbConfigFile") or die "unable to read $dbConfigFile\n";
|
|
||||||
while ($in = <IN>)
|
|
||||||
{
|
|
||||||
if ($in =~ m/^\s*(ndodb_\w+|ndofs_\w+|ndo_livestatus_\w+|ndo_icinga_web_\w+|ndo|cache_\w+)\s*=/)
|
|
||||||
{
|
|
||||||
($param, $value) = split(/=/, $in);
|
|
||||||
chomp($value);
|
|
||||||
$value =~ s/^\s+//;
|
|
||||||
$value =~ s/\s+$//;
|
|
||||||
$param =~ s/^\s+//;
|
|
||||||
$param =~ s/\s+$//;
|
|
||||||
$dbparam{$param} = $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
close(IN);
|
|
||||||
|
|
||||||
# set defaults, if we did not get values form config
|
|
||||||
$dbparam{'ndo'}="db" if ($dbparam{'ndo'} eq "");
|
|
||||||
$dbparam{'ndofs_basedir'}="/tmp/ndo2fs" if ($dbparam{'ndofs_basedir'} eq "");
|
|
||||||
$dbparam{'ndofs_instance_name'}="default" if ($dbparam{'ndofs_instance_name'} eq "");
|
|
||||||
$dbparam{'ndodb_host'}="localhost" if ($dbparam{'ndodb_host'} eq "");
|
|
||||||
$dbparam{'ndodb_port'}="3306" if ($dbparam{'ndodb_port'} eq "");
|
|
||||||
$dbparam{'ndodb_database'}="nagios" if ($dbparam{'ndodb_database'} eq "");
|
|
||||||
$dbparam{'cache_time'}=0 if ($dbparam{'cache_time'} !~ m/^\d+$/);
|
|
||||||
$dbparam{'cache_file'}="/tmp/ndo_backend_cache" if ($dbparam{'cache_file'} eq "");
|
|
||||||
|
|
||||||
return (%dbparam);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub getStatusFromFS()
|
|
||||||
{
|
|
||||||
# gets one parameter (hostname) to determine the host status
|
|
||||||
# gets two parameters (hostname and servicename) to determine the service status
|
|
||||||
my $host = shift;
|
|
||||||
my $service = shift || "Hoststatus";
|
|
||||||
|
|
||||||
if ($service eq "Hoststatus")
|
|
||||||
{
|
|
||||||
if (-e "$parentdirname/$host/STATUS")
|
|
||||||
{
|
|
||||||
open (IN, "<$parentdirname/$host/STATUS") or die "unable to read file $parentdirname/$host/STATUS: $!\n";
|
|
||||||
flock(IN, LOCK_SH);
|
|
||||||
|
|
||||||
while($in = <IN>)
|
|
||||||
{
|
|
||||||
#print "DEBUG: $in";
|
|
||||||
if ($in =~ m/"CURRENTSTATE":\s*"(.*)"/)
|
|
||||||
{
|
|
||||||
#print "DEBUG: LASTHARDSTATE: $1\n";
|
|
||||||
$currentstate = $1;
|
|
||||||
}
|
|
||||||
if ($in =~ m/"OUTPUT":\s*"(.*)"/)
|
|
||||||
{
|
|
||||||
#print "DEBUG: OUTPUT: $1\n";
|
|
||||||
$output = $1;
|
|
||||||
}
|
|
||||||
if ($in =~ m/"HOST":\s*"(.*)"/)
|
|
||||||
{
|
|
||||||
#print "DEBUG: HOST: $1\n";
|
|
||||||
$hostname = $1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
close(IN);
|
|
||||||
$hardstates{"$hostname;Hoststatus"} = $host_state[$currentstate] || "UNKNOWN";
|
|
||||||
$statusinfos{"$hostname;Hoststatus"} = $output;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$hardstates{"$hostname;Hoststatus"} = "PENDING";
|
|
||||||
$statusinfos{"$hostname;Hoststatus"} = "";
|
|
||||||
}
|
|
||||||
#print "DEBUG: $host;Hoststatus: $host_state[$currentstate]\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (-e "$parentdirname/$host/$service/STATUS")
|
|
||||||
{
|
|
||||||
open (IN, "<$parentdirname/$host/$service/STATUS") or die "unable to read file $parentdirname/$host/$service/STATUS: $!\n";
|
|
||||||
flock(IN, LOCK_SH);
|
|
||||||
|
|
||||||
while($in = <IN>)
|
|
||||||
{
|
|
||||||
#print "DEBUG: $in";
|
|
||||||
# "OUTPUT": "OK: DNS",
|
|
||||||
# "LASTHARDSTATE": "0",
|
|
||||||
# "SERVICE": "System Check",
|
|
||||||
if ($in =~ m/"LASTHARDSTATE":\s*"(.*)"/)
|
|
||||||
{
|
|
||||||
#print "DEBUG: LASTHARDSTATE: $1\n";
|
|
||||||
$lasthardstate = $1;
|
|
||||||
}
|
|
||||||
if ($in =~ m/"OUTPUT":\s*"(.*)"/)
|
|
||||||
{
|
|
||||||
#print "DEBUG: OUTPUT: $1\n";
|
|
||||||
$output = $1;
|
|
||||||
}
|
|
||||||
if ($in =~ m/"SERVICE":\s*"(.*)"/)
|
|
||||||
{
|
|
||||||
#print "DEBUG: SERVICE: $1\n";
|
|
||||||
$servicename = $1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
close(IN);
|
|
||||||
$hardstates{"$host;$servicename"} = $services_state[$lasthardstate] || "UNKNOWN";
|
|
||||||
$statusinfos{"$host;$servicename"} = $output;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$hardstates{"$host;$servicename"} = "PENDING";
|
|
||||||
$statusinfos{"$host;$servicename"} = "";
|
|
||||||
}
|
|
||||||
#print "DEBUG: $host;$servicename: $host_state[$currentstate]\n";
|
|
||||||
}
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub cleanup_for_ndo2fs {
|
|
||||||
my $host_or_service_name = shift;
|
|
||||||
$host_or_service_name =~ s/[ :\/\\]/_/g;
|
|
||||||
return($host_or_service_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub checkCache()
|
|
||||||
{
|
|
||||||
my %dbparam = &getDbParam();
|
|
||||||
my $actDate=time();
|
|
||||||
my ($fileAge, @stat, $in, @tokens, $host, $service, $hardstate);
|
|
||||||
|
|
||||||
if ( -f $dbparam{'cache_file'} )
|
|
||||||
{
|
|
||||||
# ok, we have a cache file already
|
|
||||||
# print STDERR "cache_file exists\n";
|
|
||||||
@stat=stat($dbparam{'cache_file'});
|
|
||||||
$fileAge=$actDate-$stat[9];
|
|
||||||
# print STDERR "actDate: $actDate\n";
|
|
||||||
# print STDERR "FileModificationDate: $stat[9]\n";
|
|
||||||
# print STDERR "FileAge: $fileAge\n";
|
|
||||||
|
|
||||||
if ($fileAge <= $dbparam{'cache_time'})
|
|
||||||
{
|
|
||||||
# print STDERR "cache_file new enough, delivering from cache\n";
|
|
||||||
open(IN, "<$dbparam{'cache_file'}") or die "unable to read cachefile $dbparam{'cache_file'}\n";
|
|
||||||
flock(IN, LOCK_SH);
|
|
||||||
while ($in = <IN>)
|
|
||||||
{
|
|
||||||
@tokens=split(/;/, $in);
|
|
||||||
$host=shift(@tokens);
|
|
||||||
$service=shift(@tokens);
|
|
||||||
$hardstate=shift(@tokens);
|
|
||||||
$hardstates{"$host;$service"} = $hardstate;
|
|
||||||
$statusinfos{"$host;$service"} = join(/;/, @tokens);
|
|
||||||
chomp($statusinfos{"$host;$service"});
|
|
||||||
}
|
|
||||||
close(IN);
|
|
||||||
return(\%hardstates, \%statusinfos);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
# print STDERR "cache_file too old\n";
|
|
||||||
return('');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
# print STDERR "cache_file does not exist\n";
|
|
||||||
return('');
|
|
||||||
}
|
|
||||||
|
|
||||||
return('');
|
|
||||||
}
|
|
||||||
|
|
||||||
# call with parameters \%hardstates, \%statusinfos
|
|
||||||
sub updateCache()
|
|
||||||
{
|
|
||||||
my %dbparam = &getDbParam();
|
|
||||||
my $key;
|
|
||||||
my $actDate=time();
|
|
||||||
my @stat=stat($dbparam{'cache_file'});
|
|
||||||
my $fileAge=$actDate-$stat[9];
|
|
||||||
# print STDERR "actDate: $actDate\n";
|
|
||||||
# print STDERR "FileModificationDate: $stat[9]\n";
|
|
||||||
# print STDERR "FileAge: $fileAge\n";
|
|
||||||
|
|
||||||
if ($fileAge > $dbparam{'cache_time'})
|
|
||||||
{
|
|
||||||
# print STDERR "DEBUG: writing cache_file\n";
|
|
||||||
#print "DEBUG: hardstates\n";
|
|
||||||
#printHash(\%hardstates);
|
|
||||||
#print "DEBUG: statusinfos\n";
|
|
||||||
#printHash(\%statusinfos);
|
|
||||||
umask ("0000");
|
|
||||||
open (OUT, ">$dbparam{'cache_file'}") or die "unable to write to $dbparam{'cache_file'}\n";
|
|
||||||
flock(OUT, LOCK_EX);
|
|
||||||
foreach $key (keys %hardstates)
|
|
||||||
{
|
|
||||||
print OUT "$key;$hardstates{$key};$statusinfos{$key}\n";
|
|
||||||
}
|
|
||||||
close (OUT);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#{
|
|
||||||
# print STDERR "DEBUG: someone else did write meanwile\n";
|
|
||||||
#}
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
# Nagios Business Process View and Nagios Business Process Analysis
|
|
||||||
# Copyright (C) 2003-2010 Sparda-Datenverarbeitung eG, Nuernberg, Germany
|
|
||||||
# Bernd Stroessreuther <berny1@users.sourceforge.net>
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; version 2 of the License.
|
|
||||||
#
|
|
||||||
# This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
|
|
||||||
package settings;
|
|
||||||
|
|
||||||
use Exporter;
|
|
||||||
use strict;
|
|
||||||
use lib ('@libdir@');
|
|
||||||
use bsutils;
|
|
||||||
our @ISA = qw(Exporter);
|
|
||||||
our @EXPORT = qw(getSettings getVersion);
|
|
||||||
|
|
||||||
my $settingsConf = "@sysconfdir@/settings.cfg";
|
|
||||||
my ($in, %settings, $var, $value);
|
|
||||||
|
|
||||||
sub getSettings()
|
|
||||||
{
|
|
||||||
#print "DEBUG: Start of config\n";
|
|
||||||
open(IN, "<$settingsConf") or die "unable to read file $settingsConf\n";
|
|
||||||
while ($in = <IN>)
|
|
||||||
{
|
|
||||||
if ($in !~ m/(^\s*$|^\s*#)/)
|
|
||||||
{
|
|
||||||
#print "DEBUG: $in";
|
|
||||||
chomp($in);
|
|
||||||
($var, $value) = split(/=/, $in);
|
|
||||||
$var = cutOffSpaces($var);
|
|
||||||
$value = cutOffSpaces($value);
|
|
||||||
#print "DEBUG: var \"$var\"\n";
|
|
||||||
#print "DEBUG: value \"$value\"\n";
|
|
||||||
$settings{$var}=$value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
close(IN);
|
|
||||||
#print "DEBUG: End of config\n";
|
|
||||||
return(\%settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub getVersion() { return("0.9.6"); }
|
|
||||||
|
|
||||||
1;
|
|
@ -1,28 +0,0 @@
|
|||||||
prefix=@prefix@
|
|
||||||
exec_prefix=@exec_prefix@
|
|
||||||
LOGDIR=@localstatedir@
|
|
||||||
CFGDIR=@sysconfdir@
|
|
||||||
BINDIR=@bindir@
|
|
||||||
CGIDIR=@sbindir@
|
|
||||||
DATAROOTDIR=@datarootdir@
|
|
||||||
LIBEXECDIR=@libexecdir@
|
|
||||||
|
|
||||||
INSTALL=@INSTALL@
|
|
||||||
INSTALL_OPTS=@INSTALL_OPTS@
|
|
||||||
|
|
||||||
CP=@CP@
|
|
||||||
|
|
||||||
all html:
|
|
||||||
|
|
||||||
clean:
|
|
||||||
-rm check_bp_status.pl
|
|
||||||
|
|
||||||
distclean: clean
|
|
||||||
-rm Makefile
|
|
||||||
|
|
||||||
devclean: distclean
|
|
||||||
|
|
||||||
install:
|
|
||||||
$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(LIBEXECDIR)
|
|
||||||
$(INSTALL) -m 755 $(INSTALL_OPTS) check_bp_status.pl $(LIBEXECDIR)
|
|
||||||
|
|
@ -1,150 +0,0 @@
|
|||||||
#!@PERL@
|
|
||||||
|
|
||||||
# Nagios Business Process View and Nagios Business Process Analysis
|
|
||||||
# Copyright (C) 2003-2010 Sparda-Datenverarbeitung eG, Nuernberg, Germany
|
|
||||||
# Bernd Stroessreuther <berny1@users.sourceforge.net>
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; version 2 of the License.
|
|
||||||
#
|
|
||||||
# This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
|
|
||||||
#Load modules
|
|
||||||
use lib ('@libdir@');
|
|
||||||
#require a good programming
|
|
||||||
use strict;
|
|
||||||
#db connection module
|
|
||||||
use DBI;
|
|
||||||
#functions for getting states from the ndo database
|
|
||||||
use ndodb;
|
|
||||||
#functions for parsing nagios_bp_config file
|
|
||||||
use nagiosBp;
|
|
||||||
#get installation specific parameters: path variables and so on
|
|
||||||
use settings;
|
|
||||||
|
|
||||||
|
|
||||||
#some Variables
|
|
||||||
my $settings = getSettings();
|
|
||||||
my %state_to_rc = ( "OK" => 0, "WARNING" => 1, "CRITICAL" => 2, "UNKNOWN" => 3);
|
|
||||||
my $timeout = 10;
|
|
||||||
|
|
||||||
my ($nagios_bp_conf, $bp, $hardstates, $statusinfos, $display, $display_status, $script_out, $info_url, $components, $key, $i);
|
|
||||||
|
|
||||||
|
|
||||||
#get command line parameters
|
|
||||||
if (@ARGV == 1 && $ARGV[0] !~ m/^-/)
|
|
||||||
{
|
|
||||||
# old style of calling this plugin
|
|
||||||
# $0 <BusinessProcess>
|
|
||||||
$bp = $ARGV[0];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for ($i=0; $i<@ARGV; $i++)
|
|
||||||
{
|
|
||||||
if ($ARGV[$i] eq "-b") { $bp = $ARGV[++$i] }
|
|
||||||
if ($ARGV[$i] eq "-f") { $nagios_bp_conf = $ARGV[++$i] }
|
|
||||||
if ($ARGV[$i] eq "-h" || $ARGV[$i] eq "--help") { help() }
|
|
||||||
if ($ARGV[$i] eq "-V" || $ARGV[$i] eq "--version") { version() }
|
|
||||||
if ($ARGV[$i] eq "-t" || $ARGV[$i] eq "--timeout") { $timeout = $ARGV[++$i] }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# missing parameters
|
|
||||||
help("You did not give any parameters!\n") if ($bp eq "");
|
|
||||||
|
|
||||||
# timeout
|
|
||||||
$SIG{ALRM} = sub
|
|
||||||
{
|
|
||||||
print "The plugin execution timed out\n";
|
|
||||||
exit(3);
|
|
||||||
};
|
|
||||||
alarm($timeout);
|
|
||||||
|
|
||||||
# defaults
|
|
||||||
if ($nagios_bp_conf eq "")
|
|
||||||
{
|
|
||||||
$nagios_bp_conf = "$settings->{'NAGIOSBP_ETC'}/nagios-bp.conf";
|
|
||||||
}
|
|
||||||
elsif ($nagios_bp_conf !~ m#^/#)
|
|
||||||
{
|
|
||||||
$nagios_bp_conf = "$settings->{'NAGIOSBP_ETC'}/$nagios_bp_conf";
|
|
||||||
}
|
|
||||||
|
|
||||||
#read the status data from the db
|
|
||||||
($hardstates, $statusinfos) = &getStates();
|
|
||||||
#foreach $key (keys %$hardstates)
|
|
||||||
#{
|
|
||||||
# print "$key $hardstates->{$key}\n";
|
|
||||||
#}
|
|
||||||
|
|
||||||
#parse nagios-bp.conf (our own config file)
|
|
||||||
($display, $display_status, $script_out, $info_url, $components) = &getBPs($nagios_bp_conf, $hardstates, "false");
|
|
||||||
|
|
||||||
# timeout test
|
|
||||||
#for ($i=0; $i<500; $i++)
|
|
||||||
#{
|
|
||||||
# system("cat /var/log/messages >/dev/null");
|
|
||||||
# print "$i ";
|
|
||||||
#}
|
|
||||||
|
|
||||||
# reset timeout
|
|
||||||
alarm(0);
|
|
||||||
|
|
||||||
# evaluating business process
|
|
||||||
if ($hardstates->{$bp} eq "" || $display->{$bp} eq "")
|
|
||||||
{
|
|
||||||
print "Business Process UNKNOWN: Business Process $bp is not defined\n";
|
|
||||||
exit(3);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print "Business Process $hardstates->{$bp}: $display->{$bp}\n";
|
|
||||||
exit($state_to_rc{$hardstates->{$bp}});
|
|
||||||
}
|
|
||||||
|
|
||||||
# online help
|
|
||||||
sub help
|
|
||||||
{
|
|
||||||
# 1 2 3 4 5 6 7 8
|
|
||||||
# 12345678901234567890123456789012345678901234567890123456789012345678901234567890
|
|
||||||
print $_[0];
|
|
||||||
print "\nuse as follows:\n";
|
|
||||||
print "$0 -b <BusinessProcess> [-f <config_file>] [-t <timeout>]\n";
|
|
||||||
print "or\n";
|
|
||||||
print "$0 -h|--help\n\n";
|
|
||||||
print "or\n";
|
|
||||||
print "$0 -v|--version\n\n";
|
|
||||||
print "where\n\n";
|
|
||||||
print "<BusinessProcess> is the short name of the business process\n";
|
|
||||||
print " you want to check (see Your business process config file to\n";
|
|
||||||
print " find the name)\n";
|
|
||||||
print "<config_file> is the name of the file where the <BusinessProcess> is\n";
|
|
||||||
print " defined\n";
|
|
||||||
print " if it starts with a / it is considered to be a absolut path\n";
|
|
||||||
print " otherwise it is looked for in $settings->{'NAGIOSBP_ETC'}\n";
|
|
||||||
print " default is $settings->{'NAGIOSBP_ETC'}/nagios-bp.conf\n";
|
|
||||||
print "<timeout> the plugin execution times out after this number of seconds\n";
|
|
||||||
print " defaults to 10 seconds\n";
|
|
||||||
print "-h or --help to display this help message\n\n";
|
|
||||||
print "-V or --version to display version information\n\n";
|
|
||||||
exit(3);
|
|
||||||
}
|
|
||||||
|
|
||||||
# online help
|
|
||||||
sub version
|
|
||||||
{
|
|
||||||
print "Version " . getVersion() . "\n";
|
|
||||||
print "This program is free software licensed under the terms of the GNU General Public\n";
|
|
||||||
print "License version 2.\n";
|
|
||||||
exit(3);
|
|
||||||
}
|
|
BIN
nagios-business-process-addon_0.9.6.orig.tar.gz.delta
Normal file
BIN
nagios-business-process-addon_0.9.6.orig.tar.gz.delta
Normal file
Binary file not shown.
1
nagios-business-process-addon_0.9.6.orig.tar.gz.id
Normal file
1
nagios-business-process-addon_0.9.6.orig.tar.gz.id
Normal file
@ -0,0 +1 @@
|
|||||||
|
16ed3e7d18ecebf2739577f0a4a314447583f851
|
@ -1,27 +0,0 @@
|
|||||||
prefix=@prefix@
|
|
||||||
exec_prefix=@exec_prefix@
|
|
||||||
DATAROOTDIR=@datarootdir@
|
|
||||||
LOGDIR=@localstatedir@
|
|
||||||
CFGDIR=@sysconfdir@
|
|
||||||
BINDIR=@bindir@
|
|
||||||
CGIDIR=@sbindir@
|
|
||||||
|
|
||||||
INSTALL=@INSTALL@
|
|
||||||
INSTALL_OPTS=@INSTALL_OPTS@
|
|
||||||
|
|
||||||
CP=@CP@
|
|
||||||
|
|
||||||
all html:
|
|
||||||
|
|
||||||
clean:
|
|
||||||
-rm nagios-bp.cgi
|
|
||||||
-rm whereUsed.cgi
|
|
||||||
|
|
||||||
distclean: clean
|
|
||||||
-rm Makefile
|
|
||||||
|
|
||||||
devclean: distclean
|
|
||||||
|
|
||||||
install:
|
|
||||||
$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(CGIDIR)
|
|
||||||
$(INSTALL) -m 755 $(INSTALL_OPTS) *.cgi $(DESTDIR)$(CGIDIR)
|
|
File diff suppressed because it is too large
Load Diff
@ -1,303 +0,0 @@
|
|||||||
#!@PERL@
|
|
||||||
|
|
||||||
# Nagios Business Process View and Nagios Business Process Analysis
|
|
||||||
# Copyright (C) 2003-2010 Sparda-Datenverarbeitung eG, Nuernberg, Germany
|
|
||||||
# Bernd Stroessreuther <berny1@users.sourceforge.net>
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; version 2 of the License.
|
|
||||||
#
|
|
||||||
# This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
|
|
||||||
#Load modules
|
|
||||||
use lib ('@libdir@');
|
|
||||||
#CGI-Modul
|
|
||||||
use CGI;
|
|
||||||
#restrict maximum size of posted data
|
|
||||||
$CGI::POST_MAX=5000;
|
|
||||||
#disallow uploads
|
|
||||||
$CGI::DISABLE_UPLOADS=1;
|
|
||||||
#log to the log of webserver
|
|
||||||
use CGI::Carp;
|
|
||||||
#require a good programming
|
|
||||||
use strict;
|
|
||||||
#cgi simple for url encoding and decoding
|
|
||||||
use CGI::Simple;
|
|
||||||
#some useful functions
|
|
||||||
use bsutils;
|
|
||||||
#functions for getting states from the ndo database
|
|
||||||
use ndodb;
|
|
||||||
#functions for parsing nagios_bp_config file
|
|
||||||
use nagiosBp;
|
|
||||||
#get installation specific parameters: path variables and so on
|
|
||||||
use settings;
|
|
||||||
|
|
||||||
#some Variables
|
|
||||||
my $settings = getSettings();
|
|
||||||
# where is the cgi.cfg file located?
|
|
||||||
# from this we take the credentials and location of the database
|
|
||||||
my $nagios_bp_conf = $settings->{'NAGIOSBP_ETC'} . "/";
|
|
||||||
my $default_language = "de";
|
|
||||||
my $own_url = $ENV{"SCRIPT_NAME"};
|
|
||||||
my $cgi_simple = new CGI::Simple; #Instance of CGI simple
|
|
||||||
my $query = new CGI; #Instance of CGI module
|
|
||||||
my ($display, $display_status, $script_out, $info_url, $components, $hardstates, $statusinfos, $key, @component_list, @match, @object_stack, $rowcount, $rowclass, $infostring, $i);
|
|
||||||
|
|
||||||
# which configfile do we work on
|
|
||||||
my $conf = $query->param("conf");
|
|
||||||
# lang can be used if you want to use a dedicated language, not the language submitted in Accept Language Header
|
|
||||||
my $lang = $query->param("lang");
|
|
||||||
# the host You want to know about
|
|
||||||
my $host = $query->param("host");
|
|
||||||
# the service You want to know about
|
|
||||||
my $service = $query->param("service");
|
|
||||||
|
|
||||||
#set defaults
|
|
||||||
if ($conf eq "" || $conf !~ m/^[a-zA-Z0-9_\-]+$/ ) { $conf = "nagios-bp" }
|
|
||||||
$nagios_bp_conf .= $conf . ".conf";
|
|
||||||
|
|
||||||
if ($service !~ m/^[a-zA-Z0-9_\-\+\.\/ ]+$/ || $service =~ m/\.\./ ) { $service = "" }
|
|
||||||
if ($host !~ m/^[a-zA-Z0-9_\-\+\.\/ ]+$/ || $host =~ m/\.\./ ) { $host = "" }
|
|
||||||
|
|
||||||
# try to guess the host and service from the referer
|
|
||||||
if ($service eq "" && $host eq "" && $ENV{'HTTP_REFERER'} ne "")
|
|
||||||
{
|
|
||||||
#print "HTTP_REFERER: $ENV{'HTTP_REFERER'}<br>\n";
|
|
||||||
if ($ENV{'HTTP_REFERER'} =~ m/host=([^&]+)/)
|
|
||||||
{
|
|
||||||
#$host = $1;
|
|
||||||
$host = $cgi_simple->url_decode($1);
|
|
||||||
if ($host !~ m/^[a-zA-Z0-9_\-\+\. ]+$/ || $host =~ m/\.\./ ) { $host = "" }
|
|
||||||
}
|
|
||||||
if ($ENV{'HTTP_REFERER'} =~ m/service=([^&]+)/)
|
|
||||||
{
|
|
||||||
#$service = $1;
|
|
||||||
$service = $cgi_simple->url_decode($1);
|
|
||||||
if ($service !~ m/^[a-zA-Z0-9_\-\+\. ]+$/ || $service =~ m/\.\./ ) { $service = "" }
|
|
||||||
#$service =~ s/\+/ /g;
|
|
||||||
#$service =~ s/%20/ /g;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$service =~ s/^\s+//;
|
|
||||||
$service =~ s/\s+$//;
|
|
||||||
$host =~ s/^\s+//;
|
|
||||||
$host =~ s/\s+$//;
|
|
||||||
|
|
||||||
#print "host: \"$host\"<br>\n";
|
|
||||||
#print "service: \"$service\"<br><br>\n";
|
|
||||||
|
|
||||||
#load korrekt i18n language file
|
|
||||||
#print "Content-Type: text/plain\n\n";
|
|
||||||
if ($lang =~ m/^[a-z][a-z]$/)
|
|
||||||
{
|
|
||||||
&read_language_file($lang, $default_language);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
&read_language_file($ENV{"HTTP_ACCEPT_LANGUAGE"}, $default_language);
|
|
||||||
}
|
|
||||||
|
|
||||||
# error handling
|
|
||||||
# parameter conf
|
|
||||||
if ( ! -f $nagios_bp_conf || ! -r $nagios_bp_conf )
|
|
||||||
{
|
|
||||||
&printPageHead();
|
|
||||||
print "<div class=\'statusTitle\' id=\'nbp_error_head\'>" . &get_lang_string("error_wrong_parameter_conf_head") . "</div>\n";
|
|
||||||
print "<P id=\'nbp_error_text\'>\n";
|
|
||||||
print &get_lang_string("error_wrong_parameter_conf_body", $nagios_bp_conf) . "\n";
|
|
||||||
print "</P>\n";
|
|
||||||
&printPageFoot();
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
# parameter host
|
|
||||||
if ( $host eq "" )
|
|
||||||
{
|
|
||||||
&printPageHead();
|
|
||||||
print "<div class=\'statusTitle\' id=\'nbp_error_head\'>" . &get_lang_string("error_wrong_parameter_host_head") . "</div>\n";
|
|
||||||
print "<P id=\'nbp_error_text\'>\n";
|
|
||||||
print &get_lang_string("error_wrong_parameter_host_body") . "\n";
|
|
||||||
print "</P>\n";
|
|
||||||
&printPageFoot();
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# generate output page
|
|
||||||
&printPageHead();
|
|
||||||
print " <div class=\'statusTitle\' id=\'nbp_head_wu\'>" . &get_lang_string("where_used_body") . "</div>\n";
|
|
||||||
|
|
||||||
($hardstates, $statusinfos) = &getStates();
|
|
||||||
($display, $display_status, $script_out, $info_url, $components) = &getBPs($nagios_bp_conf, $hardstates);
|
|
||||||
|
|
||||||
if ($service eq "")
|
|
||||||
{
|
|
||||||
output("$host;.+", &get_lang_string("host") . " \"$host\"", "host");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
output("$host;$service", &get_lang_string("service_on_host", $service, $host), "service");
|
|
||||||
output("$host;.+", &get_lang_string("host") . " \"$host\"", "host");
|
|
||||||
}
|
|
||||||
&printPageFoot();
|
|
||||||
|
|
||||||
|
|
||||||
# subroutines
|
|
||||||
|
|
||||||
sub output()
|
|
||||||
{
|
|
||||||
my $searchfor = shift;
|
|
||||||
my $display_string = shift;
|
|
||||||
my $object_type = shift;
|
|
||||||
my $last;
|
|
||||||
my @resultset = ();
|
|
||||||
|
|
||||||
#printBPs($searchfor);
|
|
||||||
#
|
|
||||||
#while (@object_stack > 0)
|
|
||||||
#{
|
|
||||||
# print "\nDEBUG: object_stack is now:\n";
|
|
||||||
# printArray(\@object_stack);
|
|
||||||
#
|
|
||||||
# printBPs(shift @object_stack);
|
|
||||||
#}
|
|
||||||
|
|
||||||
#print "DEBUG searchfor: $searchfor\n";
|
|
||||||
foreach $key (keys %$display)
|
|
||||||
{
|
|
||||||
@match = grep(/^$searchfor$/, &listAllComponentsOf($key, $components));
|
|
||||||
if (@match > 0 && $display_status->{$key} > 0)
|
|
||||||
{
|
|
||||||
#print "DEBUG: BP $key contains: " . join(", ", &listAllComponentsOf($key, $components)) . "\n";
|
|
||||||
push(@resultset, $key);
|
|
||||||
#print "DEBUG: resultset len " . @resultset . "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (@resultset == 0)
|
|
||||||
{
|
|
||||||
print "<div class=\'statusTitle\' id=\'nbp_wu_${object_type}_head\'>" . &get_lang_string('not_used_anywhere', $display_string) . "</div>\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$rowcount=0;
|
|
||||||
print "<div class=\'statusTitle\' id=\'nbp_wu_${object_type}_head\'>" . &get_lang_string('used_in_these_bps', $display_string) . ":</div>\n";
|
|
||||||
print "<div id=\'nbp_wu_${object_type}_box\'>\n";
|
|
||||||
print " <table class='status' id=\'nbp_wu_${object_type}_table\'>\n";
|
|
||||||
print " <tr>\n";
|
|
||||||
print " <th class='status'>" . &get_lang_string('business_process') . "</th>\n";
|
|
||||||
print " <th class='status'> </th>\n";
|
|
||||||
print " <th class='status'>" . &get_lang_string('status') . "</th>\n";
|
|
||||||
print " <th class='status'> </th>\n";
|
|
||||||
print " </tr>\n";
|
|
||||||
|
|
||||||
foreach $key (sort @resultset)
|
|
||||||
{
|
|
||||||
if ($last ne $key)
|
|
||||||
{
|
|
||||||
$rowcount = ($rowcount + 1)%2;
|
|
||||||
if ($rowcount == 0) { $rowclass = "statusEven" }
|
|
||||||
else { $rowclass = "statusOdd" }
|
|
||||||
|
|
||||||
if ($info_url->{$key} ne "")
|
|
||||||
{
|
|
||||||
$infostring = "<a href=\"$info_url->{$key}\"><img class=\"nbp_no_border\" src=\"" . $settings->{'NAGIOSBP_HTML_URL'} . "/info4.gif\" alt=\"" . &get_lang_string("info") . "\" title=\"" . &get_lang_string("info") . "\"></a>";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$infostring = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
print " <tr class='$rowclass'>\n";
|
|
||||||
print " <td class=\'$rowclass\'><a href=\"$settings->{'NAGIOSBP_CGI_URL'}/nagios-bp.cgi?detail=$key&mode=act&conf=$conf\">$display->{$key}</a> - " . &get_lang_string('prio') . " $display_status->{$key}</td>\n";
|
|
||||||
print " <td class=\'$rowclass\'><a href=\"$settings->{'NAGIOSBP_CGI_URL'}/nagios-bp.cgi?tree=$key&ode=act&conf=$conf\"><img class=\"nbp_no_border\" src=\"$settings->{'NAGIOSBP_HTML_URL'}/tree.gif\" height=\"20\" alt=\"" . &get_lang_string('tree_view') . "\" title=\"" . &get_lang_string('tree_view') . "\"></a></td>\n";
|
|
||||||
print " <td class=\'miniStatus$hardstates->{$key}\'>$hardstates->{$key}</td>\n";
|
|
||||||
print " <td class=\'$rowclass\'>$infostring</td>\n";
|
|
||||||
print " </tr>\n";
|
|
||||||
}
|
|
||||||
$last = $key;
|
|
||||||
}
|
|
||||||
print "</table>\n";
|
|
||||||
print "</div>\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#sub printBPs()
|
|
||||||
#{
|
|
||||||
# my $search = shift;
|
|
||||||
# my $i;
|
|
||||||
#
|
|
||||||
# print "DEBUG: search $search\n";
|
|
||||||
#
|
|
||||||
# &listAllComponentsOf("website", $components);
|
|
||||||
# foreach $key (keys %$display)
|
|
||||||
# {
|
|
||||||
#print "DEBUG3: key $key\n";
|
|
||||||
#&listAllComponentsOf($key, $components);
|
|
||||||
#$components->{$key} =~ s/\s*\d+\s+of:\s*//;
|
|
||||||
#@component_list = split(/\s*&|\||\+\s*/, $components->{$key});
|
|
||||||
#for ($i=0; $i<@component_list; $i++)
|
|
||||||
#{
|
|
||||||
# $component_list[$i] = &cutOffSpaces($component_list[$i]);
|
|
||||||
# print "DEBUG4: component_list \"$component_list[$i]\"\n";
|
|
||||||
#}
|
|
||||||
#@match = grep(/^$search$/, @component_list);
|
|
||||||
#printArray(\@match);
|
|
||||||
#if (@match > 0)
|
|
||||||
#{
|
|
||||||
# if ($display_status->{$key} == 0)
|
|
||||||
# {
|
|
||||||
# #print "\nDEBUG: putting on stack: $key<br>\n";
|
|
||||||
# push(@object_stack, $key)
|
|
||||||
# }
|
|
||||||
# else
|
|
||||||
# {
|
|
||||||
# push(@resultset, $key);
|
|
||||||
# #print "\nDEBUG: $key (prio " . $display_status->{$key} . ")<br>\n";
|
|
||||||
# #printArray(\@match);
|
|
||||||
# }
|
|
||||||
#}
|
|
||||||
# }
|
|
||||||
#}
|
|
||||||
|
|
||||||
sub printPageHead()
|
|
||||||
{
|
|
||||||
print $query->header;
|
|
||||||
print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">' . "\n";
|
|
||||||
print "<html>\n";
|
|
||||||
print " <head>\n";
|
|
||||||
print " <meta http-equiv=\"Content-type\" content=\"text/html;charset=ISO-8859-1\">\n";
|
|
||||||
print " <title>" . &get_lang_string("where_used_head") . "</title>\n";
|
|
||||||
print " <link rel=\'stylesheet\' type=\'text/css\' href=\'$settings->{'NAGIOS_BASE_URL'}/stylesheets/status.css\'>\n";
|
|
||||||
print " <link rel=\'stylesheet\' type=\'text/css\' href=\'$settings->{'NAGIOSBP_HTML_URL'}/stylesheets/nagios-bp.css\'>\n";
|
|
||||||
print " <link rel=\'stylesheet\' type=\'text/css\' href=\'$settings->{'NAGIOSBP_HTML_URL'}/stylesheets/user.css\'>\n";
|
|
||||||
print " </head>\n";
|
|
||||||
print " <body class=\'status\' id=\'nbp_body_wu\'>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
sub printPageFoot()
|
|
||||||
{
|
|
||||||
my $languages = &getAvaiableLanguages();
|
|
||||||
print " <div id=\"nbp_foot\">\n";
|
|
||||||
print " <div id=\'nbp_foot_version\'>Nagios Business Process AddOn, " . &get_lang_string("version") . " " . &getVersion . "</div>\n";
|
|
||||||
print " <div id=\'nbp_foot_language\'>\n";
|
|
||||||
print " " . &get_lang_string("language") . ":\n";
|
|
||||||
foreach $i (@$languages)
|
|
||||||
{
|
|
||||||
print " <a href=\"$own_url?host=$host&service=$service&lang=$i&conf=$conf\">$i</a> \n";
|
|
||||||
}
|
|
||||||
print " </div>\n";
|
|
||||||
print " </div>\n";
|
|
||||||
print " </body>\n";
|
|
||||||
print "</html>\n";
|
|
||||||
}
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
|||||||
prefix=@prefix@
|
|
||||||
exec_prefix=@exec_prefix@
|
|
||||||
LOGDIR=@localstatedir@
|
|
||||||
CFGDIR=@sysconfdir@
|
|
||||||
BINDIR=@bindir@
|
|
||||||
CGIDIR=@sbindir@
|
|
||||||
HTMLDIR=@HTML_DIR@
|
|
||||||
INSTALL=@INSTALL@
|
|
||||||
INSTALL_OPTS=@INSTALL_OPTS@
|
|
||||||
#DATAROOTDIR=@datarootdir@
|
|
||||||
DATADIR=@datadir@
|
|
||||||
|
|
||||||
CP=@CP@
|
|
||||||
|
|
||||||
all html:
|
|
||||||
|
|
||||||
clean:
|
|
||||||
|
|
||||||
distclean: clean
|
|
||||||
-rm Makefile
|
|
||||||
|
|
||||||
devclean: distclean
|
|
||||||
|
|
||||||
install:
|
|
||||||
$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DATADIR)
|
|
||||||
for file in ./*.gif; \
|
|
||||||
do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DATADIR); done
|
|
||||||
|
|
BIN
share/info4.gif
BIN
share/info4.gif
Binary file not shown.
Before Width: | Height: | Size: 132 B |
@ -1,27 +0,0 @@
|
|||||||
prefix=@prefix@
|
|
||||||
exec_prefix=@exec_prefix@
|
|
||||||
LOGDIR=@localstatedir@
|
|
||||||
CFGDIR=@sysconfdir@
|
|
||||||
BINDIR=@bindir@
|
|
||||||
CGIDIR=@sbindir@
|
|
||||||
DATAROOTDIR=@datarootdir@
|
|
||||||
DATADIR=@datadir@
|
|
||||||
|
|
||||||
INSTALL=@INSTALL@
|
|
||||||
INSTALL_OPTS=@INSTALL_OPTS@
|
|
||||||
|
|
||||||
CP=@CP@
|
|
||||||
|
|
||||||
all html:
|
|
||||||
|
|
||||||
clean:
|
|
||||||
|
|
||||||
distclean: clean
|
|
||||||
-rm Makefile
|
|
||||||
|
|
||||||
devclean: distclean
|
|
||||||
|
|
||||||
install:
|
|
||||||
$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DATADIR)/lang
|
|
||||||
for file in ./*.txt; \
|
|
||||||
do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DATADIR)/lang; done
|
|
@ -1,73 +0,0 @@
|
|||||||
# language_file de for Nagios Business Process Add on
|
|
||||||
# hint for translating in other languages:
|
|
||||||
# where ever you find __var1__ __var2__ ... leave it unchanged while
|
|
||||||
# translating; these are variables which are replaced at runtime
|
|
||||||
|
|
||||||
priority_1_headline=Priorität 1
|
|
||||||
priority_1_description=Alarmierung rund um die Uhr (24 x 7)
|
|
||||||
priority_2_headline=Priorität 2
|
|
||||||
priority_2_description=Alarmierung Montag bis Sonntag 7:00 bis 22:00 Uhr
|
|
||||||
priority_3_headline=Priorität 3
|
|
||||||
priority_3_description=Alarmierung Montag bis Donnerstag 7:00 bis 17:00 Uhr, Freitag 7:00 bis 15:00 Uhr
|
|
||||||
priority_4_headline=Priorität 4
|
|
||||||
priority_4_description=Abnahme-, Entwicklungs- und Testsysteme -- keine Alarmierung
|
|
||||||
priority_5_headline=
|
|
||||||
priority_5_description=
|
|
||||||
manually_set_to_ok=manuell auf OK gesetzt
|
|
||||||
manually_set_to=manuell auf __var1__ gesetzt
|
|
||||||
bi_head=Business Impact Analyse
|
|
||||||
bi_explanation=Die Business Impact Analyse ermöglicht Ihnen Was-wäre-wenn-Fragestellungen.<br>Sie haben die Möglichkeit die Stati einzelner Komponenten gezielt zu setzen und sehen dann,<br>wie sich das auf die Anwendungen (Business Prozesse) auswirkt.
|
|
||||||
bi_start_session=Start einer neuen Session
|
|
||||||
bi_select_starting_point=Ausgangspunkt festlegen:
|
|
||||||
bi_actual_state=Aktueller Zustand der Komponenten
|
|
||||||
bi_all_set_to_ok=Alle Komponenten auf OK setzen
|
|
||||||
bi_hint_session_timeout=Hinweis:<br>Session Timeout nach 30 Minuten
|
|
||||||
bi_set_status=Status setzen
|
|
||||||
bi_set_host_status_to=Der Status für alle Services auf <b>__var1__</b> soll gesetzt werden auf:
|
|
||||||
bi_set_service_status_to=Der Status für Service <b>__var1__</b> auf <b>__var2__</b> soll gesetzt werden auf:
|
|
||||||
short_summary_head=Übersicht
|
|
||||||
prio=Prio
|
|
||||||
status=Status
|
|
||||||
details=Details
|
|
||||||
all_bp=Alle Business Prozesse
|
|
||||||
show_trafficlight=Ampel einblenden
|
|
||||||
hide_trafficlight=Ampel ausblenden
|
|
||||||
for=für
|
|
||||||
host=Host
|
|
||||||
service=Service
|
|
||||||
status=Status
|
|
||||||
status_information=Status Information
|
|
||||||
hint_and=Die Anwendung ist für den Kunden verfügbar, wenn keine der Komponenten im Status CRITICAL ist.
|
|
||||||
hint_or=Es handelt sich um redundant ausgelegte Komponenten. Die Anwendung ist für den Kunden verfügbar, wenn mindestens eine der Komponenten im Status OK oder WARNING ist.
|
|
||||||
hint_of=Die Anwendung ist für den Kunden verfügbar, wenn mindestens __var1__ der Komponenten im Status OK oder WARNING sind.
|
|
||||||
back_to_top=zurück zur obersten Ebene
|
|
||||||
bp_head=Buiness Process View
|
|
||||||
business_process=Business Prozess
|
|
||||||
tree_view=Baumansicht
|
|
||||||
info=Info
|
|
||||||
language=Sprache
|
|
||||||
|
|
||||||
error_nagios_not_running=<h1>Fehler</h1><h2>Nagios läuft derzeit auf dieser Maschine nicht!</h2>
|
|
||||||
error_wrong_parameter_conf_head=Fehlerhafter Parameter "conf"
|
|
||||||
error_wrong_parameter_conf_body=Der Parameter "conf" ist vermutlich fehlerhaft<br>__var1__ ist keine reguläre Datei oder Datei ist nicht lesbar.<br>
|
|
||||||
error_not_existing_session_head=Ungültige Session
|
|
||||||
error_not_existing_session_body=Diese Session existiert leider nicht. Vermutlich haben Sie zu lange keine Eingaben gemacht.
|
|
||||||
|
|
||||||
# new in 0.9.4
|
|
||||||
all_prios=Alle Prioritäten
|
|
||||||
version=Version
|
|
||||||
|
|
||||||
where_used_head=Wo verwendet?
|
|
||||||
where_used_body=Wo wird diese Komponente verwendet?
|
|
||||||
not_used_anywhere=__var1__ wird in keinem Business Prozess verwendet
|
|
||||||
service_on_host=Service "__var1__" auf "__var2__"
|
|
||||||
used_in_these_bps=__var1__ wird in folgenden Business Prozessen verwendet
|
|
||||||
|
|
||||||
error_wrong_parameter_host_head=Parameter host fehlt
|
|
||||||
error_wrong_parameter_host_body=Der Parameter "host" wurde nicht angegeben und konnte auch nicht aus dem Referer ermittelt werden.<br>Bitte geben Sie mindestens den Parameter "host" ggf. zusäztlich den Parameter "service" in der URL an.
|
|
||||||
|
|
||||||
# new in 0.9.6
|
|
||||||
last_updated=Diese Seite wurde generiert
|
|
||||||
error_bp_not_existing=Business Process nicht definiert
|
|
||||||
error_bp_not_existing_body=Ein Business Process "__var1__" ist nicht definiert.
|
|
||||||
|
|
@ -1,72 +0,0 @@
|
|||||||
# language_file en for Nagios Business Process Add on
|
|
||||||
# hint for translating in other languages:
|
|
||||||
# where ever you find __var1__ __var2__ ... leave it unchanged while
|
|
||||||
# translating; these are variables which are replaced at runtime
|
|
||||||
|
|
||||||
priority_1_headline=Priority 1
|
|
||||||
priority_1_description=Alerting round the clock (24 x 7)
|
|
||||||
priority_2_headline=Priority 2
|
|
||||||
priority_2_description=Alerting Monday to Sunday 7:00 to 22:00
|
|
||||||
priority_3_headline=Priority 3
|
|
||||||
priority_3_description=Alerting Monday to Thursday 7:00 to 17:00, Friday 7:00 to 15:00
|
|
||||||
priority_4_headline=Priority 4
|
|
||||||
priority_4_description=Testsystems -- no Alerting
|
|
||||||
priority_5_headline=
|
|
||||||
priority_5_description=
|
|
||||||
manually_set_to_ok=manually set to ok
|
|
||||||
manually_set_to=manually set to __var1__
|
|
||||||
bi_head=Business Impact Analysis
|
|
||||||
bi_explanation=With Business Impact Analysis you can ask, "What would be if...?"<br>You have the possibility to set the status of each single component to any state you want.<br>Afterwards you can see what impact this would have to your Applications (Business Processes)
|
|
||||||
bi_start_session=Start a new session
|
|
||||||
bi_select_starting_point=Set starting point:
|
|
||||||
bi_actual_state=Actual status of all components
|
|
||||||
bi_all_set_to_ok=All components set to OK state
|
|
||||||
bi_hint_session_timeout=Hint:<br>Your session times out after 30 minutes
|
|
||||||
bi_set_status=set status
|
|
||||||
bi_set_host_status_to=Set the status for all services on <b>__var1__</b> to:
|
|
||||||
bi_set_service_status_to=Set the status for service <b>__var1__</b> on <b>__var2__</b> to:
|
|
||||||
short_summary_head=Short Summary
|
|
||||||
prio=Priority
|
|
||||||
status=Status
|
|
||||||
details=Details
|
|
||||||
all_bp=All Business Processes
|
|
||||||
show_trafficlight=Show Traffic Lights
|
|
||||||
hide_trafficlight=Hide Traffic Lights
|
|
||||||
for=for
|
|
||||||
host=Host
|
|
||||||
service=Service
|
|
||||||
status=Status
|
|
||||||
status_information=Status Information
|
|
||||||
hint_and=The application is available to the customer, if none of the components is in CRITICAL status.
|
|
||||||
hint_or=Redundant components. The Application is available to the customer if at least one component is in status OK or WARNING.
|
|
||||||
hint_of=The application is available to the customer, if at least __var1__ components are in stats OK oder WARNING.
|
|
||||||
back_to_top=Back to the top
|
|
||||||
bp_head=Buiness Process View
|
|
||||||
business_process=Business Process
|
|
||||||
tree_view=Tree view
|
|
||||||
info=Info
|
|
||||||
language=Language
|
|
||||||
|
|
||||||
error_nagios_not_running=<h1>Error</h1><h2>Nagios is not running on this machine at the moment!</h2>
|
|
||||||
error_wrong_parameter_conf_head=Parameter "conf" invalid.
|
|
||||||
error_wrong_parameter_conf_body=The Parameter "conf" is probably invalid.<br>__var1__ is not a regular file or file is not readable.<br>
|
|
||||||
error_not_existing_session_head=Invalid Session
|
|
||||||
error_not_existing_session_body=This session does not exist. It was probably idle for too long and timed out.
|
|
||||||
|
|
||||||
# new in 0.9.4
|
|
||||||
all_prios=All Priorities
|
|
||||||
version=Version
|
|
||||||
|
|
||||||
where_used_head=Where used?
|
|
||||||
where_used_body=Where is this component being used?
|
|
||||||
not_used_anywhere=__var1__ is not used in any Business Process
|
|
||||||
service_on_host=Service "__var1__" on "__var2__"
|
|
||||||
used_in_these_bps=__var1__ is being used in these Business Processes
|
|
||||||
|
|
||||||
error_wrong_parameter_host_head=Parameter host is missing
|
|
||||||
error_wrong_parameter_host_body=The parameter "host" is missing and also could not be extracted from the referer.<br>Please add the parameter "host" and maybe additional the parameter "service" to the URL.
|
|
||||||
|
|
||||||
# new in 0.9.6
|
|
||||||
last_updated=This page was last updated
|
|
||||||
error_bp_not_existing=Business Process not defined
|
|
||||||
error_bp_not_existing_body=A Business Process "__var1__" is not defined.
|
|
@ -1,29 +0,0 @@
|
|||||||
prefix=@prefix@
|
|
||||||
exec_prefix=@exec_prefix@
|
|
||||||
LOGDIR=@localstatedir@
|
|
||||||
CFGDIR=@sysconfdir@
|
|
||||||
BINDIR=@bindir@
|
|
||||||
CGIDIR=@sbindir@
|
|
||||||
DATAROOTDIR=@datarootdir@
|
|
||||||
DATADIR=@datadir@
|
|
||||||
|
|
||||||
INSTALL=@INSTALL@
|
|
||||||
INSTALL_OPTS=@INSTALL_OPTS@
|
|
||||||
|
|
||||||
CP=@CP@
|
|
||||||
TOUCH=@TOUCH@
|
|
||||||
|
|
||||||
all html:
|
|
||||||
|
|
||||||
clean:
|
|
||||||
|
|
||||||
distclean: clean
|
|
||||||
-rm Makefile
|
|
||||||
|
|
||||||
devclean: distclean
|
|
||||||
|
|
||||||
install:
|
|
||||||
$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DATADIR)/stylesheets
|
|
||||||
for file in ./*.css; \
|
|
||||||
do $(INSTALL) -m 664 $(INSTALL_OPTS) $$file $(DATADIR)/stylesheets; done
|
|
||||||
${TOUCH} $(DATADIR)/stylesheets/user.css
|
|
@ -1,135 +0,0 @@
|
|||||||
A.status {
|
|
||||||
background-color: #999797;
|
|
||||||
color: #DCE5C1;
|
|
||||||
font-size: 10pt;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nbp_text_small {
|
|
||||||
font-size:80%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nbp_text_tiny {
|
|
||||||
font-size:60%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nbp_central_table_spacer {
|
|
||||||
height:3em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nbp_sub_head {
|
|
||||||
border-top:1.5em solid transparent;
|
|
||||||
font-size:100%;
|
|
||||||
font-weight:bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nbp_description {
|
|
||||||
font-size:120%;
|
|
||||||
text-align:center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nbp_nobr {
|
|
||||||
white-space:nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nbp_no_border {
|
|
||||||
border:0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#nbp_central_table,
|
|
||||||
#nbp_trafficlight_yes_table,
|
|
||||||
#nbp_trafficlight_no_table,
|
|
||||||
#nbp_trafficlight_only_table,
|
|
||||||
#nbp_wu_service_table,
|
|
||||||
#nbp_wu_host_table {
|
|
||||||
margin:auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
#nbp_trafficlight_short_table {
|
|
||||||
background-color:black;
|
|
||||||
margin:auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
#nbp_trafficlight_short_head {
|
|
||||||
display:none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#nbp_trafficlight_yes_box {
|
|
||||||
float:left;
|
|
||||||
margin:0;
|
|
||||||
padding:0;
|
|
||||||
width:8em;
|
|
||||||
}
|
|
||||||
|
|
||||||
#nbp_body_short {
|
|
||||||
background-color:black;
|
|
||||||
}
|
|
||||||
|
|
||||||
#nbp_body_bi,
|
|
||||||
#nbp_body_bi table,
|
|
||||||
#nbp_body_bi td.status {
|
|
||||||
background-color:#FFFFCC;
|
|
||||||
}
|
|
||||||
|
|
||||||
#nbp_error_text {
|
|
||||||
text-align:center;
|
|
||||||
}
|
|
||||||
|
|
||||||
#nbp_startingpoint_form_bi,
|
|
||||||
#nbp_select_state_form_bi {
|
|
||||||
border-top:0.3em solid transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
#nbp_cental_table_box_tl_yes {
|
|
||||||
margin:0;
|
|
||||||
margin-left:9em;
|
|
||||||
padding:0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#nbp_single_table_box,
|
|
||||||
#nbp_cental_table_box_tl_no {
|
|
||||||
margin:0;
|
|
||||||
padding:0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#nbp_table_tree,
|
|
||||||
#nbp_table_list {
|
|
||||||
margin:auto;
|
|
||||||
margin-top:3em;
|
|
||||||
}
|
|
||||||
|
|
||||||
#nbp_button_bar {
|
|
||||||
margin-top:2em;
|
|
||||||
text-align:center;
|
|
||||||
}
|
|
||||||
|
|
||||||
#nbp_hint {
|
|
||||||
margin-top:1em;
|
|
||||||
text-align:center;
|
|
||||||
}
|
|
||||||
|
|
||||||
#nbp_foot,
|
|
||||||
#nbp_wu_service_head,
|
|
||||||
#nbp_wu_host_head {
|
|
||||||
margin-top:2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
#nbp_foot_version {
|
|
||||||
float:left;
|
|
||||||
font-size:75%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#nbp_foot_language {
|
|
||||||
float:right;
|
|
||||||
font-size:75%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#nbp_head_bi,
|
|
||||||
#nbp_head_act,
|
|
||||||
#nbp_head_wu {
|
|
||||||
margin-bottom:2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
#nbp_curly_brace {
|
|
||||||
background-color:black;
|
|
||||||
}
|
|
BIN
share/tree.gif
BIN
share/tree.gif
Binary file not shown.
Before Width: | Height: | Size: 1.2 KiB |
71
subst.in
71
subst.in
@ -1,71 +0,0 @@
|
|||||||
#!@PERL@ -w
|
|
||||||
|
|
||||||
my ${exec_prefix};
|
|
||||||
my ${prefix};
|
|
||||||
my ${datarootdir};
|
|
||||||
my ${nagetc};
|
|
||||||
#my ${cgidir};
|
|
||||||
#my ${langdir};
|
|
||||||
|
|
||||||
${prefix}="@prefix@";
|
|
||||||
${exec_prefix}="@exec_prefix@";
|
|
||||||
${nagetc}="@nagetc@";
|
|
||||||
#${cgidir}="@cgidir@";
|
|
||||||
#${langdir}="@langdir@";
|
|
||||||
|
|
||||||
while ($f = shift @ARGV) {
|
|
||||||
|
|
||||||
if (-x "/bin/mktemp") {
|
|
||||||
$TEMP = `/bin/mktemp $f.$$.XXXXXX`;
|
|
||||||
die 'Cannot make temporary file $TEMP' if($?);
|
|
||||||
chomp $TEMP;
|
|
||||||
} else {
|
|
||||||
$XXXXXX = rand;
|
|
||||||
$TEMP = "$f.$$.$XXXXXX";
|
|
||||||
}
|
|
||||||
|
|
||||||
open(IN,"<$f.in");
|
|
||||||
open(OUT,">$TEMP") || die 'Cannot make temporary file $TEMP';
|
|
||||||
|
|
||||||
while (<IN>) {
|
|
||||||
s|\@PERL\@|@PERL@|g;
|
|
||||||
s|\@nagiosbp_user\@|@nagiosbp_user@|g;
|
|
||||||
s|\@nagiosbp_grp\@|@nagiosbp_grp@|g;
|
|
||||||
# s|\@lockfile\@|@lockfile@|g;
|
|
||||||
s|\@libexecdir\@|@libexecdir@|g; # put all --with-vars before directories
|
|
||||||
s|\@localstatedir\@|@localstatedir@|g;
|
|
||||||
s|\@libdir\@|@libdir@|g;
|
|
||||||
s|\@sysconfdir\@|@sysconfdir@|g;
|
|
||||||
# s|\@TMPDIR\@|@TMPDIR@|g;
|
|
||||||
# s|\@CHECKRESULTDIR\@|@CHECKRESULTDIR@|g;
|
|
||||||
s|\@datarootdir\@|@datadir@|g;
|
|
||||||
s|\@datadir\@|@datadir@|g;
|
|
||||||
#s|\@cgidir\@|@cgidir@|g;
|
|
||||||
s|\@sbindir\@|@sbindir@|g;
|
|
||||||
s|\@bindir\@|@bindir@|g;
|
|
||||||
s|\@htmurl\@|@htmurl@|g;
|
|
||||||
s|\@naghtmurl\@|@naghtmurl@|g;
|
|
||||||
s|\@nagcgiurl\@|@nagcgiurl@|g;
|
|
||||||
s|\@cgiurl\@|@cgiurl@|g;
|
|
||||||
s|\@nagetc\@|@nagetc@|g;
|
|
||||||
s|\@apache_user\@|@apache_user@|g;
|
|
||||||
s|\@CRON_D_DIR\@|@CRON_D_DIR@|g;
|
|
||||||
# s|\@langdir\@|@langdir@|g;
|
|
||||||
# s|\@MAIL_PROG\@|@MAIL_PROG@|g;
|
|
||||||
# s|\@VERSION\@|@VERSION@|g;
|
|
||||||
s|\@apache_authname\@|@apache_authname@|g;
|
|
||||||
s|\$\{exec_prefix\}|@exec_prefix@|g; # must be next to last
|
|
||||||
s|\$\{prefix\}|@prefix@|g; # must be last
|
|
||||||
print OUT $_;
|
|
||||||
}
|
|
||||||
|
|
||||||
close IN;
|
|
||||||
close OUT;
|
|
||||||
|
|
||||||
if ((! -e $f) || (`diff $f $TEMP`)) {
|
|
||||||
`mv $TEMP $f`;
|
|
||||||
} else {
|
|
||||||
unlink $TEMP;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
27
var/cache/Makefile.in
vendored
27
var/cache/Makefile.in
vendored
@ -1,27 +0,0 @@
|
|||||||
prefix=@prefix@
|
|
||||||
exec_prefix=@exec_prefix@
|
|
||||||
LOGDIR=@localstatedir@
|
|
||||||
CFGDIR=@sysconfdir@
|
|
||||||
BINDIR=@bindir@
|
|
||||||
CGIDIR=@sbindir@
|
|
||||||
DATAROOTDIR=@datarootdir@
|
|
||||||
LIBEXECDIR=@libexecdir@
|
|
||||||
|
|
||||||
INSTALL=@INSTALL@
|
|
||||||
INSTALL_OPTS=@INSTALL_OPTS@
|
|
||||||
|
|
||||||
CP=@CP@
|
|
||||||
|
|
||||||
all html:
|
|
||||||
|
|
||||||
clean:
|
|
||||||
|
|
||||||
distclean: clean
|
|
||||||
-rm Makefile
|
|
||||||
|
|
||||||
devclean: distclean
|
|
||||||
|
|
||||||
install:
|
|
||||||
$(INSTALL) -m 755 $(INSTALL_OPTS) -d $(LOGDIR)/cache
|
|
||||||
$(INSTALL) -m 666 $(INSTALL_OPTS) ndo_backend_cache $(LOGDIR)/cache/
|
|
||||||
|
|
0
var/cache/ndo_backend_cache
vendored
0
var/cache/ndo_backend_cache
vendored
@ -1,27 +0,0 @@
|
|||||||
prefix=@prefix@
|
|
||||||
exec_prefix=@exec_prefix@
|
|
||||||
LOGDIR=@localstatedir@
|
|
||||||
CFGDIR=@sysconfdir@
|
|
||||||
BINDIR=@bindir@
|
|
||||||
CGIDIR=@sbindir@
|
|
||||||
DATAROOTDIR=@datarootdir@
|
|
||||||
LIBEXECDIR=@libexecdir@
|
|
||||||
|
|
||||||
INSTALL=@INSTALL@
|
|
||||||
INSTALL_OPTS=@INSTALL_OPTS@
|
|
||||||
|
|
||||||
CP=@CP@
|
|
||||||
|
|
||||||
all html:
|
|
||||||
|
|
||||||
clean:
|
|
||||||
|
|
||||||
distclean: clean
|
|
||||||
-rm Makefile
|
|
||||||
|
|
||||||
devclean: distclean
|
|
||||||
|
|
||||||
install:
|
|
||||||
$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(LOGDIR)
|
|
||||||
$(INSTALL) -m 1777 $(INSTALL_OPTS) -d $(LOGDIR)/nagios_bp.sessions
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user