commit cf99ff947652b67d3982bebaeb3c5d3af22c765c Author: Mario Fetka Date: Sat Apr 22 08:30:21 2017 +0200 Imported Upstream version 0.9.6 diff --git a/API-DOC b/API-DOC new file mode 100644 index 0000000..db2604f --- /dev/null +++ b/API-DOC @@ -0,0 +1,204 @@ +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 + + diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..4e32c02 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,12 @@ +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 diff --git a/CHANGES b/CHANGES new file mode 100644 index 0000000..9ca4ab1 --- /dev/null +++ b/CHANGES @@ -0,0 +1,178 @@ +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:///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 diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..e4e5413 --- /dev/null +++ b/INSTALL @@ -0,0 +1,222 @@ +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-.tar.gz + cd nagios-business-process-addon- + +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 + + + 3-D Status Map + + You insert the following lines: + + + Business Process View + + + + Business Impact + + +If using Icinga with the classic web GUI edit +/usr/local/icinga/share/menu.html + e. g. after this section + + You insert the following lines: + + + +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 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..2ba72d5 --- /dev/null +++ b/LICENSE @@ -0,0 +1,340 @@ + 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. + + + Copyright (C) 19yy + + 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. + + , 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. diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..6178dcc --- /dev/null +++ b/Makefile.in @@ -0,0 +1,159 @@ +############################### +# 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 + diff --git a/README b/README new file mode 100644 index 0000000..2b1fe18 --- /dev/null +++ b/README @@ -0,0 +1,719 @@ +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 + 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 + ; + +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 and the 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 + + +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 'Please note: Today maintainance on WebServer1,
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. + + + = ; [& ;]+ + +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. + + + = ; [| ;]+ + +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. + + + = of: ; + ; [+ ;]+ + +Use this one, if You have a number of application servers running the same +application and You know You need at least 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. + + +;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 ; You always can use too, where +is the name of a business process You defined BEFORE. + + +display ;; + +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. + is the name or description used when displaying the process. +(The user never sees in the GUI, always ) + + +external_info ;