├── .gitignore ├── CONTRIBUTING.md ├── Changelog ├── LEGAL ├── LICENSE ├── Makefile.in ├── README ├── README.md ├── REQUIREMENTS ├── THANKS ├── TODO ├── UPGRADING ├── aclocal.m4 ├── config.guess ├── config.sub ├── config ├── misccommands.cfg.in ├── nagios.cfg.in ├── ndo2db.cfg-sample.in └── ndomod.cfg-sample.in ├── configure ├── configure.ac ├── db ├── README ├── installdb ├── mysql-mods-1.4b5.sql ├── mysql-mods-1.4b7.sql ├── mysql-mods-1.4b8.sql ├── mysql-upgrade-1.3.sql ├── mysql-upgrade-1.4b1.sql ├── mysql-upgrade-1.4b2.sql ├── mysql-upgrade-1.4b3.sql ├── mysql-upgrade-1.4b4.sql ├── mysql-upgrade-1.4b5.sql ├── mysql-upgrade-1.4b6.sql ├── mysql-upgrade-1.4b8.sql ├── mysql-upgrade-2.0.0.sql ├── mysql-upgrade-2.0.1.sql ├── mysql-upgrade-2.1.0.sql ├── mysql-upgrade-2.1.2.sql ├── mysql.sql ├── prepsql ├── queries │ ├── comment_history.sql │ ├── comments.sql │ ├── contact_notification_methods.sql │ ├── contact_notifications.sql │ ├── contact_status.sql │ ├── contactgroup_membership.sql │ ├── contacts.sql │ ├── downtime_history.sql │ ├── event_handlers.sql │ ├── flapping_history.sql │ ├── host_comments.sql │ ├── host_downtime_history.sql │ ├── host_event_handlers.sql │ ├── host_flapping_history.sql │ ├── host_notifications.sql │ ├── host_state_history.sql │ ├── host_status.sql │ ├── hostgroup_membership.sql │ ├── hosts.sql │ ├── notifications.sql │ ├── scheduled_downtime.sql │ ├── service_comments.sql │ ├── service_downtime_history.sql │ ├── service_event_handlers.sql │ ├── service_flapping_history.sql │ ├── service_notifications.sql │ ├── service_state_history.sql │ ├── service_status.sql │ ├── servicegroup_membership.sql │ ├── services.sql │ ├── state_history.sql │ ├── timed_event_queue.sql │ └── timed_events.sql └── upgradedb ├── docs ├── NDOUTILS DB Model.odt ├── NDOUTILS DB Model.pdf ├── NDOUtils Documentation.odt ├── NDOUtils Documentation.pdf ├── docbook │ ├── en-en │ │ ├── Makefile.in │ │ ├── NDOUtils.xml │ │ ├── all-entities.ent │ │ ├── components.xml │ │ ├── ent │ │ │ ├── documents.ent │ │ │ ├── names.ent │ │ │ ├── plugins.ent │ │ │ ├── protocols.ent │ │ │ ├── urls.ent │ │ │ └── version.ent │ │ ├── example-configs.xml │ │ ├── installation.xml │ │ ├── introduction.xml │ │ └── whatsnew.xml │ ├── images │ │ ├── fig1.png │ │ ├── fig10.png │ │ ├── fig11.png │ │ ├── fig12.png │ │ ├── fig13.png │ │ ├── fig2.png │ │ ├── fig3.png │ │ ├── fig4.png │ │ ├── fig5.png │ │ ├── fig6.png │ │ ├── fig7.png │ │ ├── fig8.png │ │ ├── fig9.png │ │ ├── important.png │ │ ├── logofullsize.png │ │ ├── note.png │ │ └── tip.png │ └── xsl │ │ ├── fo.xsl │ │ ├── html-chunked.xsl │ │ ├── html-single.xsl │ │ ├── titlepage.xml │ │ └── titlepage.xsl └── html │ ├── en-en │ ├── ch01.html │ ├── ch02.html │ ├── ch03.html │ ├── ch04.html │ ├── components.html │ ├── example-configs.html │ ├── index.html │ ├── installation.html │ ├── intro.html │ └── whatsnew.html │ └── images │ ├── fig1.png │ ├── fig10.png │ ├── fig11.png │ ├── fig12.png │ ├── fig13.png │ ├── fig2.png │ ├── fig3.png │ ├── fig4.png │ ├── fig5.png │ ├── fig6.png │ ├── fig7.png │ ├── fig8.png │ ├── fig9.png │ ├── important.png │ ├── logofullsize.png │ ├── note.png │ └── tip.png ├── include ├── common.h.in ├── config.h.in ├── db.h ├── dbhandlers.h ├── getheaders ├── io.h.in ├── nagios-2x │ ├── broker.h │ ├── cgiauth.h │ ├── cgiutils.h │ ├── comments.h │ ├── common.h │ ├── config.h │ ├── downtime.h │ ├── epn_nagios.h │ ├── getcgi.h │ ├── locations.h │ ├── nagios.h │ ├── nebcallbacks.h │ ├── neberrors.h │ ├── nebmods.h │ ├── nebmodules.h │ ├── nebstructs.h │ ├── objects.h │ ├── perfdata.h │ ├── snprintf.h │ ├── sretention.h │ └── statusdata.h ├── nagios-3x │ ├── broker.h │ ├── cgiauth.h │ ├── cgiutils.h │ ├── comments.h │ ├── common.h │ ├── compat.h │ ├── config.h │ ├── downtime.h │ ├── epn_nagios.h │ ├── getcgi.h │ ├── locations.h │ ├── logging.h │ ├── macros.h │ ├── nagios.h │ ├── nebcallbacks.h │ ├── neberrors.h │ ├── nebmods.h │ ├── nebmodules.h │ ├── nebstructs.h │ ├── netutils.h │ ├── objects.h │ ├── perfdata.h │ ├── shared.h │ ├── skiplist.h │ ├── snprintf.h │ ├── sretention.h │ └── statusdata.h ├── nagios-4x │ ├── broker.h │ ├── cgiauth.h │ ├── cgiutils.h │ ├── comments.h │ ├── common.h │ ├── config.h │ ├── defaults.h │ ├── downtime.h │ ├── getcgi.h │ ├── lib │ │ ├── bitmap.h │ │ ├── dkhash.h │ │ ├── fanout.h │ │ ├── iobroker.h │ │ ├── iocache.h │ │ ├── kvvec.h │ │ ├── libnagios.h │ │ ├── lnag-utils.h │ │ ├── nsock.h │ │ ├── nspath.h │ │ ├── nsutils.h │ │ ├── nwrite.h │ │ ├── pqueue.h │ │ ├── prqueue.h │ │ ├── runcmd.h │ │ ├── skiplist.h │ │ ├── snprintf.h │ │ ├── squeue.h │ │ ├── t-utils.h │ │ └── worker.h │ ├── locations.h │ ├── logging.h │ ├── macros.h │ ├── nagios.h │ ├── nebcallbacks.h │ ├── neberrors.h │ ├── nebmods.h │ ├── nebmodules.h │ ├── nebstructs.h │ ├── netutils.h │ ├── objects.h │ ├── perfdata.h │ ├── shared.h │ ├── snprintf.h │ ├── sretention.h │ ├── statusdata.h │ └── workers.h ├── ndo2db.h ├── ndomod.h ├── protoapi.h ├── queue.h └── utils.h ├── install-sh ├── m4 └── np_mysqlclient.m4 ├── macros ├── .gitignore ├── LICENSE ├── README.md ├── add_group_user ├── ax_nagios_get_distrib ├── ax_nagios_get_files ├── ax_nagios_get_inetd ├── ax_nagios_get_init ├── ax_nagios_get_os ├── ax_nagios_get_paths └── ax_nagios_get_ssl ├── make-tarball ├── src ├── Makefile.in ├── db.c ├── dbhandlers.c ├── file2sock.c ├── io.c ├── log2ndo.c ├── ndo2db.c ├── ndomod.c ├── protonum.c ├── queue.c ├── snprintf.c ├── sockdebug.c └── utils.c ├── startup ├── bsd-init.in ├── debian-init.in ├── default-inetd.in ├── default-init.in ├── default-service.in ├── default-socket-svc.in ├── default-socket.in ├── default-xinetd.in ├── mac-inetd.plist.in ├── mac-init.plist.in ├── newbsd-init.in ├── openbsd-init.in ├── openrc-conf.in ├── openrc-init.in ├── rh-upstart-init.in ├── solaris-inetd.xml.in ├── solaris-init.xml.in ├── tmpfile.conf.in └── upstart-init.in └── update-version /.gitignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | autom4te.cache/ 3 | config.log 4 | config.status 5 | uninstall 6 | 7 | include/common.h 8 | include/config.h 9 | include/dh.h 10 | include/io.h 11 | 12 | config/*.cfg 13 | config/*.cfg-sample 14 | 15 | docs/docbook/en-en/Makefile 16 | 17 | nbproject/ 18 | CVS/ 19 | 20 | src/Makefile 21 | src/*.o 22 | src/file2sock 23 | src/log2ndo 24 | src/ndo2db-2x 25 | src/ndo2db-3x 26 | src/ndo2db-4x 27 | src/sockdebug 28 | 29 | startup/bsd-init 30 | startup/debian-init 31 | startup/default-inetd 32 | startup/default-init 33 | startup/default-service 34 | startup/default-socket 35 | startup/default-socket-svc 36 | startup/default-xinetd 37 | startup/mac-inetd.plist 38 | startup/mac-init.plist 39 | startup/newbsd-init 40 | startup/openbsd-init 41 | startup/openrc-conf 42 | startup/openrc-init 43 | startup/rh-upstart-init 44 | startup/solaris-inetd.xml 45 | startup/solaris-init.xml 46 | startup/tmpfile.conf 47 | startup/upstart-init 48 | -------------------------------------------------------------------------------- /LEGAL: -------------------------------------------------------------------------------- 1 | NDOUtils - Nagios Data Output Utilities 2 | 3 | Copyright (c) 1999-2009: 4 | Ethan Galstad 5 | Copyright (c) 2009 until further notice: 6 | Nagios Core Development Team and Nagios Community Contributors 7 | 8 | For detailed authorship information, refer to the source control management 9 | history and pay particular attention to commit messages and the THANKS file. 10 | 11 | NDOUtils is free software: you can redistribute it and/or modify it under the 12 | terms of the GNU General Public License version 2 as published by the Free 13 | Software Foundation. 14 | 15 | NDOUtils is distributed in the hope that it will be useful, but WITHOUT ANY 16 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 17 | PARTICULAR PURPOSE. See the GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License along with 20 | NDOUtils. If not, see . 21 | 22 | Nagios and the Nagios logo are trademarks, servicemarks, registered trademarks 23 | or registered servicemarks owned by Nagios Enterprises, LLC. All other 24 | trademarks, servicemarks, registered trademarks, and registered servicemarks 25 | are the property of their respective owner(s). 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | README -------------------------------------------------------------------------------- /REQUIREMENTS: -------------------------------------------------------------------------------- 1 | ---------------- 2 | NDO REQUIREMENTS 3 | ---------------- 4 | 5 | Because the NDOMOD event broker module traverses internal object structures in 6 | the Nagios daemon, it is highly sensitive to code and structure changes that 7 | occur throughout the Nagios development process. Therefore, it is very important 8 | that you are using a version of the NDO utilities that matches your current 9 | Nagios installation. 10 | 11 | This version of the NDO utilities requires that you: 12 | 13 | 1. are running Nagios 2.x, 3.x, or 4.x (see below for details) 14 | 15 | 2. compiled the Nagios daemon with event broker support (enabled by default). 16 | 17 | 18 | Version Compatability Details 19 | ----------------------------- 20 | 21 | If you're using the NDOUtils addon, you'll have to watch out for changing 22 | version requirements as your upgrade your Nagios installation. This is 23 | particularly true if you are running the Nagios 4.x alpha/beta code, as 24 | internal data structures are changing throughout the development process. 25 | 26 | Make sure the check the Changelog for specific Nagios version requirements 27 | for each release of NDOUtils. 28 | 29 | -------------------------------------------------------------------------------- /THANKS: -------------------------------------------------------------------------------- 1 | ======= 2 | THANKS! 3 | ======= 4 | 5 | The success of this software has been due to the fantastic community members that 6 | support it and provide bug reports, patches, and great ideas. Here are a 7 | few of the many individuals that have contributed in various ways. 8 | --- 9 | 10 | Altinity 11 | andree 12 | Bernhard Reutner-Fischer 13 | Bruno Quintais 14 | Christian Masopust 15 | Dominic Settele 16 | Duncan Ferguson 17 | Eric Stanley 18 | Hendrik Frenzel 19 | Herbert Straub 20 | Jean Gabes 21 | Josh Soref 22 | Lars Michelsen 23 | Matthieu Kermagoret 24 | Michael Friedrich 25 | Mike Guthrie 26 | Sascha Runschke 27 | Sébastien Aperghis-Tramoni 28 | Stéphane Urbanovski 29 | Tilo Renz 30 | Ton Voon 31 | Wolfgang Powisch 32 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | -------- 2 | NDO TODO 3 | -------- 4 | 5 | Updated: 12/27/2005 6 | 7 | There are still a number of things that need to be worked on with 8 | this project they include. 9 | 10 | 1. Change fields of type VARCHAR(255) to BLOBs. VARCHAR fields were 11 | easier for me to debug things as I was developing this addon, but 12 | several text fields can be longer than 255 chars. Nagios 3.0 13 | will allow multi-line plugin output, so this is especially important 14 | for future compatability. 15 | 16 | 2. Creation of a data dictionary to clearly explain each field 17 | present in all the tables. Also, define different possible values 18 | (constants) for each numeric field. This will aid in the quick 19 | development of a new web interface based off the data. 20 | 21 | 3. Creation of a SOCKSPLIT utility. The NDO module will only write 22 | output to a single UNIX domain or TCP socket (this has been done to 23 | minimize the potential overhead within the Nagios daemon). Since 24 | it might be useful to have output from the NDO module written to 25 | multiple databases (this would require multiple instances of the 26 | NDO2DB daemon to be running), there needs to be a way to replicate 27 | the output of the NDO module to more than one output socket. 28 | The SOCKSPLIT utility will create a single UNIX domain socket and 29 | listen for an incoming connection request. Upon a client connecting, 30 | any output from the client will be sent to multiple (destination) 31 | UNIX domain sockets. An NDO2DB daemon can be listening on the other 32 | end of each destination socket. The SOCKSPLIT utility will 33 | incorporate some method of buffering data if one or more destination 34 | sockets are closed for a period of time. This should make things 35 | resistant to situations where, for instance, NDO2DB daemons are 36 | unavailable because they are being restarted. 37 | 38 | 4. Testing, testing, testing! This addon has not been testing extensively 39 | and likely contains a number of bugs. However, its a good start, so 40 | send me your comments and patches! 41 | -------------------------------------------------------------------------------- /UPGRADING: -------------------------------------------------------------------------------- 1 | ------------- 2 | UPGRADE NOTES 3 | ------------- 4 | 5 | You will most likely need to upgrade the database schema when upgrading to 6 | new releases of the NDOUtils addon. You can do these easily by using the 7 | 'upgradedb' script in the db/ subdirectory as follows: 8 | 9 | cd db 10 | ./upgradedb 11 | 12 | You'll need to specify the database name, host, password, and username when 13 | using the upgrade script. 14 | 15 | 16 | Upgrading from the 1.3 or 1.3.1 releases: 17 | 18 | * The default table prefixed has changed from 'ndo_' to 'nagios_' 19 | * Several changes have been made to the DB structure 20 | * Use the mysql-upgrade-1.3.sql script in the db/ directory to upgrade your 21 | old DB to the new structure (back it up first!). 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /aclocal.m4: -------------------------------------------------------------------------------- 1 | # generated automatically by aclocal 1.9.5 -*- Autoconf -*- 2 | 3 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 4 | # 2005 Free Software Foundation, Inc. 5 | # This file is free software; the Free Software Foundation 6 | # gives unlimited permission to copy and/or distribute it, 7 | # with or without modifications, as long as this notice is preserved. 8 | 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without 11 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 12 | # PARTICULAR PURPOSE. 13 | 14 | m4_include([m4/np_mysqlclient.m4]) 15 | m4_include([macros/ax_nagios_get_os]) 16 | m4_include([macros/ax_nagios_get_distrib]) 17 | m4_include([macros/ax_nagios_get_init]) 18 | m4_include([macros/ax_nagios_get_inetd]) 19 | m4_include([macros/ax_nagios_get_paths]) 20 | m4_include([macros/ax_nagios_get_files]) 21 | m4_include([macros/ax_nagios_get_ssl]) 22 | -------------------------------------------------------------------------------- /config/misccommands.cfg.in: -------------------------------------------------------------------------------- 1 | # SAMPLE NDO FILE ROTATION COMMAND 2 | # 3 | # This is an example Nagios command definition that can be used to 4 | # rotate the NDO output file on a regular basis. Adjust the paths, etc. 5 | # to suit your needs. This definition will need to be included in your 6 | # Nagios config files if you want to use it. 7 | 8 | define command{ 9 | command_name rotate_ndo_log 10 | command_line /bin/mv @localstatedir@/ndo.dat @localstatedir@/ndo.`date +%s` 11 | } 12 | -------------------------------------------------------------------------------- /config/nagios.cfg.in: -------------------------------------------------------------------------------- 1 | # SAMPLE NAGIOS CONFIG SNIPPET FOR NDOMOD 2 | # 3 | # In order to have Nagios run the NDOMOD event broker module, you'll need 4 | # to place a statement like the one found below in your main Nagios 5 | # configuration file (nagios.cfg). Adjust the paths, etc. to suit your needs. 6 | 7 | broker_module=@bindir@/ndomod.o config_file=@sysconfdir@/ndomod.cfg 8 | -------------------------------------------------------------------------------- /db/README: -------------------------------------------------------------------------------- 1 | ================ 2 | DATABASE SCRIPTS 3 | ================ 4 | 5 | Here you'll find scripts to create the necessary database tables for MySQL servers. 6 | The queries/ subdirectory contains some example SQL queries for fetching data from the DB tables. 7 | 8 | 9 | File Name Description 10 | --------------------- ------------------------------------------------------------------------- 11 | mysql.sql Use this when you install the NDOUtils addon for the first time. It will 12 | create all the necessary tables for you. 13 | 14 | upgradedb Script that automates the DB upgrade process. Use this when upgrading! 15 | 16 | mysql-upgrade-*.sql Raw SQL scripts for upgrading from a previous release. Please use the upgradedb 17 | script (above) to upgrade your DB structure, rather than these scripts directly. 18 | 19 | 20 | -------------------------------------------------------------------------------- /db/installdb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # 3 | # SYNTAX: 4 | my $usage = "installdb -u user -p password -h hostname -d database [-P port]"; 5 | # 6 | # DESCRIPTION: 7 | # Runs installation script in this directory 8 | # Options as mysql's for authentication 9 | # 10 | # COPYRIGHT: 11 | # Copyright (C) 2005 Altinity Limited 12 | # Copyright is freely given to Ethan Galstad if included in the NDOUtils distribution 13 | # 14 | # LICENCE: 15 | # GNU GPLv2 16 | # 17 | # Last Updated: 03/21/2007 18 | # 19 | 20 | 21 | use strict; 22 | use FindBin qw($Bin); 23 | use Getopt::Std; 24 | use DBI; 25 | 26 | sub usage { 27 | print $usage,$/,"\t",$_[0],$/; 28 | exit 1; 29 | } 30 | 31 | my $opts = {}; 32 | getopts("u:p:h:d:P:", $opts) or usage "Bad options"; 33 | 34 | my $database = $opts->{d} || usage "Must specify a database"; 35 | my $hostname = $opts->{h} || "localhost"; 36 | my $username = $opts->{u} || usage "Must specify a username"; 37 | my $password = $opts->{p}; 38 | my $port = $opts->{P}; 39 | usage "Must specify a password" unless defined $password; # Could be blank 40 | 41 | # Connect to database 42 | my $dbh = DBI->connect("DBI:mysql:$database;$hostname:$port", 43 | $username, $password, 44 | { RaiseError => 1 }, 45 | ) 46 | or die "Cannot connect to database"; 47 | 48 | # Current database version 49 | my $thisversion="2.0.1"; 50 | 51 | # Create version table if it doesn't exist 52 | eval { $dbh->do("SELECT * FROM nagios_dbversion LIMIT 1") }; 53 | if ($@) { 54 | 55 | my $file="mysql.sql"; 56 | if (-e $file){ 57 | print "** Creating tables for version $thisversion",$/; 58 | print " Using $file for installation...",$/; 59 | my $p = "-p$password" if $password; # Not required if password is blank 60 | system("mysql -u $username $p -D$database -h$hostname < $file") == 0 or die "Installation from $file failed"; 61 | } 62 | else{ 63 | die "No installation script found!"; 64 | } 65 | 66 | print "** Updating table nagios_dbversion",$/; 67 | $dbh->do("INSERT nagios_dbversion SET name='ndoutils', version='$thisversion';"); 68 | 69 | print "Done!",$/; 70 | } 71 | else { 72 | print "*** Database already installed",$/; 73 | exit 0; 74 | }; 75 | 76 | -------------------------------------------------------------------------------- /db/mysql-mods-1.4b8.sql: -------------------------------------------------------------------------------- 1 | ; 05/03/08 2 | ALTER TABLE `nagios_hosts` ADD INDEX ( `host_object_id` ); 3 | 4 | ALTER TABLE `nagios_hoststatus` ADD INDEX ( `instance_id` ); 5 | ALTER TABLE `nagios_hoststatus` ADD INDEX ( `status_update_time` ); 6 | ALTER TABLE `nagios_hoststatus` ADD INDEX ( `current_state` ); 7 | ALTER TABLE `nagios_hoststatus` ADD INDEX ( `check_type` ); 8 | ALTER TABLE `nagios_hoststatus` ADD INDEX ( `state_type` ); 9 | ALTER TABLE `nagios_hoststatus` ADD INDEX ( `last_state_change` ); 10 | ALTER TABLE `nagios_hoststatus` ADD INDEX ( `notifications_enabled` ); 11 | ALTER TABLE `nagios_hoststatus` ADD INDEX ( `problem_has_been_acknowledged` ); 12 | ALTER TABLE `nagios_hoststatus` ADD INDEX ( `active_checks_enabled` ); 13 | ALTER TABLE `nagios_hoststatus` ADD INDEX ( `passive_checks_enabled` ); 14 | ALTER TABLE `nagios_hoststatus` ADD INDEX ( `event_handler_enabled` ); 15 | ALTER TABLE `nagios_hoststatus` ADD INDEX ( `flap_detection_enabled` ); 16 | ALTER TABLE `nagios_hoststatus` ADD INDEX ( `is_flapping` ); 17 | ALTER TABLE `nagios_hoststatus` ADD INDEX ( `percent_state_change` ); 18 | ALTER TABLE `nagios_hoststatus` ADD INDEX ( `latency` ); 19 | ALTER TABLE `nagios_hoststatus` ADD INDEX ( `execution_time` ); 20 | ALTER TABLE `nagios_hoststatus` ADD INDEX ( `scheduled_downtime_depth` ); 21 | 22 | ALTER TABLE `nagios_services` ADD INDEX ( `service_object_id` ); 23 | 24 | ALTER TABLE `nagios_servicestatus` ADD INDEX ( `instance_id` ); 25 | ALTER TABLE `nagios_servicestatus` ADD INDEX ( `status_update_time` ); 26 | ALTER TABLE `nagios_servicestatus` ADD INDEX ( `current_state` ); 27 | ALTER TABLE `nagios_servicestatus` ADD INDEX ( `check_type` ); 28 | ALTER TABLE `nagios_servicestatus` ADD INDEX ( `state_type` ); 29 | ALTER TABLE `nagios_servicestatus` ADD INDEX ( `last_state_change` ); 30 | ALTER TABLE `nagios_servicestatus` ADD INDEX ( `notifications_enabled` ); 31 | ALTER TABLE `nagios_servicestatus` ADD INDEX ( `problem_has_been_acknowledged` ); 32 | ALTER TABLE `nagios_servicestatus` ADD INDEX ( `active_checks_enabled` ); 33 | ALTER TABLE `nagios_servicestatus` ADD INDEX ( `passive_checks_enabled` ); 34 | ALTER TABLE `nagios_servicestatus` ADD INDEX ( `event_handler_enabled` ); 35 | ALTER TABLE `nagios_servicestatus` ADD INDEX ( `flap_detection_enabled` ); 36 | ALTER TABLE `nagios_servicestatus` ADD INDEX ( `is_flapping` ); 37 | ALTER TABLE `nagios_servicestatus` ADD INDEX ( `percent_state_change` ); 38 | ALTER TABLE `nagios_servicestatus` ADD INDEX ( `latency` ); 39 | ALTER TABLE `nagios_servicestatus` ADD INDEX ( `execution_time` ); 40 | ALTER TABLE `nagios_servicestatus` ADD INDEX ( `scheduled_downtime_depth` ); 41 | 42 | 43 | ALTER TABLE `nagios_timedeventqueue` ADD INDEX ( `instance_id` ); 44 | ALTER TABLE `nagios_timedeventqueue` ADD INDEX ( `event_type` ); 45 | ALTER TABLE `nagios_timedeventqueue` ADD INDEX ( `scheduled_time` ); 46 | ALTER TABLE `nagios_timedeventqueue` ADD INDEX ( `object_id` ); 47 | 48 | ALTER TABLE `nagios_timedevents` DROP INDEX `instance_id` ; 49 | ALTER TABLE `nagios_timedevents` ADD INDEX ( `instance_id` ); 50 | ALTER TABLE `nagios_timedevents` ADD INDEX ( `event_type` ); 51 | ALTER TABLE `nagios_timedevents` ADD INDEX ( `scheduled_time` ); 52 | ALTER TABLE `nagios_timedevents` ADD INDEX ( `object_id` ); 53 | 54 | ALTER TABLE `nagios_systemcommands` DROP INDEX `instance_id`; 55 | ALTER TABLE `nagios_systemcommands` ADD INDEX ( `instance_id` ); 56 | 57 | ALTER TABLE `nagios_servicechecks` DROP INDEX `instance_id`; 58 | ALTER TABLE `nagios_servicechecks` ADD INDEX ( `instance_id` ); 59 | ALTER TABLE `nagios_servicechecks` ADD INDEX ( `service_object_id` ); 60 | ALTER TABLE `nagios_servicechecks` ADD INDEX ( `start_time` ); 61 | 62 | ALTER TABLE `nagios_configfilevariables` DROP INDEX `instance_id`; 63 | 64 | 65 | -------------------------------------------------------------------------------- /db/mysql-upgrade-1.4b8.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `nagios_hostchecks` ADD COLUMN `long_output` TEXT NOT NULL default '' AFTER `output`; 2 | ALTER TABLE `nagios_hoststatus` ADD COLUMN `long_output` TEXT NOT NULL default '' AFTER `output`; 3 | ALTER TABLE `nagios_servicechecks` ADD COLUMN `long_output` TEXT NOT NULL default '' AFTER `output`; 4 | ALTER TABLE `nagios_servicestatus` ADD COLUMN `long_output` TEXT NOT NULL default '' AFTER `output`; 5 | ALTER TABLE `nagios_statehistory` ADD COLUMN `long_output` TEXT NOT NULL default '' AFTER `output`; 6 | 7 | ALTER TABLE `nagios_eventhandlers` ADD COLUMN `long_output` TEXT NOT NULL default '' AFTER `output`; 8 | ALTER TABLE `nagios_systemcommands` ADD COLUMN `long_output` TEXT NOT NULL default '' AFTER `output`; 9 | ALTER TABLE `nagios_notifications` ADD COLUMN `long_output` TEXT NOT NULL default '' AFTER `output`; 10 | 11 | ALTER TABLE `nagios_hostchecks` MODIFY COLUMN `perfdata` TEXT NULL; 12 | ALTER TABLE `nagios_hoststatus` MODIFY COLUMN `perfdata` TEXT NULL; 13 | ALTER TABLE `nagios_servicechecks` MODIFY COLUMN `perfdata` TEXT NULL; 14 | ALTER TABLE `nagios_servicestatus` MODIFY COLUMN `perfdata` TEXT NULL; 15 | -------------------------------------------------------------------------------- /db/mysql-upgrade-2.0.0.sql: -------------------------------------------------------------------------------- 1 | -- BEGIN 2.0 MODS 2 | 3 | ALTER TABLE `nagios_notifications` ADD INDEX (`start_time`); 4 | ALTER TABLE `nagios_contactnotifications` ADD INDEX (`start_time`); 5 | ALTER TABLE `nagios_contactnotificationmethods` ADD INDEX (`start_time`); 6 | ALTER TABLE `nagios_logentries` ADD INDEX (`logentry_time`); 7 | ALTER TABLE `nagios_acknowledgements` ADD INDEX (`entry_time`); 8 | ALTER TABLE `nagios_contacts` ADD `minimum_importance` int(11) NOT NULL default '0'; 9 | ALTER TABLE `nagios_hosts` ADD `importance` int(11) NOT NULL default '0'; 10 | ALTER TABLE `nagios_services` ADD `importance` int(11) NOT NULL default '0'; 11 | 12 | set @exist := (select count(*) from information_schema.statistics where table_name = 'nagios_logentries' and index_name = 'instance_id'); 13 | set @sqlstmt := if( @exist > 0, 'ALTER TABLE `nagios_logentries` DROP KEY `instance_id`', 'select ''INFO: Index does not exists.'''); 14 | PREPARE stmt FROM @sqlstmt; 15 | EXECUTE stmt; 16 | 17 | ALTER TABLE `nagios_logentries` ADD UNIQUE KEY `instance_id` (`instance_id`,`logentry_time`,`entry_time`,`entry_time_usec`); 18 | 19 | -- Table structure for table `nagios_service_parentservices` 20 | -- 21 | 22 | CREATE TABLE IF NOT EXISTS `nagios_service_parentservices` ( 23 | `service_parentservice_id` int(11) NOT NULL auto_increment, 24 | `instance_id` smallint(6) NOT NULL default '0', 25 | `service_id` int(11) NOT NULL default '0', 26 | `parent_service_object_id` int(11) NOT NULL default '0', 27 | PRIMARY KEY (`service_parentservice_id`), 28 | UNIQUE KEY `instance_id` (`service_id`,`parent_service_object_id`) 29 | ) ENGINE=MyISAM COMMENT='Parent services'; 30 | 31 | -- -------------------------------------------------------- 32 | 33 | -- 34 | 35 | -- END 2.0 MODS 36 | 37 | -------------------------------------------------------------------------------- /db/mysql-upgrade-2.0.1.sql: -------------------------------------------------------------------------------- 1 | -- BEGIN 2.0.1 MODS 2 | 3 | set @exist := (select count(*) from information_schema.statistics where table_name = 'nagios_logentries' and index_name = 'instance_id'); 4 | set @sqlstmt := if( @exist > 0, 'ALTER TABLE `nagios_logentries` DROP KEY `instance_id`', 'select ''INFO: Index does not exists.'''); 5 | PREPARE stmt FROM @sqlstmt; 6 | EXECUTE stmt; 7 | 8 | ALTER TABLE `nagios_logentries` ADD UNIQUE KEY `instance_id` (`instance_id`,`logentry_time`,`entry_time`,`entry_time_usec`); 9 | 10 | -- -------------------------------------------------------- 11 | 12 | -- 13 | 14 | -- END 2.0.1 MODS 15 | 16 | -------------------------------------------------------------------------------- /db/mysql-upgrade-2.1.0.sql: -------------------------------------------------------------------------------- 1 | -- BEGIN 2.1.0 MODS 2 | 3 | set @exist := (select count(*) from information_schema.statistics where table_name = 'nagios_logentries' and index_name = 'instance_id'); 4 | set @sqlstmt := if( @exist > 0, 'ALTER TABLE `nagios_logentries` DROP KEY `instance_id`', 'select ''INFO: Index does not exists.'''); 5 | PREPARE stmt FROM @sqlstmt; 6 | EXECUTE stmt; 7 | 8 | ALTER TABLE `nagios_logentries` ADD UNIQUE KEY `instance_id` (`instance_id`,`logentry_time`,`entry_time`,`entry_time_usec`,`logentry_id`); 9 | 10 | -- -------------------------------------------------------- 11 | 12 | -- 13 | 14 | -- END 2.1.0 MODS 15 | 16 | -------------------------------------------------------------------------------- /db/mysql-upgrade-2.1.2.sql: -------------------------------------------------------------------------------- 1 | -- BEGIN 2.1.2 MODS 2 | 3 | ALTER TABLE `nagios_scheduleddowntime` MODIFY COLUMN `duration` int NOT NULL default '0'; 4 | 5 | -- -------------------------------------------------------- 6 | 7 | -- 8 | 9 | -- END 2.1.2 MODS 10 | 11 | -------------------------------------------------------------------------------- /db/prepsql: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Strip charset from db dump, so it defaults to user's 3 | # Suggested by Ton Voon/Altinity 4 | 5 | perl -pi -e 's/DEFAULT CHARSET=ascii //' mysql.sql 6 | perl -pi -e 's/ DEFAULT CHARSET=ascii//' mysql.sql 7 | -------------------------------------------------------------------------------- /db/queries/comment_history.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | nagios_instances.instance_id 3 | ,nagios_instances.instance_name 4 | ,nagios_commenthistory.object_id 5 | ,obj1.objecttype_id 6 | ,obj1.name1 AS host_name 7 | ,obj1.name2 AS service_description 8 | ,nagios_commenthistory.* 9 | FROM `nagios_commenthistory` 10 | LEFT JOIN nagios_objects as obj1 ON nagios_commenthistory.object_id=obj1.object_id 11 | LEFT JOIN nagios_instances ON nagios_commenthistory.instance_id=nagios_instances.instance_id 12 | ORDER BY entry_time DESC, entry_time_usec DESC, commenthistory_id DESC 13 | 14 | -------------------------------------------------------------------------------- /db/queries/comments.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | nagios_instances.instance_id 3 | ,nagios_instances.instance_name 4 | ,nagios_comments.object_id 5 | ,obj1.objecttype_id 6 | ,obj1.name1 AS host_name 7 | ,obj1.name2 AS service_description 8 | ,nagios_comments.* 9 | FROM `nagios_comments` 10 | LEFT JOIN nagios_objects as obj1 ON nagios_comments.object_id=obj1.object_id 11 | LEFT JOIN nagios_instances ON nagios_comments.instance_id=nagios_instances.instance_id 12 | ORDER BY entry_time DESC, entry_time_usec DESC, comment_id DESC 13 | 14 | -------------------------------------------------------------------------------- /db/queries/contact_notification_methods.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | nagios_instances.instance_id 3 | ,nagios_instances.instance_name 4 | ,nagios_notifications.object_id 5 | ,obj1.objecttype_id 6 | ,obj1.name1 AS host_name 7 | ,obj1.name2 AS service_description 8 | ,obj2.name1 AS contact_name 9 | ,nagios_contactnotifications.start_time AS notification_start_time 10 | ,nagios_contactnotifications.start_time_usec AS notification_start_time_usec 11 | ,nagios_contactnotifications.end_time AS notification_end_time 12 | ,nagios_contactnotifications.end_time_usec AS notification_end_time_usec 13 | ,obj3.name1 AS notification_command_name 14 | ,nagios_contactnotificationmethods.* 15 | FROM `nagios_contactnotificationmethods` 16 | JOIN nagios_contactnotifications ON nagios_contactnotificationmethods.contactnotification_id=nagios_contactnotifications.contactnotification_id 17 | JOIN nagios_notifications ON nagios_contactnotifications.notification_id=nagios_notifications.notification_id 18 | LEFT JOIN nagios_objects as obj1 ON nagios_notifications.object_id=obj1.object_id 19 | LEFT JOIN nagios_objects as obj2 ON nagios_contactnotifications.contact_object_id=obj2.object_id 20 | LEFT JOIN nagios_objects as obj3 ON nagios_contactnotificationmethods.command_object_id=obj3.object_id 21 | LEFT JOIN nagios_instances ON nagios_notifications.instance_id=nagios_instances.instance_id 22 | ORDER BY start_time DESC, start_time_usec DESC 23 | 24 | -------------------------------------------------------------------------------- /db/queries/contact_notifications.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | nagios_instances.instance_id 3 | ,nagios_instances.instance_name 4 | ,nagios_notifications.object_id 5 | ,obj1.objecttype_id 6 | ,obj1.name1 AS host_name 7 | ,obj1.name2 AS service_description 8 | ,obj2.name1 AS contact_name 9 | ,nagios_contactnotifications.* 10 | FROM `nagios_contactnotifications` 11 | JOIN nagios_notifications ON nagios_contactnotifications.notification_id=nagios_notifications.notification_id 12 | LEFT JOIN nagios_objects as obj1 ON nagios_notifications.object_id=obj1.object_id 13 | LEFT JOIN nagios_objects as obj2 ON nagios_contactnotifications.contact_object_id=obj2.object_id 14 | LEFT JOIN nagios_instances ON nagios_notifications.instance_id=nagios_instances.instance_id 15 | ORDER BY start_time DESC, start_time_usec DESC 16 | 17 | -------------------------------------------------------------------------------- /db/queries/contact_status.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | nagios_instances.instance_id 3 | ,nagios_instances.instance_name 4 | ,nagios_contacts.contact_object_id 5 | ,obj1.name1 AS contact_name 6 | ,nagios_contactstatus.* 7 | FROM `nagios_contactstatus` 8 | LEFT JOIN nagios_objects as obj1 ON nagios_contactstatus.contact_object_id=obj1.object_id 9 | LEFT JOIN nagios_contacts ON nagios_contactstatus.contact_object_id=nagios_contacts.contact_object_id 10 | LEFT JOIN nagios_instances ON nagios_contacts.instance_id=nagios_instances.instance_id 11 | WHERE nagios_contacts.config_type='1' 12 | ORDER BY instance_name ASC, contact_name ASC -------------------------------------------------------------------------------- /db/queries/contactgroup_membership.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | nagios_instances.instance_id 3 | ,nagios_instances.instance_name 4 | ,nagios_contactgroups.contactgroup_id 5 | ,nagios_contactgroups.contactgroup_object_id 6 | ,obj1.name1 AS contactgroup_name 7 | ,nagios_contactgroups.alias AS contactgroup_alias 8 | ,nagios_contacts.contact_object_id 9 | ,obj2.name1 AS contact_name 10 | FROM `nagios_contactgroups` 11 | INNER JOIN nagios_contactgroup_members ON nagios_contactgroups.contactgroup_id=nagios_contactgroup_members.contactgroup_id 12 | INNER JOIN nagios_contacts ON nagios_contactgroup_members.contact_object_id=nagios_contacts.contact_object_id 13 | INNER JOIN nagios_objects as obj1 ON nagios_contactgroups.contactgroup_object_id=obj1.object_id 14 | INNER JOIN nagios_objects as obj2 ON nagios_contactgroup_members.contact_object_id=obj2.object_id 15 | INNER JOIN nagios_instances ON nagios_contactgroups.instance_id=nagios_instances.instance_id -------------------------------------------------------------------------------- /db/queries/contacts.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | nagios_instances.instance_id 3 | ,nagios_instances.instance_name 4 | ,nagios_contacts.contact_object_id 5 | ,obj1.name1 AS contact_name 6 | FROM `nagios_contacts` 7 | LEFT JOIN nagios_objects as obj1 ON nagios_contacts.contact_object_id=obj1.object_id 8 | LEFT JOIN nagios_instances ON nagios_contacts.instance_id=nagios_instances.instance_id 9 | WHERE nagios_contacts.config_type='1' 10 | ORDER BY instance_name ASC, contact_name ASC 11 | 12 | -------------------------------------------------------------------------------- /db/queries/downtime_history.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | nagios_instances.instance_id 3 | ,nagios_instances.instance_name 4 | ,nagios_downtimehistory.object_id 5 | ,obj1.objecttype_id 6 | ,obj1.name1 AS host_name 7 | ,obj1.name2 AS service_description 8 | ,nagios_downtimehistory.* 9 | FROM `nagios_downtimehistory` 10 | LEFT JOIN nagios_objects as obj1 ON nagios_downtimehistory.object_id=obj1.object_id 11 | LEFT JOIN nagios_instances ON nagios_downtimehistory.instance_id=nagios_instances.instance_id 12 | ORDER BY scheduled_start_time DESC, actual_start_time DESC, actual_start_time_usec DESC, downtimehistory_id DESC 13 | 14 | -------------------------------------------------------------------------------- /db/queries/event_handlers.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | nagios_instances.instance_id 3 | ,nagios_instances.instance_name 4 | ,nagios_eventhandlers.object_id 5 | ,obj1.objecttype_id 6 | ,obj1.name1 AS host_name 7 | ,obj1.name2 AS service_description 8 | ,nagios_eventhandlers.* 9 | FROM `nagios_eventhandlers` 10 | LEFT JOIN nagios_objects as obj1 ON nagios_eventhandlers.object_id=obj1.object_id 11 | LEFT JOIN nagios_instances ON nagios_eventhandlers.instance_id=nagios_instances.instance_id 12 | ORDER BY start_time DESC, start_time_usec DESC, eventhandler_id DESC 13 | 14 | -------------------------------------------------------------------------------- /db/queries/flapping_history.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | nagios_instances.instance_id 3 | ,nagios_instances.instance_name 4 | ,nagios_flappinghistory.object_id 5 | ,obj1.objecttype_id 6 | ,obj1.name1 AS host_name 7 | ,obj1.name2 AS service_description 8 | ,nagios_flappinghistory.* 9 | FROM `nagios_flappinghistory` 10 | LEFT JOIN nagios_objects as obj1 ON nagios_flappinghistory.object_id=obj1.object_id 11 | LEFT JOIN nagios_instances ON nagios_flappinghistory.instance_id=nagios_instances.instance_id 12 | ORDER BY event_time DESC, event_time_usec DESC, flappinghistory_id DESC 13 | 14 | -------------------------------------------------------------------------------- /db/queries/host_comments.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | nagios_instances.instance_id 3 | ,nagios_instances.instance_name 4 | ,nagios_comments.object_id 5 | ,obj1.name1 AS host_name 6 | ,nagios_comments.* 7 | FROM `nagios_comments` 8 | LEFT JOIN nagios_objects as obj1 ON nagios_comments.object_id=obj1.object_id 9 | LEFT JOIN nagios_instances ON nagios_comments.instance_id=nagios_instances.instance_id 10 | WHERE obj1.objecttype_id='1' 11 | ORDER BY entry_time DESC, entry_time_usec DESC, comment_id DESC 12 | 13 | -------------------------------------------------------------------------------- /db/queries/host_downtime_history.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | nagios_instances.instance_id 3 | ,nagios_instances.instance_name 4 | ,nagios_downtimehistory.object_id 5 | ,obj1.name1 AS host_name 6 | ,nagios_downtimehistory.* 7 | FROM `nagios_downtimehistory` 8 | LEFT JOIN nagios_objects as obj1 ON nagios_downtimehistory.object_id=obj1.object_id 9 | LEFT JOIN nagios_instances ON nagios_downtimehistory.instance_id=nagios_instances.instance_id 10 | WHERE obj1.objecttype_id='1' 11 | ORDER BY scheduled_start_time DESC, actual_start_time DESC, actual_start_time_usec DESC, downtimehistory_id DESC 12 | 13 | -------------------------------------------------------------------------------- /db/queries/host_event_handlers.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | nagios_instances.instance_id 3 | ,nagios_instances.instance_name 4 | ,nagios_eventhandlers.object_id 5 | ,obj1.name1 AS host_name 6 | ,nagios_eventhandlers.* 7 | FROM `nagios_eventhandlers` 8 | LEFT JOIN nagios_objects as obj1 ON nagios_eventhandlers.object_id=obj1.object_id 9 | LEFT JOIN nagios_instances ON nagios_eventhandlers.instance_id=nagios_instances.instance_id 10 | WHERE obj1.objecttype_id='1' 11 | ORDER BY start_time DESC, start_time_usec DESC, eventhandler_id DESC 12 | 13 | -------------------------------------------------------------------------------- /db/queries/host_flapping_history.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | nagios_instances.instance_id 3 | ,nagios_instances.instance_name 4 | ,nagios_flappinghistory.object_id 5 | ,obj1.name1 AS host_name 6 | ,nagios_flappinghistory.* 7 | FROM `nagios_flappinghistory` 8 | LEFT JOIN nagios_objects as obj1 ON nagios_flappinghistory.object_id=obj1.object_id 9 | LEFT JOIN nagios_instances ON nagios_flappinghistory.instance_id=nagios_instances.instance_id 10 | WHERE obj1.objecttype_id='1' 11 | ORDER BY event_time DESC, event_time_usec DESC, flappinghistory_id DESC 12 | 13 | -------------------------------------------------------------------------------- /db/queries/host_notifications.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | nagios_instances.instance_id 3 | ,nagios_instances.instance_name 4 | ,nagios_notifications.object_id AS host_object_id 5 | ,obj1.name1 AS host_name 6 | ,nagios_notifications.* 7 | FROM `nagios_notifications` 8 | LEFT JOIN nagios_objects as obj1 ON nagios_notifications.object_id=obj1.object_id 9 | LEFT JOIN nagios_instances ON nagios_notifications.instance_id=nagios_instances.instance_id 10 | WHERE obj1.objecttype_id='1' 11 | ORDER BY start_time DESC, start_time_usec DESC -------------------------------------------------------------------------------- /db/queries/host_state_history.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | nagios_instances.instance_id 3 | ,nagios_instances.instance_name 4 | ,nagios_statehistory.object_id 5 | ,obj1.name1 AS host_name 6 | ,nagios_statehistory.* 7 | FROM `nagios_statehistory` 8 | LEFT JOIN nagios_objects as obj1 ON nagios_statehistory.object_id=obj1.object_id 9 | LEFT JOIN nagios_instances ON nagios_statehistory.instance_id=nagios_instances.instance_id 10 | WHERE obj1.objecttype_id='1' 11 | ORDER BY state_time DESC, state_time_usec DESC 12 | 13 | -------------------------------------------------------------------------------- /db/queries/host_status.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | nagios_instances.instance_id 3 | ,nagios_instances.instance_name 4 | ,nagios_hosts.host_object_id 5 | ,obj1.name1 AS host_name 6 | ,nagios_hoststatus.* 7 | FROM `nagios_hoststatus` 8 | LEFT JOIN nagios_objects as obj1 ON nagios_hoststatus.host_object_id=obj1.object_id 9 | LEFT JOIN nagios_hosts ON nagios_hoststatus.host_object_id=nagios_hosts.host_object_id 10 | LEFT JOIN nagios_instances ON nagios_hosts.instance_id=nagios_instances.instance_id 11 | WHERE nagios_hosts.config_type='1' 12 | ORDER BY instance_name ASC, host_name ASC -------------------------------------------------------------------------------- /db/queries/hostgroup_membership.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | nagios_instances.instance_id 3 | ,nagios_instances.instance_name 4 | ,nagios_hostgroups.hostgroup_id 5 | ,nagios_hostgroups.hostgroup_object_id 6 | ,obj1.name1 AS hostgroup_name 7 | ,nagios_hostgroups.alias AS hostgroup_alias 8 | ,nagios_hosts.host_object_id 9 | ,obj2.name1 AS host_name 10 | FROM `nagios_hostgroups` 11 | INNER JOIN nagios_hostgroup_members ON nagios_hostgroups.hostgroup_id=nagios_hostgroup_members.hostgroup_id 12 | INNER JOIN nagios_hosts ON nagios_hostgroup_members.host_object_id=nagios_hosts.host_object_id 13 | INNER JOIN nagios_objects as obj1 ON nagios_hostgroups.hostgroup_object_id=obj1.object_id 14 | INNER JOIN nagios_objects as obj2 ON nagios_hostgroup_members.host_object_id=obj2.object_id 15 | INNER JOIN nagios_instances ON nagios_hostgroups.instance_id=nagios_instances.instance_id -------------------------------------------------------------------------------- /db/queries/hosts.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | nagios_instances.instance_id 3 | ,nagios_instances.instance_name 4 | ,nagios_hosts.host_object_id 5 | ,obj1.name1 AS host_name 6 | FROM `nagios_hosts` 7 | LEFT JOIN nagios_objects as obj1 ON nagios_hosts.host_object_id=obj1.object_id 8 | LEFT JOIN nagios_instances ON nagios_hosts.instance_id=nagios_instances.instance_id 9 | WHERE nagios_hosts.config_type='1' 10 | ORDER BY instance_name ASC, host_name ASC 11 | 12 | -------------------------------------------------------------------------------- /db/queries/notifications.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | nagios_instances.instance_id 3 | ,nagios_instances.instance_name 4 | ,nagios_notifications.object_id 5 | ,obj1.objecttype_id 6 | ,obj1.name1 AS host_name 7 | ,obj1.name2 AS service_description 8 | ,nagios_notifications.* 9 | FROM `nagios_notifications` 10 | LEFT JOIN nagios_objects as obj1 ON nagios_notifications.object_id=obj1.object_id 11 | LEFT JOIN nagios_instances ON nagios_notifications.instance_id=nagios_instances.instance_id 12 | ORDER BY start_time DESC, start_time_usec DESC 13 | 14 | -------------------------------------------------------------------------------- /db/queries/scheduled_downtime.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | nagios_instances.instance_id 3 | ,nagios_instances.instance_name 4 | ,nagios_scheduleddowntime.object_id 5 | ,obj1.objecttype_id 6 | ,obj1.name1 AS host_name 7 | ,obj1.name2 AS service_description 8 | ,nagios_scheduleddowntime.* 9 | FROM `nagios_scheduleddowntime` 10 | LEFT JOIN nagios_objects as obj1 ON nagios_scheduleddowntime.object_id=obj1.object_id 11 | LEFT JOIN nagios_instances ON nagios_scheduleddowntime.instance_id=nagios_instances.instance_id 12 | ORDER BY scheduled_start_time DESC, scheduleddowntime_id DESC 13 | 14 | -------------------------------------------------------------------------------- /db/queries/service_comments.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | nagios_instances.instance_id 3 | ,nagios_instances.instance_name 4 | ,nagios_comments.object_id 5 | ,obj1.name1 AS host_name 6 | ,obj1.name2 AS service_description 7 | ,nagios_comments.* 8 | FROM `nagios_comments` 9 | LEFT JOIN nagios_objects as obj1 ON nagios_comments.object_id=obj1.object_id 10 | LEFT JOIN nagios_instances ON nagios_comments.instance_id=nagios_instances.instance_id 11 | WHERE obj1.objecttype_id='2' 12 | ORDER BY entry_time DESC, entry_time_usec DESC, comment_id DESC 13 | 14 | -------------------------------------------------------------------------------- /db/queries/service_downtime_history.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | nagios_instances.instance_id 3 | ,nagios_instances.instance_name 4 | ,nagios_downtimehistory.object_id 5 | ,obj1.name1 AS host_name 6 | ,obj1.name2 AS service_description 7 | ,nagios_downtimehistory.* 8 | FROM `nagios_downtimehistory` 9 | LEFT JOIN nagios_objects as obj1 ON nagios_downtimehistory.object_id=obj1.object_id 10 | LEFT JOIN nagios_instances ON nagios_downtimehistory.instance_id=nagios_instances.instance_id 11 | WHERE obj1.objecttype_id='2' 12 | ORDER BY scheduled_start_time DESC, actual_start_time DESC, actual_start_time_usec DESC, downtimehistory_id DESC 13 | 14 | -------------------------------------------------------------------------------- /db/queries/service_event_handlers.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | nagios_instances.instance_id 3 | ,nagios_instances.instance_name 4 | ,nagios_eventhandlers.object_id 5 | ,obj1.name1 AS host_name 6 | ,obj1.name2 AS service_description 7 | ,nagios_eventhandlers.* 8 | FROM `nagios_eventhandlers` 9 | LEFT JOIN nagios_objects as obj1 ON nagios_eventhandlers.object_id=obj1.object_id 10 | LEFT JOIN nagios_instances ON nagios_eventhandlers.instance_id=nagios_instances.instance_id 11 | WHERE obj1.objecttype_id='2' 12 | ORDER BY start_time DESC, start_time_usec DESC, eventhandler_id DESC 13 | 14 | -------------------------------------------------------------------------------- /db/queries/service_flapping_history.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | nagios_instances.instance_id 3 | ,nagios_instances.instance_name 4 | ,nagios_flappinghistory.object_id 5 | ,obj1.name1 AS host_name 6 | ,obj1.name2 AS service_description 7 | ,nagios_flappinghistory.* 8 | FROM `nagios_flappinghistory` 9 | LEFT JOIN nagios_objects as obj1 ON nagios_flappinghistory.object_id=obj1.object_id 10 | LEFT JOIN nagios_instances ON nagios_flappinghistory.instance_id=nagios_instances.instance_id 11 | WHERE obj1.objecttype_id='2' 12 | ORDER BY event_time DESC, event_time_usec DESC, flappinghistory_id DESC 13 | 14 | -------------------------------------------------------------------------------- /db/queries/service_notifications.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | nagios_instances.instance_id 3 | ,nagios_instances.instance_name 4 | ,nagios_notifications.object_id AS service_object_id 5 | ,obj1.name1 AS host_name 6 | ,obj1.name2 AS service_description 7 | ,nagios_notifications.* 8 | FROM `nagios_notifications` 9 | LEFT JOIN nagios_objects as obj1 ON nagios_notifications.object_id=obj1.object_id 10 | LEFT JOIN nagios_instances ON nagios_notifications.instance_id=nagios_instances.instance_id 11 | WHERE obj1.objecttype_id='2' 12 | ORDER BY start_time DESC, start_time_usec DESC -------------------------------------------------------------------------------- /db/queries/service_state_history.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | nagios_instances.instance_id 3 | ,nagios_instances.instance_name 4 | ,nagios_statehistory.object_id 5 | ,obj1.name1 AS host_name 6 | ,obj1.name2 AS service_description 7 | ,nagios_statehistory.* 8 | FROM `nagios_statehistory` 9 | LEFT JOIN nagios_objects as obj1 ON nagios_statehistory.object_id=obj1.object_id 10 | LEFT JOIN nagios_instances ON nagios_statehistory.instance_id=nagios_instances.instance_id 11 | WHERE obj1.objecttype_id='2' 12 | ORDER BY state_time DESC, state_time_usec DESC 13 | 14 | -------------------------------------------------------------------------------- /db/queries/service_status.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | nagios_instances.instance_id 3 | ,nagios_instances.instance_name 4 | ,nagios_services.host_object_id 5 | ,obj1.name1 AS host_name 6 | ,nagios_services.service_object_id 7 | ,obj1.name2 AS service_description 8 | ,nagios_servicestatus.* 9 | FROM `nagios_servicestatus` 10 | LEFT JOIN nagios_objects as obj1 ON nagios_servicestatus.service_object_id=obj1.object_id 11 | LEFT JOIN nagios_services ON nagios_servicestatus.service_object_id=nagios_services.service_object_id 12 | LEFT JOIN nagios_instances ON nagios_services.instance_id=nagios_instances.instance_id 13 | WHERE nagios_services.config_type='1' 14 | ORDER BY instance_name ASC, host_name ASC, service_description ASC -------------------------------------------------------------------------------- /db/queries/servicegroup_membership.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | nagios_instances.instance_id 3 | ,nagios_instances.instance_name 4 | ,nagios_servicegroups.servicegroup_id 5 | ,nagios_servicegroups.servicegroup_object_id 6 | ,obj1.name1 AS servicegroup_name 7 | ,nagios_servicegroups.alias AS servicegroup_alias 8 | ,nagios_services.service_object_id 9 | ,obj2.name1 AS host_name 10 | ,obj2.name2 AS service_description 11 | FROM `nagios_servicegroups` 12 | INNER JOIN nagios_servicegroup_members ON nagios_servicegroups.servicegroup_id=nagios_servicegroup_members.servicegroup_id 13 | INNER JOIN nagios_services ON nagios_servicegroup_members.service_object_id=nagios_services.service_object_id 14 | INNER JOIN nagios_objects as obj1 ON nagios_servicegroups.servicegroup_object_id=obj1.object_id 15 | INNER JOIN nagios_objects as obj2 ON nagios_servicegroup_members.service_object_id=obj2.object_id 16 | INNER JOIN nagios_instances ON nagios_servicegroups.instance_id=nagios_instances.instance_id -------------------------------------------------------------------------------- /db/queries/services.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | nagios_instances.instance_id 3 | ,nagios_instances.instance_name 4 | ,nagios_services.host_object_id 5 | ,obj1.name1 AS host_name 6 | ,nagios_services.service_object_id 7 | ,obj1.name2 AS service_description 8 | FROM `nagios_services` 9 | LEFT JOIN nagios_objects as obj1 ON nagios_services.service_object_id=obj1.object_id 10 | LEFT JOIN nagios_instances ON nagios_services.instance_id=nagios_instances.instance_id 11 | WHERE nagios_services.config_type='1' 12 | ORDER BY instance_name ASC, host_name ASC, service_description ASC 13 | 14 | -------------------------------------------------------------------------------- /db/queries/state_history.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | nagios_instances.instance_id 3 | ,nagios_instances.instance_name 4 | ,nagios_statehistory.object_id 5 | ,obj1.objecttype_id 6 | ,obj1.name1 AS host_name 7 | ,obj1.name2 AS service_description 8 | ,nagios_statehistory.* 9 | FROM `nagios_statehistory` 10 | LEFT JOIN nagios_objects as obj1 ON nagios_statehistory.object_id=obj1.object_id 11 | LEFT JOIN nagios_instances ON nagios_statehistory.instance_id=nagios_instances.instance_id 12 | ORDER BY state_time DESC, state_time_usec DESC 13 | 14 | -------------------------------------------------------------------------------- /db/queries/timed_event_queue.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | nagios_instances.instance_id 3 | ,nagios_instances.instance_name 4 | ,nagios_timedeventqueue.event_type 5 | ,nagios_timedeventqueue.scheduled_time 6 | ,nagios_timedeventqueue.recurring_event 7 | ,obj1.objecttype_id 8 | ,nagios_timedeventqueue.object_id 9 | ,obj1.name1 AS host_name 10 | ,obj1.name2 AS service_description 11 | FROM `nagios_timedeventqueue` 12 | LEFT JOIN nagios_objects as obj1 ON nagios_timedeventqueue.object_id=obj1.object_id 13 | LEFT JOIN nagios_instances ON nagios_timedeventqueue.instance_id=nagios_instances.instance_id 14 | ORDER BY scheduled_time ASC, timedeventqueue_id ASC 15 | 16 | -------------------------------------------------------------------------------- /db/queries/timed_events.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | nagios_instances.instance_id 3 | ,nagios_instances.instance_name 4 | ,nagios_timedevents.event_type 5 | ,nagios_timedevents.scheduled_time 6 | ,nagios_timedevents.event_time 7 | ,nagios_timedevents.event_time_usec 8 | ,nagios_timedevents.recurring_event 9 | ,obj1.objecttype_id 10 | ,nagios_timedevents.object_id 11 | ,obj1.name1 AS host_name 12 | ,obj1.name2 AS service_description 13 | FROM `nagios_timedevents` 14 | LEFT JOIN nagios_objects as obj1 ON nagios_timedevents.object_id=obj1.object_id 15 | LEFT JOIN nagios_instances ON nagios_timedevents.instance_id=nagios_instances.instance_id 16 | WHERE scheduled_time < NOW() 17 | ORDER BY scheduled_time DESC, timedevent_id DESC 18 | 19 | -------------------------------------------------------------------------------- /docs/NDOUTILS DB Model.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/NDOUTILS DB Model.odt -------------------------------------------------------------------------------- /docs/NDOUTILS DB Model.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/NDOUTILS DB Model.pdf -------------------------------------------------------------------------------- /docs/NDOUtils Documentation.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/NDOUtils Documentation.odt -------------------------------------------------------------------------------- /docs/NDOUtils Documentation.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/NDOUtils Documentation.pdf -------------------------------------------------------------------------------- /docs/docbook/en-en/Makefile.in: -------------------------------------------------------------------------------- 1 | ############################### 2 | # Makefile for NDO 3 | # 4 | # Last Modified: 09-13-2009 5 | ############################### 6 | 7 | 8 | prefix=@prefix@ 9 | exec_prefix=@exec_prefix@ 10 | LOGDIR=@localstatedir@ 11 | CFGDIR=@sysconfdir@ 12 | BINDIR=@bindir@ 13 | LIBEXECDIR=@libexecdir@ 14 | DATAROOTDIR=@datarootdir@ 15 | INSTALL=@INSTALL@ 16 | 17 | 18 | all: 19 | @echo "" 20 | @echo "Please type what you want, possible targets:" 21 | @echo "make en-html" 22 | @echo "make en-html-singe" 23 | @echo "make en-pdf" 24 | @echo "" 25 | 26 | en-html: 27 | xsltproc --xinclude ../xsl/html-chunked.xsl NDOUtils.xml 28 | 29 | 30 | en-html-single: 31 | xsltproc --output ../../html/en-en/NDOUtils-single.html --xinclude ../xsl/html-single.xsl NDOUtils.xml 32 | 33 | en-pdf: 34 | xsltproc --xinclude -o ../NDOUtils.fo ../xsl/fo.xsl ./NDOUtils.xml 35 | fop ../NDOUtils.fo ../../NDOUtils-en.pdf 36 | rm -f ../NDOUtils.fo 37 | 38 | distclean: 39 | rm -f Makefile 40 | -------------------------------------------------------------------------------- /docs/docbook/en-en/all-entities.ent: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | %protocols.entities; 15 | %plugins.entities; 16 | %urls.entities; 17 | %names.entities; 18 | %doc.entities; 19 | %version.entities; 20 | -------------------------------------------------------------------------------- /docs/docbook/en-en/ent/documents.ent: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/docbook/en-en/ent/names.ent: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /docs/docbook/en-en/ent/plugins.ent: -------------------------------------------------------------------------------- 1 | 2 | 3 | check_nagios"> 4 | check_hpjd"> 5 | check_nrpe"> 6 | check_dns"> 7 | check_dummy"> 8 | check_ping"> 9 | check_icmp"> 10 | check_nt"> 11 | check_snmp"> 12 | check_rpc"> 13 | check_http"> 14 | check_by_ssh"> 15 | check_ssh"> 16 | check_cluster"> 17 | check_fping"> 18 | check_mrtgtraf"> 19 | check_ftp"> 20 | check_smtp"> 21 | check_pop"> 22 | check_imap"> -------------------------------------------------------------------------------- /docs/docbook/en-en/ent/protocols.ent: -------------------------------------------------------------------------------- 1 | 2 | 3 | HTTP"> 4 | HTTPS"> 5 | SMTP"> 6 | DNS"> 7 | POP3"> 8 | NNTP"> 9 | IMAP"> 10 | IMAP4"> 11 | FTP"> 12 | SSH"> 13 | DHCP"> 14 | NTP"> 15 | SNMP"> 16 | ICMP"> 17 | PING"> 18 | -------------------------------------------------------------------------------- /docs/docbook/en-en/ent/urls.ent: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/docbook/en-en/ent/version.ent: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /docs/docbook/images/fig1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/docbook/images/fig1.png -------------------------------------------------------------------------------- /docs/docbook/images/fig10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/docbook/images/fig10.png -------------------------------------------------------------------------------- /docs/docbook/images/fig11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/docbook/images/fig11.png -------------------------------------------------------------------------------- /docs/docbook/images/fig12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/docbook/images/fig12.png -------------------------------------------------------------------------------- /docs/docbook/images/fig13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/docbook/images/fig13.png -------------------------------------------------------------------------------- /docs/docbook/images/fig2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/docbook/images/fig2.png -------------------------------------------------------------------------------- /docs/docbook/images/fig3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/docbook/images/fig3.png -------------------------------------------------------------------------------- /docs/docbook/images/fig4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/docbook/images/fig4.png -------------------------------------------------------------------------------- /docs/docbook/images/fig5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/docbook/images/fig5.png -------------------------------------------------------------------------------- /docs/docbook/images/fig6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/docbook/images/fig6.png -------------------------------------------------------------------------------- /docs/docbook/images/fig7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/docbook/images/fig7.png -------------------------------------------------------------------------------- /docs/docbook/images/fig8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/docbook/images/fig8.png -------------------------------------------------------------------------------- /docs/docbook/images/fig9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/docbook/images/fig9.png -------------------------------------------------------------------------------- /docs/docbook/images/important.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/docbook/images/important.png -------------------------------------------------------------------------------- /docs/docbook/images/logofullsize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/docbook/images/logofullsize.png -------------------------------------------------------------------------------- /docs/docbook/images/note.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/docbook/images/note.png -------------------------------------------------------------------------------- /docs/docbook/images/tip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/docbook/images/tip.png -------------------------------------------------------------------------------- /docs/docbook/xsl/fo.xsl: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /docs/docbook/xsl/html-chunked.xsl: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | ../images/ 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 42 | 43 | 44 | 45 | 46 |
Nagios
47 |
48 | 49 | 54 | 55 | 56 | 57 | 58 |
59 | -------------------------------------------------------------------------------- /docs/docbook/xsl/html-single.xsl: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | ../images/ 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 29 | 30 | 31 | 32 | 33 |
Nagios
34 |
35 | 36 | 37 | 38 | 39 | 40 |
41 | -------------------------------------------------------------------------------- /docs/html/en-en/ch02.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Chapter 2. Design en detail 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
Nagios
14 | 27 |
28 |

29 | Chapter 2. Design en detail

30 |
31 |

Table of Contents

32 |
33 |
Components
34 |
35 |
Overview
36 |
NDOMOD
37 |
LOG2NDO
38 |
FILE2SOCK
39 |
NDO2DB. NDO2DB
40 |
41 |
42 |
43 | 44 | 45 | 46 |
47 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /docs/html/en-en/ch03.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Chapter 3. Examples 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
Nagios
14 | 27 |
28 |

29 | Chapter 3. Examples

30 | 41 | 42 | 43 | 44 |
45 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /docs/html/en-en/ch04.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Chapter 4. Installation 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
Nagios
14 | 27 |
28 |

29 | Chapter 4. Installation

30 |
31 |

Table of Contents

32 |
33 |
Installation
34 |
35 |
Prerequisites
36 |
Version Compatibility
37 |
Obtaining New Versions
38 |
Compiling
39 |
Installation
40 |
Initializing the database
41 |
Configuration
42 |
Getting things running
43 |
44 |
45 |
46 | 47 | 48 | 49 |
50 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /docs/html/images/fig1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/html/images/fig1.png -------------------------------------------------------------------------------- /docs/html/images/fig10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/html/images/fig10.png -------------------------------------------------------------------------------- /docs/html/images/fig11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/html/images/fig11.png -------------------------------------------------------------------------------- /docs/html/images/fig12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/html/images/fig12.png -------------------------------------------------------------------------------- /docs/html/images/fig13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/html/images/fig13.png -------------------------------------------------------------------------------- /docs/html/images/fig2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/html/images/fig2.png -------------------------------------------------------------------------------- /docs/html/images/fig3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/html/images/fig3.png -------------------------------------------------------------------------------- /docs/html/images/fig4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/html/images/fig4.png -------------------------------------------------------------------------------- /docs/html/images/fig5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/html/images/fig5.png -------------------------------------------------------------------------------- /docs/html/images/fig6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/html/images/fig6.png -------------------------------------------------------------------------------- /docs/html/images/fig7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/html/images/fig7.png -------------------------------------------------------------------------------- /docs/html/images/fig8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/html/images/fig8.png -------------------------------------------------------------------------------- /docs/html/images/fig9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/html/images/fig9.png -------------------------------------------------------------------------------- /docs/html/images/important.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/html/images/important.png -------------------------------------------------------------------------------- /docs/html/images/logofullsize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/html/images/logofullsize.png -------------------------------------------------------------------------------- /docs/html/images/note.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/html/images/note.png -------------------------------------------------------------------------------- /docs/html/images/tip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NagiosEnterprises/ndoutils/8ab7c702ae90b75d4238bc87499353a22b23a3dd/docs/html/images/tip.png -------------------------------------------------------------------------------- /include/common.h.in: -------------------------------------------------------------------------------- 1 | /** 2 | * @file common.h NDO common declarations 3 | */ 4 | /* 5 | * Copyright 2009-2014 Nagios Core Development Team and Community Contributors 6 | * Copyright 2005-2009 Ethan Galstad 7 | * 8 | * This file is part of NDOUtils. 9 | * 10 | * NDOUtils is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License version 2 as 12 | * published by the Free Software Foundation. 13 | * 14 | * NDOUtils is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with NDOUtils. If not, see . 21 | */ 22 | 23 | #ifndef NDO_COMMON_H_INCLUDED 24 | #define NDO_COMMON_H_INCLUDED 25 | 26 | #ifdef HAVE_SSL 27 | #include <@SSL_INC_PREFIX@@SSL_HDR@> 28 | #endif 29 | 30 | #define NDO_TRUE 1 31 | #define NDO_FALSE 0 32 | 33 | #define NDO_ERROR -1 34 | #define NDO_OK 0 35 | 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /include/getheaders: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ################################################################################# 4 | # Used by Ethan to grab the latest copy of Nagios include files 5 | # 6 | # NOTES: 7 | # - configure scripts must be run on Nagios CVS repos before this can be done 8 | # - config.h files are emptied, so it won't interfere with the local config.h 9 | # generated for this project 10 | ################################################################################# 11 | 12 | # Get Nagios 3.x headers 13 | cp --reply=yes ~/code/cvs/nagios/include/*.h nagios-3x 14 | echo "/* empty */" > nagios-3x/config.h 15 | 16 | # Get Nagios 2.x headers 17 | cp --reply=yes ~/code/cvs/nagios-2x/nagios/include/*.h nagios-2x 18 | echo "/* empty */" > nagios-2x/config.h 19 | -------------------------------------------------------------------------------- /include/io.h.in: -------------------------------------------------------------------------------- 1 | /** 2 | * @file io.h Common NDO I/O functions 3 | */ 4 | /* 5 | * Copyright 2009-2014 Nagios Core Development Team and Community Contributors 6 | * Copyright 2005-2009 Ethan Galstad 7 | * 8 | * This file is part of NDOUtils. 9 | * 10 | * NDOUtils is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License version 2 as 12 | * published by the Free Software Foundation. 13 | * 14 | * NDOUtils is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with NDOUtils. If not, see . 21 | */ 22 | 23 | #ifndef NDO_IO_H_INCLUDED 24 | #define NDO_IO_H_INCLUDED 25 | 26 | #include "config.h" 27 | 28 | 29 | #define NDO_SINK_FILE 0 30 | #define NDO_SINK_FD 1 31 | #define NDO_SINK_UNIXSOCKET 2 32 | #define NDO_SINK_TCPSOCKET 3 33 | 34 | #define NDO_DEFAULT_TCP_PORT @ndo2db_port@ /* default port to use */ 35 | 36 | 37 | /* MMAPFILE structure - used for reading files via mmap() */ 38 | typedef struct ndo_mmapfile_struct{ 39 | char *path; 40 | int mode; 41 | int fd; 42 | unsigned long file_size; 43 | unsigned long current_position; 44 | unsigned long current_line; 45 | void *mmap_buf; 46 | }ndo_mmapfile; 47 | 48 | 49 | ndo_mmapfile *ndo_mmap_fopen(char *); 50 | int ndo_mmap_fclose(ndo_mmapfile *); 51 | char *ndo_mmap_fgets(ndo_mmapfile *); 52 | 53 | int ndo_sink_open(char *,int,int,int,int,int *); 54 | int ndo_sink_write(int,char *,int); 55 | int ndo_sink_write_newline(int); 56 | int ndo_sink_flush(int); 57 | int ndo_sink_close(int); 58 | int ndo_inet_aton(register const char *,struct in_addr *); 59 | 60 | void ndo_strip_buffer(char *); 61 | char *ndo_escape_buffer(char *); 62 | char *ndo_unescape_buffer(char *); 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /include/nagios-2x/cgiauth.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * CGIAUTH.H - Authorization utilities header file 4 | * 5 | * Last Modified: 11-24-2005 6 | * 7 | * License: 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License version 2 as 11 | * published by the Free Software Foundation. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 | * 22 | *****************************************************************************/ 23 | 24 | #ifndef _AUTH_H 25 | #define _AUTH_H 26 | 27 | #include "common.h" 28 | #include "objects.h" 29 | 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | typedef struct authdata_struct{ 36 | char *username; 37 | int authorized_for_all_hosts; 38 | int authorized_for_all_host_commands; 39 | int authorized_for_all_services; 40 | int authorized_for_all_service_commands; 41 | int authorized_for_system_information; 42 | int authorized_for_system_commands; 43 | int authorized_for_configuration_information; 44 | int authenticated; 45 | }authdata; 46 | 47 | 48 | 49 | int get_authentication_information(authdata *); /* gets current authentication information */ 50 | 51 | int is_authorized_for_host(host *,authdata *); 52 | int is_authorized_for_service(service *,authdata *); 53 | 54 | int is_authorized_for_all_hosts(authdata *); 55 | int is_authorized_for_all_services(authdata *); 56 | 57 | int is_authorized_for_system_information(authdata *); 58 | int is_authorized_for_system_commands(authdata *); 59 | int is_authorized_for_host_commands(host *,authdata *); 60 | int is_authorized_for_service_commands(service *,authdata *); 61 | 62 | int is_authorized_for_hostgroup(hostgroup *,authdata *); 63 | int is_authorized_for_servicegroup(servicegroup *,authdata *); 64 | 65 | int is_authorized_for_configuration_information(authdata *); 66 | 67 | #ifdef __cplusplus 68 | } 69 | #endif 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /include/nagios-2x/config.h: -------------------------------------------------------------------------------- 1 | /* empty */ 2 | -------------------------------------------------------------------------------- /include/nagios-2x/epn_nagios.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * 3 | * Embedded Perl Header File 4 | * Last Modified: 12-08-2004 5 | * 6 | ************************************************************************/ 7 | 8 | 9 | /******** BEGIN EMBEDDED PERL INTERPRETER DECLARATIONS ********/ 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | #undef ctime /* don't need perl's threaded version */ 16 | #undef printf /* can't use perl's printf until initialized */ 17 | 18 | /* In perl.h (or friends) there is a macro that defines sighandler as Perl_sighandler, so we must #undef it so we can use our sighandler() function */ 19 | #undef sighandler 20 | 21 | /* and we don't need perl's reentrant versions */ 22 | #undef localtime 23 | #undef getpwnam 24 | #undef getgrnam 25 | #undef strerror 26 | 27 | #ifdef aTHX 28 | EXTERN_C void xs_init(pTHX); 29 | #else 30 | EXTERN_C void xs_init(void); 31 | #endif 32 | 33 | /******** END EMBEDDED PERL INTERPRETER DECLARATIONS ********/ 34 | -------------------------------------------------------------------------------- /include/nagios-2x/getcgi.h: -------------------------------------------------------------------------------- 1 | /****************************************************** 2 | * 3 | * GETCGI.H - Nagios CGI Input Routine Include File 4 | * 5 | * Last Modified: 11-25-2005 6 | * 7 | *****************************************************/ 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | char **getcgivars(void); 14 | void free_cgivars(char **); 15 | void unescape_cgi_input(char *); 16 | void sanitize_cgi_input(char **); 17 | unsigned char hex_to_char(char *); 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | -------------------------------------------------------------------------------- /include/nagios-2x/locations.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * 3 | * Nagios Locations Header File 4 | * Written By: Ethan Galstad (nagios@nagios.org) 5 | * Last Modified: 03-24-2003 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License version 2 as 9 | * published by the Free Software Foundation. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | ************************************************************************/ 20 | 21 | #define DEFAULT_TEMP_FILE "/usr/local/nagios/var/tempfile" 22 | #define DEFAULT_STATUS_FILE "/usr/local/nagios/var/status.dat" 23 | #define DEFAULT_LOG_FILE "/usr/local/nagios/var/nagios.log" 24 | #define DEFAULT_LOG_ARCHIVE_PATH "/usr/local/nagios/var/archives/" 25 | #define DEFAULT_COMMENT_FILE "/usr/local/nagios/var/comments.dat" 26 | #define DEFAULT_DOWNTIME_FILE "/usr/local/nagios/var/downtime.dat" 27 | #define DEFAULT_RETENTION_FILE "/usr/local/nagios/var/retention.dat" 28 | #define DEFAULT_COMMAND_FILE "/usr/local/nagios/var/rw/nagios.cmd" 29 | #define DEFAULT_CONFIG_FILE "/usr/local/nagios/etc/nagios.cfg" 30 | #define DEFAULT_PHYSICAL_HTML_PATH "/usr/local/nagios/share" 31 | #define DEFAULT_URL_HTML_PATH "/nagios" 32 | #define DEFAULT_PHYSICAL_CGIBIN_PATH "/usr/local/nagios/sbin" 33 | #define DEFAULT_URL_CGIBIN_PATH "/nagios/cgi-bin" 34 | #define DEFAULT_CGI_CONFIG_FILE "/usr/local/nagios/etc/cgi.cfg" 35 | #define DEFAULT_LOCK_FILE "/usr/local/nagios/var/nagios.lock" 36 | #define DEFAULT_OBJECT_CACHE_FILE "/usr/local/nagios/var/objects.cache" 37 | #define DEFAULT_EVENT_BROKER_FILE "/usr/local/nagios/var/broker.socket" 38 | #define DEFAULT_P1_FILE "/usr/local/nagios/bin/p1.pl" /**** EMBEDDED PERL ****/ 39 | #define DEFAULT_AUTH_FILE "" /**** EMBEDDED PERL - IS THIS USED? ****/ 40 | -------------------------------------------------------------------------------- /include/nagios-2x/nebcallbacks.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * NEBCALLBACKS.H - Include file for event broker modules 4 | * 5 | * Copyright (c) 2002-2006 Ethan Galstad (nagios@nagios.org) 6 | * Last Modified: 10-09-2006 7 | * 8 | * License: 9 | * 10 | * This program is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License version 2 as 12 | * published by the Free Software Foundation. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | * 23 | *****************************************************************************/ 24 | 25 | #ifndef _NEBCALLBACKS_H 26 | #define _NEBCALLBACKS_H 27 | 28 | #include "config.h" 29 | #include "nebmodules.h" 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | 36 | /***** CALLBACK TYPES *****/ 37 | 38 | #define NEBCALLBACK_NUMITEMS 31 /* total number of callback types we have */ 39 | 40 | #define NEBCALLBACK_RESERVED0 0 /* reserved for future use */ 41 | #define NEBCALLBACK_RESERVED1 1 42 | #define NEBCALLBACK_RESERVED2 2 43 | #define NEBCALLBACK_RESERVED3 3 44 | #define NEBCALLBACK_RESERVED4 4 45 | 46 | #define NEBCALLBACK_RAW_DATA 5 47 | #define NEBCALLBACK_NEB_DATA 6 48 | 49 | #define NEBCALLBACK_PROCESS_DATA 7 50 | #define NEBCALLBACK_TIMED_EVENT_DATA 8 51 | #define NEBCALLBACK_LOG_DATA 9 52 | #define NEBCALLBACK_SYSTEM_COMMAND_DATA 10 53 | #define NEBCALLBACK_EVENT_HANDLER_DATA 11 54 | #define NEBCALLBACK_NOTIFICATION_DATA 12 55 | #define NEBCALLBACK_SERVICE_CHECK_DATA 13 56 | #define NEBCALLBACK_HOST_CHECK_DATA 14 57 | #define NEBCALLBACK_COMMENT_DATA 15 58 | #define NEBCALLBACK_DOWNTIME_DATA 16 59 | #define NEBCALLBACK_FLAPPING_DATA 17 60 | #define NEBCALLBACK_PROGRAM_STATUS_DATA 18 61 | #define NEBCALLBACK_HOST_STATUS_DATA 19 62 | #define NEBCALLBACK_SERVICE_STATUS_DATA 20 63 | #define NEBCALLBACK_ADAPTIVE_PROGRAM_DATA 21 64 | #define NEBCALLBACK_ADAPTIVE_HOST_DATA 22 65 | #define NEBCALLBACK_ADAPTIVE_SERVICE_DATA 23 66 | #define NEBCALLBACK_EXTERNAL_COMMAND_DATA 24 67 | #define NEBCALLBACK_AGGREGATED_STATUS_DATA 25 68 | #define NEBCALLBACK_RETENTION_DATA 26 69 | #define NEBCALLBACK_CONTACT_NOTIFICATION_DATA 27 70 | #define NEBCALLBACK_CONTACT_NOTIFICATION_METHOD_DATA 28 71 | #define NEBCALLBACK_ACKNOWLEDGEMENT_DATA 29 72 | #define NEBCALLBACK_STATE_CHANGE_DATA 30 73 | 74 | 75 | /***** CALLBACK FUNCTIONS *****/ 76 | 77 | int neb_register_callback(int, void *, int, int (*callback_func)(int,void *)); 78 | int neb_deregister_callback(int, int (*callback_func)(int,void *)); 79 | int neb_deregister_module_callbacks(nebmodule *); 80 | 81 | #ifdef __cplusplus 82 | } 83 | #endif 84 | 85 | 86 | #endif 87 | -------------------------------------------------------------------------------- /include/nagios-2x/neberrors.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * NEBERRORS.H - Event broker errors 4 | * 5 | * Copyright (c) 2003-2005 Ethan Galstad (nagios@nagios.org) 6 | * Last Modified: 11-25-2005 7 | * 8 | * License: 9 | * 10 | * This program is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License version 2 as 12 | * published by the Free Software Foundation. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | * 23 | *****************************************************************************/ 24 | 25 | #ifndef _NEBERRORS_H 26 | #define _NEBERRORS_H 27 | 28 | 29 | /***** GENERIC DEFINES *****/ 30 | 31 | #define NEB_OK 0 32 | #define NEB_ERROR -1 33 | 34 | #define NEB_TRUE 1 35 | #define NEB_FALSE 0 36 | 37 | 38 | 39 | /***** GENERIC ERRORS *****/ 40 | 41 | #define NEBERROR_NOMEM 100 /* memory could not be allocated */ 42 | 43 | 44 | 45 | /***** CALLBACK ERRORS *****/ 46 | 47 | #define NEBERROR_NOCALLBACKFUNC 200 /* no callback function was specified */ 48 | #define NEBERROR_NOCALLBACKLIST 201 /* callback list not initialized */ 49 | #define NEBERROR_CALLBACKBOUNDS 202 /* callback type was out of bounds */ 50 | #define NEBERROR_CALLBACKNOTFOUND 203 /* the callback could not be found */ 51 | #define NEBERROR_NOMODULEHANDLE 204 /* no module handle specified */ 52 | #define NEBERROR_BADMODULEHANDLE 205 /* bad module handle */ 53 | 54 | 55 | 56 | /***** MODULE ERRORS *****/ 57 | 58 | #define NEBERROR_NOMODULE 300 /* no module was specified */ 59 | 60 | 61 | 62 | /***** MODULE INFO ERRORS *****/ 63 | 64 | #define NEBERROR_MODINFOBOUNDS 400 /* module info index was out of bounds */ 65 | 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /include/nagios-2x/nebmods.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * NEBMODS.H - Include file for event broker modules 4 | * 5 | * Copyright (c) 2002-2005 Ethan Galstad (nagios@nagios.org) 6 | * Last Modified: 11-25-2005 7 | * 8 | * License: 9 | * 10 | * This program is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License version 2 as 12 | * published by the Free Software Foundation. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | * 23 | *****************************************************************************/ 24 | 25 | #ifndef _NEBMODS_H 26 | #define _NEBMODS_H 27 | 28 | #include "config.h" 29 | #include "nebcallbacks.h" 30 | #include "nebmodules.h" 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | 37 | /***** MODULE STRUCTURES *****/ 38 | 39 | /* NEB module callback list struct */ 40 | typedef struct nebcallback_struct{ 41 | void *callback_func; 42 | void *module_handle; 43 | int priority; 44 | struct nebcallback_struct *next; 45 | }nebcallback; 46 | 47 | 48 | 49 | /***** MODULE FUNCTIONS *****/ 50 | 51 | int neb_init_modules(void); 52 | int neb_deinit_modules(void); 53 | int neb_load_all_modules(void); 54 | int neb_load_module(nebmodule *); 55 | int neb_free_module_list(void); 56 | int neb_unload_all_modules(int,int); 57 | int neb_unload_module(nebmodule *,int,int); 58 | int neb_add_module(char *,char *,int); 59 | 60 | 61 | /***** CALLBACK FUNCTIONS *****/ 62 | int neb_init_callback_list(void); 63 | int neb_free_callback_list(void); 64 | int neb_make_callbacks(int,void *); 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /include/nagios-2x/nebmodules.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * NEBMODULES.H - Include file for event broker modules 4 | * 5 | * Copyright (c) 2002-2005 Ethan Galstad (nagios@nagios.org) 6 | * Last Modified: 12-17-2005 7 | * 8 | * License: 9 | * 10 | * This program is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License version 2 as 12 | * published by the Free Software Foundation. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | * 23 | *****************************************************************************/ 24 | 25 | #ifndef _NEBMODULES_H 26 | #define _NEBMODULES_H 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif 31 | 32 | /***** MODULE VERSION INFORMATION *****/ 33 | 34 | #define NEB_API_VERSION(x) int __neb_api_version = x; 35 | #define CURRENT_NEB_API_VERSION 2 36 | 37 | 38 | 39 | /***** MODULE INFORMATION *****/ 40 | 41 | #define NEBMODULE_MODINFO_NUMITEMS 6 42 | #define NEBMODULE_MODINFO_TITLE 0 43 | #define NEBMODULE_MODINFO_AUTHOR 1 44 | #define NEBMODULE_MODINFO_COPYRIGHT 2 45 | #define NEBMODULE_MODINFO_VERSION 3 46 | #define NEBMODULE_MODINFO_LICENSE 4 47 | #define NEBMODULE_MODINFO_DESC 5 48 | 49 | 50 | 51 | /***** MODULE LOAD/UNLOAD OPTIONS *****/ 52 | 53 | #define NEBMODULE_NORMAL_LOAD 0 /* module is being loaded normally */ 54 | #define NEBMODULE_REQUEST_UNLOAD 0 /* request module to unload (but don't force it) */ 55 | #define NEBMODULE_FORCE_UNLOAD 1 /* force module to unload */ 56 | 57 | 58 | 59 | /***** MODULES UNLOAD REASONS *****/ 60 | 61 | #define NEBMODULE_NEB_SHUTDOWN 1 /* event broker is shutting down */ 62 | #define NEBMODULE_NEB_RESTART 2 /* event broker is restarting */ 63 | #define NEBMODULE_ERROR_NO_INIT 3 /* _module_init() function was not found in module */ 64 | #define NEBMODULE_ERROR_BAD_INIT 4 /* _module_init() function returned a bad code */ 65 | #define NEBMODULE_ERROR_API_VERSION 5 /* module version is incompatible with current api */ 66 | 67 | 68 | 69 | /***** MODULE STRUCTURES *****/ 70 | 71 | /* NEB module structure */ 72 | typedef struct nebmodule_struct{ 73 | char *filename; 74 | char *args; 75 | char *info[NEBMODULE_MODINFO_NUMITEMS]; 76 | int should_be_loaded; 77 | int is_currently_loaded; 78 | #ifdef USE_LTDL 79 | lt_dlhandle module_handle; 80 | lt_ptr init_func; 81 | lt_ptr deinit_func; 82 | #else 83 | void *module_handle; 84 | void *init_func; 85 | void *deinit_func; 86 | #endif 87 | #ifdef HAVE_PTHREAD_H 88 | pthread_t thread_id; 89 | #endif 90 | struct nebmodule_struct *next; 91 | }nebmodule; 92 | 93 | 94 | 95 | /***** MODULE FUNCTIONS *****/ 96 | int neb_set_module_info(void *,int,char *); 97 | 98 | #ifdef __cplusplus 99 | } 100 | #endif 101 | 102 | #endif 103 | -------------------------------------------------------------------------------- /include/nagios-2x/perfdata.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * PERFDATA.H - Include file for performance data routines 4 | * 5 | * Copyright (c) 2001-2005 Ethan Galstad (nagios@nagios.org) 6 | * Last Modified: 11-25-2005 7 | * 8 | * License: 9 | * 10 | * This program is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License version 2 as 12 | * published by the Free Software Foundation. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | * 23 | *****************************************************************************/ 24 | 25 | #ifndef _PERFDATA_H 26 | #define _PERFDATA_H 27 | 28 | #include "objects.h" 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | int initialize_performance_data(char *); /* initializes performance data */ 35 | int cleanup_performance_data(char *); /* cleans up performance data */ 36 | 37 | int update_host_performance_data(host *); /* updates host performance data */ 38 | int update_service_performance_data(service *); /* updates service performance data */ 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /include/nagios-2x/snprintf.h: -------------------------------------------------------------------------------- 1 | /* include/snprintf.h. Generated by configure. */ 2 | /* -*- C -*- */ 3 | #define HAVE_SNPRINTF 1 4 | /* #undef NEED_VA_LIST */ 5 | -------------------------------------------------------------------------------- /include/nagios-2x/sretention.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * SRETENTION.H - Header for state retention routines 4 | * 5 | * Copyright (c) 1999-2005 Ethan Galstad (nagios@nagios.org) 6 | * Last Modified: 11-25-2005 7 | * 8 | * License: 9 | * 10 | * This program is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License version 2 as 12 | * published by the Free Software Foundation. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | * 23 | *****************************************************************************/ 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | int save_state_information(char *,int); /* saves all host and state information */ 30 | int read_initial_state_information(char *); /* reads in initial host and state information */ 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | -------------------------------------------------------------------------------- /include/nagios-3x/cgiauth.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * CGIAUTH.H - Authorization utilities header file 4 | * 5 | * Last Modified: 11-24-2005 6 | * 7 | * License: 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License version 2 as 11 | * published by the Free Software Foundation. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 | * 22 | *****************************************************************************/ 23 | 24 | #ifndef _AUTH_H 25 | #define _AUTH_H 26 | #include "compat.h" 27 | #include "common.h" 28 | #include "objects.h" 29 | 30 | NAGIOS_BEGIN_DECL 31 | 32 | typedef struct authdata_struct { 33 | char *username; 34 | int authorized_for_all_hosts; 35 | int authorized_for_all_host_commands; 36 | int authorized_for_all_services; 37 | int authorized_for_all_service_commands; 38 | int authorized_for_system_information; 39 | int authorized_for_system_commands; 40 | int authorized_for_configuration_information; 41 | int authorized_for_read_only; 42 | int authenticated; 43 | } authdata; 44 | 45 | 46 | 47 | int get_authentication_information(authdata *); /* gets current authentication information */ 48 | 49 | int is_authorized_for_host(host *, authdata *); 50 | int is_authorized_for_service(service *, authdata *); 51 | 52 | int is_authorized_for_all_hosts(authdata *); 53 | int is_authorized_for_all_services(authdata *); 54 | 55 | int is_authorized_for_system_information(authdata *); 56 | int is_authorized_for_system_commands(authdata *); 57 | int is_authorized_for_host_commands(host *, authdata *); 58 | int is_authorized_for_service_commands(service *, authdata *); 59 | 60 | int is_authorized_for_hostgroup(hostgroup *, authdata *); 61 | int is_authorized_for_servicegroup(servicegroup *, authdata *); 62 | 63 | int is_authorized_for_hostgroup_commands(hostgroup *, authdata *); 64 | int is_authorized_for_servicegroup_commands(servicegroup *, authdata *); 65 | 66 | int is_authorized_for_configuration_information(authdata *); 67 | 68 | int is_authorized_for_read_only(authdata *); 69 | 70 | NAGIOS_END_DECL 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /include/nagios-3x/compat.h: -------------------------------------------------------------------------------- 1 | /* compatibility macros, primarily to keep indentation programs 2 | * from going bananas when indenting everything below 3 | #ifdef __cplusplus 4 | 'extern "C" {' 5 | #endif 6 | * as if it was a real block, which is just goddamn annoying. 7 | */ 8 | #ifndef _COMPAT_H 9 | #define _COMPAT_H 10 | 11 | #ifdef __cplusplus 12 | # define NAGIOS_BEGIN_DECL extern "C" { 13 | # define NAGIOS_END_DECL } 14 | #else 15 | # define NAGIOS_BEGIN_DECL /* nothing */ 16 | # define NAGIOS_END_DECL /* more of nothing */ 17 | #endif 18 | 19 | #endif /* _COMPAT_H */ 20 | -------------------------------------------------------------------------------- /include/nagios-3x/config.h: -------------------------------------------------------------------------------- 1 | /* empty */ 2 | -------------------------------------------------------------------------------- /include/nagios-3x/epn_nagios.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * 3 | * Embedded Perl Header File 4 | * Last Modified: 01-15-2009 5 | * 6 | ************************************************************************/ 7 | 8 | 9 | /******** BEGIN EMBEDDED PERL INTERPRETER DECLARATIONS ********/ 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | #undef DEBUG /* epn-compiled Nagios spews just - this has a side effect of potentially disabling debug output on epn systems */ 16 | #undef ctime /* don't need perl's threaded version */ 17 | #undef printf /* can't use perl's printf until initialized */ 18 | 19 | /* In perl.h (or friends) there is a macro that defines sighandler as Perl_sighandler, so we must #undef it so we can use our sighandler() function */ 20 | #undef sighandler 21 | 22 | /* and we don't need perl's reentrant versions */ 23 | #undef localtime 24 | #undef getpwnam 25 | #undef getgrnam 26 | #undef strerror 27 | 28 | #ifdef aTHX 29 | EXTERN_C void xs_init(pTHX); 30 | #else 31 | EXTERN_C void xs_init(void); 32 | #endif 33 | 34 | /******** END EMBEDDED PERL INTERPRETER DECLARATIONS ********/ 35 | -------------------------------------------------------------------------------- /include/nagios-3x/getcgi.h: -------------------------------------------------------------------------------- 1 | /****************************************************** 2 | * 3 | * GETCGI.H - Nagios CGI Input Routine Include File 4 | * 5 | * Last Modified: 11-25-2005 6 | * 7 | *****************************************************/ 8 | 9 | #include "compat.h" 10 | NAGIOS_BEGIN_DECL 11 | 12 | #define ACCEPT_LANGUAGE_Q_DELIMITER ";q=" 13 | 14 | /* information for a single language in the variable HTTP_ACCEPT_LANGUAGE 15 | sent by the browser */ 16 | typedef struct accept_language_struct { 17 | char * language; 18 | char * locality; 19 | double q; 20 | } accept_language; 21 | 22 | /* information for all languages in the variable HTTP_ACCEPT_LANGUAGE 23 | sent by the browser */ 24 | typedef struct accept_languages_struct { 25 | int count; 26 | accept_language ** languages; 27 | } accept_languages; 28 | 29 | char **getcgivars(void); 30 | void free_cgivars(char **); 31 | void unescape_cgi_input(char *); 32 | void sanitize_cgi_input(char **); 33 | unsigned char hex_to_char(char *); 34 | 35 | void process_language( char *); 36 | accept_languages * parse_accept_languages( char *); 37 | int compare_accept_languages( const void *, const void *); 38 | void free_accept_languages( accept_languages *); 39 | 40 | NAGIOS_END_DECL 41 | -------------------------------------------------------------------------------- /include/nagios-3x/locations.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * 3 | * Nagios Locations Header File 4 | * Written By: Ethan Galstad (nagios@nagios.org) 5 | * Last Modified: 04-30-2007 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License version 2 as 9 | * published by the Free Software Foundation. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 | ************************************************************************/ 20 | 21 | #define DEFAULT_TEMP_FILE "/usr/local/nagios/var/tempfile" 22 | #define DEFAULT_TEMP_PATH "/tmp" 23 | #define DEFAULT_CHECK_RESULT_PATH "/usr/local/nagios/var/spool/checkresults" 24 | #define DEFAULT_STATUS_FILE "/usr/local/nagios/var/status.dat" 25 | #define DEFAULT_LOG_FILE "/usr/local/nagios/var/nagios.log" 26 | #define DEFAULT_LOG_ARCHIVE_PATH "/usr/local/nagios/var/archives/" 27 | #define DEFAULT_DEBUG_FILE "/usr/local/nagios/var/nagios.debug" 28 | #define DEFAULT_COMMENT_FILE "/usr/local/nagios/var/comments.dat" 29 | #define DEFAULT_DOWNTIME_FILE "/usr/local/nagios/var/downtime.dat" 30 | #define DEFAULT_RETENTION_FILE "/usr/local/nagios/var/retention.dat" 31 | #define DEFAULT_COMMAND_FILE "/usr/local/nagios/var/rw/nagios.cmd" 32 | #define DEFAULT_CONFIG_FILE "/usr/local/nagios/etc/nagios.cfg" 33 | #define DEFAULT_PHYSICAL_HTML_PATH "/usr/local/nagios/share" 34 | #define DEFAULT_URL_HTML_PATH "/nagios" 35 | #define DEFAULT_PHYSICAL_CGIBIN_PATH "/usr/local/nagios/sbin" 36 | #define DEFAULT_URL_CGIBIN_PATH "/nagios/cgi-bin" 37 | #define DEFAULT_CGI_CONFIG_FILE "/usr/local/nagios/etc/cgi.cfg" 38 | #define DEFAULT_LOCK_FILE "/usr/local/nagios/var/nagios.lock" 39 | #define DEFAULT_OBJECT_CACHE_FILE "/usr/local/nagios/var/objects.cache" 40 | #define DEFAULT_PRECACHED_OBJECT_FILE "/usr/local/nagios/var/objects.precache" 41 | #define DEFAULT_EVENT_BROKER_FILE "/usr/local/nagios/var/broker.socket" 42 | #define DEFAULT_P1_FILE "/usr/local/nagios/bin/p1.pl" /**** EMBEDDED PERL ****/ 43 | #define DEFAULT_AUTH_FILE "" /**** EMBEDDED PERL - IS THIS USED? ****/ 44 | -------------------------------------------------------------------------------- /include/nagios-3x/logging.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_logging_h__ 2 | #define INCLUDE_logging_h__ 3 | 4 | #include "compat.h" 5 | #include "objects.h" 6 | 7 | /******************* LOGGING TYPES ********************/ 8 | 9 | #define NSLOG_RUNTIME_ERROR 1 10 | #define NSLOG_RUNTIME_WARNING 2 11 | 12 | #define NSLOG_VERIFICATION_ERROR 4 13 | #define NSLOG_VERIFICATION_WARNING 8 14 | 15 | #define NSLOG_CONFIG_ERROR 16 16 | #define NSLOG_CONFIG_WARNING 32 17 | 18 | #define NSLOG_PROCESS_INFO 64 19 | #define NSLOG_EVENT_HANDLER 128 20 | /*#define NSLOG_NOTIFICATION 256*/ /* NOT USED ANYMORE - CAN BE REUSED */ 21 | #define NSLOG_EXTERNAL_COMMAND 512 22 | 23 | #define NSLOG_HOST_UP 1024 24 | #define NSLOG_HOST_DOWN 2048 25 | #define NSLOG_HOST_UNREACHABLE 4096 26 | 27 | #define NSLOG_SERVICE_OK 8192 28 | #define NSLOG_SERVICE_UNKNOWN 16384 29 | #define NSLOG_SERVICE_WARNING 32768 30 | #define NSLOG_SERVICE_CRITICAL 65536 31 | 32 | #define NSLOG_PASSIVE_CHECK 131072 33 | 34 | #define NSLOG_INFO_MESSAGE 262144 35 | 36 | #define NSLOG_HOST_NOTIFICATION 524288 37 | #define NSLOG_SERVICE_NOTIFICATION 1048576 38 | 39 | /***************** DEBUGGING LEVELS *******************/ 40 | 41 | #define DEBUGL_ALL -1 42 | #define DEBUGL_NONE 0 43 | #define DEBUGL_FUNCTIONS 1 44 | #define DEBUGL_CONFIG 2 45 | #define DEBUGL_PROCESS 4 46 | #define DEBUGL_STATUSDATA 4 47 | #define DEBUGL_RETENTIONDATA 4 48 | #define DEBUGL_EVENTS 8 49 | #define DEBUGL_CHECKS 16 50 | #define DEBUGL_IPC 16 51 | #define DEBUGL_FLAPPING 16 52 | #define DEBUGL_EVENTHANDLERS 16 53 | #define DEBUGL_PERFDATA 16 54 | #define DEBUGL_NOTIFICATIONS 32 55 | #define DEBUGL_EVENTBROKER 64 56 | #define DEBUGL_EXTERNALCOMMANDS 128 57 | #define DEBUGL_COMMANDS 256 58 | #define DEBUGL_DOWNTIME 512 59 | #define DEBUGL_COMMENTS 1024 60 | #define DEBUGL_MACROS 2048 61 | 62 | #define DEBUGV_BASIC 0 63 | #define DEBUGV_MORE 1 64 | #define DEBUGV_MOST 2 65 | 66 | NAGIOS_BEGIN_DECL 67 | /**** Logging Functions ****/ 68 | void logit(int, int, const char *, ...) 69 | __attribute__((__format__(__printf__, 3, 4))); 70 | int log_debug_info(int, int, const char *, ...) 71 | __attribute__((__format__(__printf__, 3, 4))); 72 | 73 | #ifndef NSCGI 74 | int write_to_all_logs(char *, unsigned long); /* writes a string to main log file and syslog facility */ 75 | int write_to_log(char *, unsigned long, time_t *); /* write a string to the main log file */ 76 | int write_to_syslog(char *, unsigned long); /* write a string to the syslog facility */ 77 | int log_service_event(service *); /* logs a service event */ 78 | int log_host_event(host *); /* logs a host event */ 79 | int log_host_states(int, time_t *); /* logs initial/current host states */ 80 | int log_service_states(int, time_t *); /* logs initial/current service states */ 81 | int rotate_log_file(time_t); /* rotates the main log file */ 82 | int write_log_file_info(time_t *); /* records log file/version info */ 83 | int open_debug_log(void); 84 | int chown_debug_log(uid_t, gid_t); 85 | int close_debug_log(void); 86 | #endif /* !NSCGI */ 87 | 88 | NAGIOS_END_DECL 89 | #endif 90 | -------------------------------------------------------------------------------- /include/nagios-3x/nebcallbacks.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * NEBCALLBACKS.H - Include file for event broker modules 4 | * 5 | * Copyright (c) 2002-2007 Ethan Galstad (egalstad@nagios.org) 6 | * Last Modified: 01-06-2007 7 | * 8 | * License: 9 | * 10 | * This program is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License version 2 as 12 | * published by the Free Software Foundation. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | * 23 | *****************************************************************************/ 24 | 25 | #ifndef _NEBCALLBACKS_H 26 | #define _NEBCALLBACKS_H 27 | 28 | #include "compat.h" 29 | #include "nebmodules.h" 30 | 31 | 32 | /***** CALLBACK TYPES *****/ 33 | 34 | #define NEBCALLBACK_NUMITEMS 33 /* total number of callback types we have */ 35 | 36 | #define NEBCALLBACK_RESERVED0 0 /* reserved for future use */ 37 | #define NEBCALLBACK_RESERVED1 1 38 | #define NEBCALLBACK_RESERVED2 2 39 | #define NEBCALLBACK_RESERVED3 3 40 | #define NEBCALLBACK_RESERVED4 4 41 | 42 | #define NEBCALLBACK_RAW_DATA 5 43 | #define NEBCALLBACK_NEB_DATA 6 44 | 45 | #define NEBCALLBACK_PROCESS_DATA 7 46 | #define NEBCALLBACK_TIMED_EVENT_DATA 8 47 | #define NEBCALLBACK_LOG_DATA 9 48 | #define NEBCALLBACK_SYSTEM_COMMAND_DATA 10 49 | #define NEBCALLBACK_EVENT_HANDLER_DATA 11 50 | #define NEBCALLBACK_NOTIFICATION_DATA 12 51 | #define NEBCALLBACK_SERVICE_CHECK_DATA 13 52 | #define NEBCALLBACK_HOST_CHECK_DATA 14 53 | #define NEBCALLBACK_COMMENT_DATA 15 54 | #define NEBCALLBACK_DOWNTIME_DATA 16 55 | #define NEBCALLBACK_FLAPPING_DATA 17 56 | #define NEBCALLBACK_PROGRAM_STATUS_DATA 18 57 | #define NEBCALLBACK_HOST_STATUS_DATA 19 58 | #define NEBCALLBACK_SERVICE_STATUS_DATA 20 59 | #define NEBCALLBACK_ADAPTIVE_PROGRAM_DATA 21 60 | #define NEBCALLBACK_ADAPTIVE_HOST_DATA 22 61 | #define NEBCALLBACK_ADAPTIVE_SERVICE_DATA 23 62 | #define NEBCALLBACK_EXTERNAL_COMMAND_DATA 24 63 | #define NEBCALLBACK_AGGREGATED_STATUS_DATA 25 64 | #define NEBCALLBACK_RETENTION_DATA 26 65 | #define NEBCALLBACK_CONTACT_NOTIFICATION_DATA 27 66 | #define NEBCALLBACK_CONTACT_NOTIFICATION_METHOD_DATA 28 67 | #define NEBCALLBACK_ACKNOWLEDGEMENT_DATA 29 68 | #define NEBCALLBACK_STATE_CHANGE_DATA 30 69 | #define NEBCALLBACK_CONTACT_STATUS_DATA 31 70 | #define NEBCALLBACK_ADAPTIVE_CONTACT_DATA 32 71 | 72 | 73 | /***** CALLBACK FUNCTIONS *****/ 74 | NAGIOS_BEGIN_DECL 75 | 76 | int neb_register_callback(int callback_type, void *mod_handle, int priority, int (*callback_func)(int, void *)); 77 | int neb_deregister_callback(int callback_type, int (*callback_func)(int, void *)); 78 | int neb_deregister_module_callbacks(nebmodule *); 79 | 80 | NAGIOS_END_DECL 81 | #endif 82 | -------------------------------------------------------------------------------- /include/nagios-3x/neberrors.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * NEBERRORS.H - Event broker errors 4 | * 5 | * Copyright (c) 2003-2006 Ethan Galstad (egalstad@nagios.org) 6 | * Last Modified: 12-12-2006 7 | * 8 | * License: 9 | * 10 | * This program is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License version 2 as 12 | * published by the Free Software Foundation. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | * 23 | *****************************************************************************/ 24 | 25 | #ifndef _NEBERRORS_H 26 | #define _NEBERRORS_H 27 | 28 | 29 | /***** GENERIC DEFINES *****/ 30 | 31 | #define NEB_OK 0 32 | #define NEB_ERROR -1 33 | 34 | #define NEB_TRUE 1 35 | #define NEB_FALSE 0 36 | 37 | 38 | 39 | /***** GENERIC ERRORS *****/ 40 | 41 | #define NEBERROR_NOMEM 100 /* memory could not be allocated */ 42 | 43 | 44 | 45 | /***** CALLBACK ERRORS *****/ 46 | 47 | #define NEBERROR_NOCALLBACKFUNC 200 /* no callback function was specified */ 48 | #define NEBERROR_NOCALLBACKLIST 201 /* callback list not initialized */ 49 | #define NEBERROR_CALLBACKBOUNDS 202 /* callback type was out of bounds */ 50 | #define NEBERROR_CALLBACKNOTFOUND 203 /* the callback could not be found */ 51 | #define NEBERROR_NOMODULEHANDLE 204 /* no module handle specified */ 52 | #define NEBERROR_BADMODULEHANDLE 205 /* bad module handle */ 53 | #define NEBERROR_CALLBACKOVERRIDE 206 /* module wants to override default Nagios handling of event */ 54 | #define NEBERROR_CALLBACKCANCEL 207 /* module wants to cancel callbacks to other modules */ 55 | 56 | 57 | 58 | /***** MODULE ERRORS *****/ 59 | 60 | #define NEBERROR_NOMODULE 300 /* no module was specified */ 61 | 62 | 63 | 64 | /***** MODULE INFO ERRORS *****/ 65 | 66 | #define NEBERROR_MODINFOBOUNDS 400 /* module info index was out of bounds */ 67 | 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /include/nagios-3x/nebmods.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * NEBMODS.H - Include file for event broker modules 4 | * 5 | * Copyright (c) 2002-2005 Ethan Galstad (egalstad@nagios.org) 6 | * Last Modified: 11-25-2005 7 | * 8 | * License: 9 | * 10 | * This program is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License version 2 as 12 | * published by the Free Software Foundation. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | * 23 | *****************************************************************************/ 24 | 25 | #ifndef _NEBMODS_H 26 | #define _NEBMODS_H 27 | 28 | #include "compat.h" 29 | #include "nebcallbacks.h" 30 | #include "nebmodules.h" 31 | 32 | NAGIOS_BEGIN_DECL 33 | 34 | /***** MODULE STRUCTURES *****/ 35 | 36 | /* NEB module callback list struct */ 37 | typedef struct nebcallback_struct { 38 | void *callback_func; 39 | void *module_handle; 40 | int priority; 41 | struct nebcallback_struct *next; 42 | } nebcallback; 43 | 44 | 45 | 46 | /***** MODULE FUNCTIONS *****/ 47 | 48 | int neb_init_modules(void); 49 | int neb_deinit_modules(void); 50 | int neb_load_all_modules(void); 51 | int neb_load_module(nebmodule *); 52 | int neb_free_module_list(void); 53 | int neb_unload_all_modules(int, int); 54 | int neb_unload_module(nebmodule *, int, int); 55 | int neb_add_module(char *, char *, int); 56 | 57 | 58 | /***** CALLBACK FUNCTIONS *****/ 59 | int neb_init_callback_list(void); 60 | int neb_free_callback_list(void); 61 | int neb_make_callbacks(int, void *); 62 | 63 | NAGIOS_END_DECL 64 | #endif 65 | -------------------------------------------------------------------------------- /include/nagios-3x/nebmodules.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * NEBMODULES.H - Include file for event broker modules 4 | * 5 | * Copyright (c) 2002-2006 Ethan Galstad (egalstad@nagios.org) 6 | * Last Modified: 02-27-2006 7 | * 8 | * License: 9 | * 10 | * This program is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License version 2 as 12 | * published by the Free Software Foundation. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | * 23 | *****************************************************************************/ 24 | 25 | #ifndef _NEBMODULES_H 26 | #define _NEBMODULES_H 27 | 28 | #include "compat.h" 29 | NAGIOS_BEGIN_DECL 30 | 31 | /***** MODULE VERSION INFORMATION *****/ 32 | 33 | #define NEB_API_VERSION(x) int __neb_api_version = x; 34 | #define CURRENT_NEB_API_VERSION 3 35 | 36 | 37 | 38 | /***** MODULE INFORMATION *****/ 39 | 40 | #define NEBMODULE_MODINFO_NUMITEMS 6 41 | #define NEBMODULE_MODINFO_TITLE 0 42 | #define NEBMODULE_MODINFO_AUTHOR 1 43 | #define NEBMODULE_MODINFO_COPYRIGHT 2 44 | #define NEBMODULE_MODINFO_VERSION 3 45 | #define NEBMODULE_MODINFO_LICENSE 4 46 | #define NEBMODULE_MODINFO_DESC 5 47 | 48 | 49 | 50 | /***** MODULE LOAD/UNLOAD OPTIONS *****/ 51 | 52 | #define NEBMODULE_NORMAL_LOAD 0 /* module is being loaded normally */ 53 | #define NEBMODULE_REQUEST_UNLOAD 0 /* request module to unload (but don't force it) */ 54 | #define NEBMODULE_FORCE_UNLOAD 1 /* force module to unload */ 55 | 56 | 57 | 58 | /***** MODULES UNLOAD REASONS *****/ 59 | 60 | #define NEBMODULE_NEB_SHUTDOWN 1 /* event broker is shutting down */ 61 | #define NEBMODULE_NEB_RESTART 2 /* event broker is restarting */ 62 | #define NEBMODULE_ERROR_NO_INIT 3 /* _module_init() function was not found in module */ 63 | #define NEBMODULE_ERROR_BAD_INIT 4 /* _module_init() function returned a bad code */ 64 | #define NEBMODULE_ERROR_API_VERSION 5 /* module version is incompatible with current api */ 65 | 66 | 67 | 68 | /***** MODULE STRUCTURES *****/ 69 | 70 | /* NEB module structure */ 71 | typedef struct nebmodule_struct { 72 | char *filename; 73 | char *args; 74 | char *info[NEBMODULE_MODINFO_NUMITEMS]; 75 | int should_be_loaded; 76 | int is_currently_loaded; 77 | #ifdef USE_LTDL 78 | lt_dlhandle module_handle; 79 | lt_ptr init_func; 80 | lt_ptr deinit_func; 81 | #else 82 | void *module_handle; 83 | void *init_func; 84 | void *deinit_func; 85 | #endif 86 | #ifdef HAVE_PTHREAD_H 87 | pthread_t thread_id; 88 | #endif 89 | struct nebmodule_struct *next; 90 | } nebmodule; 91 | 92 | 93 | /***** MODULE FUNCTIONS *****/ 94 | int neb_set_module_info(void *, int, char *); 95 | 96 | NAGIOS_END_DECL 97 | #endif 98 | -------------------------------------------------------------------------------- /include/nagios-3x/netutils.h: -------------------------------------------------------------------------------- 1 | #ifndef _NETUTILS_H 2 | #define _NETUTILS_H 3 | #include "compat.h" 4 | NAGIOS_BEGIN_DECL 5 | int my_tcp_connect(char *host_name, int port, int *sd, int timeout); 6 | int my_sendall(int s, char *buf, int *len, int timeout); 7 | int my_recvall(int s, char *buf, int *len, int timeout); 8 | NAGIOS_END_DECL 9 | #endif 10 | 11 | -------------------------------------------------------------------------------- /include/nagios-3x/perfdata.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * PERFDATA.H - Include file for performance data routines 4 | * 5 | * Copyright (c) 2001-2005 Ethan Galstad (egalstad@nagios.org) 6 | * Last Modified: 11-25-2005 7 | * 8 | * License: 9 | * 10 | * This program is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License version 2 as 12 | * published by the Free Software Foundation. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | * 23 | *****************************************************************************/ 24 | 25 | #ifndef _PERFDATA_H 26 | #define _PERFDATA_H 27 | 28 | #include "compat.h" 29 | #include "objects.h" 30 | 31 | NAGIOS_BEGIN_DECL 32 | 33 | int initialize_performance_data(char *); /* initializes performance data */ 34 | int cleanup_performance_data(char *); /* cleans up performance data */ 35 | 36 | int update_host_performance_data(host *); /* updates host performance data */ 37 | int update_service_performance_data(service *); /* updates service performance data */ 38 | 39 | NAGIOS_END_DECL 40 | #endif 41 | -------------------------------------------------------------------------------- /include/nagios-3x/shared.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE__shared_h__ 2 | #define INCLUDE__shared_h__ 3 | 4 | #include 5 | #include "compat.h" 6 | 7 | NAGIOS_BEGIN_DECL 8 | 9 | /* mmapfile structure - used for reading files via mmap() */ 10 | typedef struct mmapfile_struct { 11 | char *path; 12 | int mode; 13 | int fd; 14 | unsigned long file_size; 15 | unsigned long current_position; 16 | unsigned long current_line; 17 | void *mmap_buf; 18 | } mmapfile; 19 | 20 | /* only usable on compile-time initialized arrays, for obvious reasons */ 21 | #define ARRAY_SIZE(ary) (sizeof(ary) / sizeof(ary[0])) 22 | 23 | extern char *my_strtok(char *buffer, char *tokens); 24 | extern char *my_strsep(char **stringp, const char *delim); 25 | extern mmapfile *mmap_fopen(char *filename); 26 | extern int mmap_fclose(mmapfile *temp_mmapfile); 27 | extern char *mmap_fgets(mmapfile *temp_mmapfile); 28 | extern char *mmap_fgets_multiline(mmapfile * temp_mmapfile); 29 | extern void strip(char *buffer); 30 | extern int hashfunc(const char *name1, const char *name2, int hashslots); 31 | extern int compare_hashdata(const char *val1a, const char *val1b, const char *val2a, 32 | const char *val2b); 33 | extern void get_datetime_string(time_t *raw_time, char *buffer, 34 | int buffer_length, int type); 35 | extern void get_time_breakdown(unsigned long raw_time, int *days, int *hours, 36 | int *minutes, int *seconds); 37 | 38 | NAGIOS_END_DECL 39 | #endif 40 | -------------------------------------------------------------------------------- /include/nagios-3x/skiplist.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * 3 | * SKIPLIST.H - Skiplist data structures and functions 4 | * 5 | * Copyright (c) 2008 Ethan Galstad 6 | * Last Modified: 02-24-2008 7 | * 8 | * License: 9 | * 10 | * This program is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License version 2 as 12 | * published by the Free Software Foundation. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | ************************************************************************/ 23 | 24 | #ifndef _SKIPLIST_H 25 | #define _SKIPLIST_H 26 | #include "compat.h" 27 | 28 | #define SKIPLIST_OK 0 29 | #define SKIPLIST_ERROR_ARGS 1 30 | #define SKIPLIST_ERROR_MEMORY 2 31 | #define SKIPLIST_ERROR_DUPLICATE 3 32 | 33 | NAGIOS_BEGIN_DECL 34 | 35 | typedef struct skiplistnode_struct { 36 | void *data; 37 | struct skiplistnode_struct *forward[1]; /* this must be the last element of the struct, as we allocate # of elements during runtime*/ 38 | } skiplistnode; 39 | 40 | typedef struct skiplist_struct { 41 | int current_level; 42 | int max_levels; 43 | float level_probability; 44 | unsigned long items; 45 | int allow_duplicates; 46 | int append_duplicates; 47 | int (*compare_function)(void *, void *); 48 | skiplistnode *head; 49 | } skiplist; 50 | 51 | 52 | skiplist *skiplist_new(int max_levels, float level_probability, int allow_duplicates, int append_duplicates, int (*compare_function)(void *, void *)); 53 | skiplistnode *skiplist_new_node(skiplist *list, int node_levels); 54 | int skiplist_insert(skiplist *list, void *data); 55 | int skiplist_random_level(skiplist *list); 56 | int skiplist_empty(skiplist *list); 57 | int skiplist_free(skiplist **list); 58 | void *skiplist_peek(skiplist *); 59 | void *skiplist_pop(skiplist *); 60 | void *skiplist_get_first(skiplist *list, void **node_ptr); 61 | void *skiplist_get_next(void **node_ptr); 62 | void *skiplist_find_first(skiplist *list, void *data, void **node_ptr); 63 | void *skiplist_find_next(skiplist *list, void *data, void **node_ptr); 64 | int skiplist_delete(skiplist *list, void *data); 65 | int skiplist_delete_first(skiplist *list, void *data); 66 | int skiplist_delete_all(skiplist *list, void *data); 67 | int skiplist_delete_node(skiplist *list, void *node_ptr); 68 | 69 | NAGIOS_END_DECL 70 | #endif 71 | -------------------------------------------------------------------------------- /include/nagios-3x/snprintf.h: -------------------------------------------------------------------------------- 1 | /* include/snprintf.h. Generated by configure. */ 2 | /* -*- C -*- */ 3 | /* #undef HAVE_SNPRINTF */ 4 | /* #undef NEED_VA_LIST */ 5 | -------------------------------------------------------------------------------- /include/nagios-3x/sretention.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * SRETENTION.H - Header for state retention routines 4 | * 5 | * Copyright (c) 1999-2006 Ethan Galstad (egalstad@nagios.org) 6 | * Last Modified: 02-28-2006 7 | * 8 | * License: 9 | * 10 | * This program is free software; you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License version 2 as 12 | * published by the Free Software Foundation. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | * 23 | *****************************************************************************/ 24 | 25 | #include "compat.h" 26 | NAGIOS_BEGIN_DECL 27 | 28 | int initialize_retention_data(char *); 29 | int cleanup_retention_data(char *); 30 | int save_state_information(int); /* saves all host and state information */ 31 | int read_initial_state_information(void); /* reads in initial host and state information */ 32 | 33 | NAGIOS_END_DECL 34 | -------------------------------------------------------------------------------- /include/nagios-4x/cgiauth.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * CGIAUTH.H - Authorization utilities header file 4 | * 5 | * 6 | * License: 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License version 2 as 10 | * published by the Free Software Foundation. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 | * 21 | *****************************************************************************/ 22 | 23 | #ifndef NAGIOS_CGIAUTH_H_INCLUDED 24 | #define NAGIOS_CGIAUTH_H_INCLUDED 25 | #include "common.h" 26 | #include "objects.h" 27 | 28 | NAGIOS_BEGIN_DECL 29 | 30 | typedef struct authdata_struct { 31 | char *username; 32 | int authorized_for_all_hosts; 33 | int authorized_for_all_host_commands; 34 | int authorized_for_all_services; 35 | int authorized_for_all_service_commands; 36 | int authorized_for_system_information; 37 | int authorized_for_system_commands; 38 | int authorized_for_configuration_information; 39 | int authorized_for_read_only; 40 | int authenticated; 41 | } authdata; 42 | 43 | 44 | 45 | int get_authentication_information(authdata *); /* gets current authentication information */ 46 | 47 | int is_authorized_for_host(host *, authdata *); 48 | int is_authorized_for_service(service *, authdata *); 49 | 50 | int is_authorized_for_all_hosts(authdata *); 51 | int is_authorized_for_all_services(authdata *); 52 | 53 | int is_authorized_for_system_information(authdata *); 54 | int is_authorized_for_system_commands(authdata *); 55 | int is_authorized_for_host_commands(host *, authdata *); 56 | int is_authorized_for_service_commands(service *, authdata *); 57 | 58 | int is_authorized_for_hostgroup(hostgroup *, authdata *); 59 | int is_authorized_for_servicegroup(servicegroup *, authdata *); 60 | 61 | int is_authorized_for_hostgroup_commands(hostgroup *, authdata *); 62 | int is_authorized_for_servicegroup_commands(servicegroup *, authdata *); 63 | 64 | int is_authorized_for_configuration_information(authdata *); 65 | 66 | int is_authorized_for_read_only(authdata *); 67 | 68 | NAGIOS_END_DECL 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /include/nagios-4x/getcgi.h: -------------------------------------------------------------------------------- 1 | /****************************************************** 2 | * 3 | * GETCGI.H - Nagios CGI Input Routine Include File 4 | * 5 | * 6 | *****************************************************/ 7 | 8 | #include "lib/lnag-utils.h" 9 | NAGIOS_BEGIN_DECL 10 | 11 | #define ACCEPT_LANGUAGE_Q_DELIMITER ";q=" 12 | 13 | /* information for a single language in the variable HTTP_ACCEPT_LANGUAGE 14 | sent by the browser */ 15 | typedef struct accept_language_struct { 16 | char * language; 17 | char * locality; 18 | double q; 19 | } accept_language; 20 | 21 | /* information for all languages in the variable HTTP_ACCEPT_LANGUAGE 22 | sent by the browser */ 23 | typedef struct accept_languages_struct { 24 | int count; 25 | accept_language ** languages; 26 | } accept_languages; 27 | 28 | char **getcgivars(void); 29 | void free_cgivars(char **); 30 | void unescape_cgi_input(char *); 31 | void sanitize_cgi_input(char **); 32 | unsigned char hex_to_char(char *); 33 | 34 | void process_language( char *); 35 | accept_languages * parse_accept_languages( char *); 36 | int compare_accept_languages( const void *, const void *); 37 | void free_accept_languages( accept_languages *); 38 | 39 | NAGIOS_END_DECL 40 | -------------------------------------------------------------------------------- /include/nagios-4x/lib/fanout.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBNAGIOS_FANOUT_H_INCLUDED 2 | #define LIBNAGIOS_FANOUT_H_INCLUDED 3 | #include "lnag-utils.h" 4 | 5 | /** 6 | * @file fanout.h 7 | * @brief Simple fanout table implementation 8 | * 9 | * Fanouts are useful to hold short-lived integer-indexed data where 10 | * the keyspan between smallest and largest key can be too large and 11 | * change too often for it to be practical to maintain a growing array. 12 | * If you think of it as a hash-table optimized for unsigned longs you've 13 | * got the right idea. 14 | * 15 | * @{ 16 | */ 17 | 18 | NAGIOS_BEGIN_DECL 19 | 20 | /** Primary (opaque) type for this api */ 21 | typedef struct fanout_table fanout_table; 22 | 23 | /** 24 | * Create a fanout table 25 | * @param[in] size The size of the table. Preferably a power of 2 26 | * @return Pointer to a newly created table 27 | */ 28 | extern fanout_table *fanout_create(unsigned long size); 29 | 30 | /** 31 | * Destroy a fanout table, with optional destructor. 32 | * This function will iterate over all the entries in the fanout 33 | * table and remove them, one by one. If 'destructor' is not NULL, 34 | * it will be called on each and every object in the table. Note that 35 | * 'free' is a valid destructor. 36 | * 37 | * @param[in] t The fanout table to destroy 38 | * @param[in] destructor Function to call on data pointers in table 39 | */ 40 | extern void fanout_destroy(fanout_table *t, void (*destructor)(void *)); 41 | 42 | /** 43 | * Return a pointer from the fanout table t 44 | * 45 | * @param[in] t table to fetch from 46 | * @param[in] key Key to fetch 47 | * @return NULL on errors; Pointer to data on success 48 | */ 49 | extern void *fanout_get(fanout_table *t, unsigned long key); 50 | 51 | /** 52 | * Add an entry to the fanout table. 53 | * Note that we don't check if the key is unique. If it isn't, 54 | * fanout_remove() will remove the latest added first. 55 | * 56 | * @param[in] t fanout table to add to 57 | * @param[in] key Key for this entry 58 | * @param[in] data Data to add. Must not be NULL 59 | * @return 0 on success, -1 on errors 60 | */ 61 | extern int fanout_add(fanout_table *t, unsigned long key, void *data); 62 | 63 | /** 64 | * Remove an entry from the fanout table and return its data. 65 | * 66 | * @param[in] t fanout table to look in 67 | * @param[in] key The key whose data we should locate 68 | * @return Pointer to the data stored on success; NULL on errors 69 | */ 70 | extern void *fanout_remove(fanout_table *t, unsigned long key); 71 | NAGIOS_END_DECL 72 | /** @} */ 73 | #endif 74 | -------------------------------------------------------------------------------- /include/nagios-4x/lib/libnagios.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBNAGIOS_LIBNAGIOS_H_INCLUDED 2 | #define LIBNAGIOS_LIBNAGIOS_H_INCLUDED 3 | /** 4 | * @file libnagios.h 5 | * 6 | * @brief Include this for all public parts of libnagios to be accessible 7 | */ 8 | 9 | #include "lnag-utils.h" 10 | #include "fanout.h" 11 | #include "nsutils.h" 12 | #include "prqueue.h" 13 | #include "squeue.h" 14 | #include "kvvec.h" 15 | #include "iobroker.h" 16 | #include "iocache.h" 17 | #include "runcmd.h" 18 | #include "bitmap.h" 19 | #include "dkhash.h" 20 | #include "worker.h" 21 | #include "skiplist.h" 22 | #include "nsock.h" 23 | #include "nspath.h" 24 | #include "snprintf.h" 25 | #include "nwrite.h" 26 | #endif /* LIB_libnagios_h__ */ 27 | -------------------------------------------------------------------------------- /include/nagios-4x/lib/nsock.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBNAGIOS_NSOCK_H_INCLUDED 2 | #define LIBNAGIOS_NSOCK_H_INCLUDED 3 | #include 4 | 5 | /** 6 | * @file nsock.h 7 | * @brief Nagios socket helper library 8 | * 9 | * This is a pretty stupid library, but since so many addons and 10 | * now Nagios core itself makes use of sockets, we might as well 11 | * have some simple wrappers for it that handle the most common 12 | * cases. 13 | * 14 | * @{ 15 | */ 16 | 17 | #define NSOCK_EBIND (-1) /**< failed to bind() */ 18 | #define NSOCK_ELISTEN (-2) /**< failed to listen() */ 19 | #define NSOCK_ESOCKET (-3) /**< failed to socket() */ 20 | #define NSOCK_EUNLINK (-4) /**< failed to unlink() */ 21 | #define NSOCK_ECONNECT (-5) /**< failed to connect() */ 22 | #define NSOCK_EFCNTL (-6) /**< failed to fcntl() */ 23 | #define NSOCK_EINVAL (-EINVAL) /**< -22, normally */ 24 | 25 | /* flags for the various create calls */ 26 | #define NSOCK_TCP (1 << 0) /**< use tcp mode */ 27 | #define NSOCK_UDP (1 << 1) /**< use udp mode */ 28 | #define NSOCK_UNLINK (1 << 2) /**< unlink existing path (only nsock_unix) */ 29 | #define NSOCK_REUSE (1 << 2) /**< reuse existing address */ 30 | #define NSOCK_CONNECT (1 << 3) /**< connect rather than create */ 31 | #define NSOCK_BLOCK (1 << 4) /**< socket should be in blocking mode */ 32 | 33 | /** 34 | * Grab an error string relating to nsock_unix() 35 | * @param code The error code return by the nsock library 36 | * @return An error string describing the error 37 | */ 38 | extern const char *nsock_strerror(int code); 39 | 40 | /** 41 | * Create or connect to a unix socket 42 | * To control permissions on sockets when NSOCK_LISTEN is specified, 43 | * callers will have to modify their umask() before (and possibly 44 | * after) the nsock_unix() call. 45 | * 46 | * @param path The path to connect to or create 47 | * @param flags Various options controlling the mode of the socket 48 | * @return An NSOCK_E macro on errors, the created socket on success 49 | */ 50 | extern int nsock_unix(const char *path, unsigned int flags); 51 | 52 | /** 53 | * Write a nul-terminated message to the socket pointed to by sd. 54 | * This isn't quite the same as dprintf(), which doesn't include 55 | * the terminating nul byte. 56 | * @note This function may block, so poll(2) for writability 57 | * @param sd The socket to write to 58 | * @param fmt The format string 59 | * @return Whatever write() returns 60 | */ 61 | extern int nsock_printf_nul(int sd, const char *fmt, ...) 62 | __attribute__((__format__(__printf__, 2, 3))); 63 | 64 | /** 65 | * Write a printf()-formatted string to the socket pointed to by sd. 66 | * This is identical to dprintf(), which is unfortunately GNU only. 67 | * @note This function may block, so poll(2) for writability 68 | * @param sd The socket to write to 69 | * @param fmt The format string 70 | * @return Whatever write() returns 71 | */ 72 | extern int nsock_printf(int sd, const char *fmt, ...) 73 | __attribute__((__format__(__printf__, 2, 3))); 74 | 75 | /** @} */ 76 | #endif /* LIBNAGIOS_NSOCK_H_INCLUDED */ 77 | -------------------------------------------------------------------------------- /include/nagios-4x/lib/nspath.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBNAGIOS_NSPATH_H_INCLUDED 2 | #define LIBNAGIOS_NSPATH_H_INCLUDED 3 | #ifndef _GNU_SOURCE 4 | # ifndef NODOXY 5 | # define _GNU_SOURCE 1 6 | # endif 7 | #endif 8 | #include 9 | #include 10 | #include "snprintf.h" 11 | 12 | /** 13 | * @file nspath.h 14 | * @brief path handling functions 15 | * 16 | * This library handles path normalization and resolution. It's nifty 17 | * if you want to turn relative paths into absolute ones, or if you 18 | * want to make insane ones sane, but without chdir()'ing your way 19 | * around the filesystem. 20 | * 21 | * @{ 22 | */ 23 | 24 | /** 25 | * Normalize a path 26 | * By "normalize", we mean that we convert dot-slash and dot-dot-slash 27 | * embedded components into a legible continuous string of characters. 28 | * Leading and trailing slashes are kept exactly as they are in input, 29 | * but with sequences of slashes reduced to a single one. 30 | * 31 | * "foo/bar/.././lala.txt" becomes "foo/lala.txt" 32 | * "../../../../bar/../foo/" becomes "/foo/" 33 | * "////foo////././bar" becomes "/foo/bar" 34 | * @param orig_path The path to normalize 35 | * @return A newly allocated string containing the normalized path 36 | */ 37 | extern char *nspath_normalize(const char *orig_path); 38 | 39 | /** 40 | * Make the "base"-relative path "rel_path" absolute. 41 | * Turns the relative path "rel_path" into an absolute path and 42 | * resolves it as if we were currently in "base". If "base" is 43 | * NULL, the current working directory is used. If "base" is not 44 | * null, it should be an absolute path for the result to make 45 | * sense. 46 | * 47 | * @param rel_path The relative path to convert 48 | * @param base The base directory (if NULL, we use current working dir) 49 | * @return A newly allocated string containing the absolute path 50 | */ 51 | extern char *nspath_absolute(const char *rel_path, const char *base); 52 | 53 | /** 54 | * Canonicalize the "base"-relative path "rel_path". 55 | * errno gets properly set in case of errors. 56 | * @param rel_path The path to transform 57 | * @param base The base we should operate relative to 58 | * @return Newly allocated canonical path on success, NULL on errors 59 | */ 60 | extern char *nspath_real(const char *rel_path, const char *base); 61 | 62 | /** 63 | * Get absolute dirname of "path", relative to "base" 64 | * @param path Full path to target object (file or subdir) 65 | * @param base The base directory (if NULL, we use current working dir) 66 | * @return NULL on errors, allocated absolute directory name on success 67 | */ 68 | extern char *nspath_absolute_dirname(const char *path, const char *base); 69 | 70 | 71 | /** 72 | * Recursively create a directory, just like mkdir_p would. 73 | * @note This function *will* taint errno with ENOENT if any path 74 | * component has to be created. 75 | * @note If "path" has a trailing slash, NSPATH_MKDIR_SKIP_LAST 76 | * won't have any effect. That's considered a feature, since the 77 | * option is designed so one can send a file-path to the function 78 | * and have it create the directory structure for it. 79 | * @param path Path to create, in normalized form 80 | * @param mode Filemode (same as mkdir() takes) 81 | * @param options Options flag. See NSPATH_MKDIR_* for or-able options 82 | * @return 0 on success, -1 on errors and errno will hold error code 83 | * from either stat() or mkdir(). 84 | */ 85 | extern int nspath_mkdir_p(const char *path, mode_t mode, int options); 86 | 87 | /** Don't mkdir() last element of path when calling nspath_mkdir_p() */ 88 | #define NSPATH_MKDIR_SKIP_LAST (1 << 0) 89 | 90 | /** @} */ 91 | #endif 92 | -------------------------------------------------------------------------------- /include/nagios-4x/lib/nsutils.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBNAGIOS_NSUTILS_H_INCLUDED 2 | #define LIBNAGIOS_NSUTILS_H_INCLUDED 3 | #include 4 | #include 5 | 6 | /** 7 | * @file nsutils.h 8 | * @brief Non-Standard (or Nagios) utility functions and macros. 9 | * 10 | * This is where we house all helpers and macros that fall outside 11 | * the "standard-ish" norm. The prefixes "nsu_" and NSU_ are 12 | * reserved for this purpose, so we avoid clashing with other 13 | * applications that may have similarly-acting functions with 14 | * identical names. 15 | * 16 | * The functions already here lack the nsu_ prefix for backwards 17 | * compatibility reasons. It's possible we'll have to fix that 18 | * some day, but let's leave that for later. 19 | * 20 | * @{ 21 | */ 22 | 23 | /** Macro for dynamically increasing vector lengths */ 24 | #define alloc_nr(x) (((x)+16)*3/2) 25 | 26 | /** 27 | * Check if a number is a power of 2 28 | * @param x The number to check 29 | * @return 1 if the number is a power of 2, 0 if it's not 30 | */ 31 | static inline int nsu_ispow2(unsigned int x) 32 | { 33 | return x > 1 ? !(x & (x - 1)) : 0; 34 | } 35 | 36 | /** 37 | * Round up to a power of 2 38 | * Yes, this is the most cryptic function name in all of Nagios, but I 39 | * like it, so shush. 40 | * @param r The number to round up 41 | * @return r, rounded up to the nearest power of 2. 42 | */ 43 | static inline unsigned int rup2pof2(unsigned int r) 44 | { 45 | r--; 46 | if (!r) 47 | return 2; 48 | r |= r >> 1; 49 | r |= r >> 2; 50 | r |= r >> 4; 51 | r |= r >> 8; 52 | r |= r >> 16; 53 | 54 | return r + 1; 55 | } 56 | 57 | /** 58 | * Grab a random unsigned int in the range between low and high. 59 | * Note that the PRNG has to be seeded prior to calling this. 60 | * @param low The lower bound, inclusive 61 | * @param high The higher bound, inclusive 62 | * @return An unsigned integer in the mathematical range [low, high] 63 | */ 64 | static inline unsigned int ranged_urand(unsigned int low, unsigned int high) 65 | { 66 | return low + (rand() * (1.0 / (RAND_MAX + 1.0)) * (high - low)); 67 | } 68 | 69 | /** 70 | * Get number of online cpus 71 | * @return Active cpu cores detected on success. 0 on failure. 72 | */ 73 | extern int real_online_cpus(void); 74 | 75 | /** 76 | * Wrapper for real_online_cpus(), returning 1 in case we can't 77 | * detect any active cpus. 78 | * @return Number of active cpu cores on success. 1 on failure. 79 | */ 80 | extern int online_cpus(void); 81 | 82 | /** 83 | * Create a short-lived string in stack-allocated memory 84 | * The number and size of strings is limited (currently to 256 strings of 85 | * 32 bytes each), so beware and use this sensibly. Intended for 86 | * number-to-string conversion and other short strings. 87 | * @note The returned string must *not* be free()'d! 88 | * @param[in] fmt The format string 89 | * @return A pointer to the formatted string on success. Undefined on errors 90 | */ 91 | extern const char *mkstr(const char *fmt, ...) 92 | __attribute__((__format__(__printf__, 1, 2))); 93 | 94 | /** 95 | * Calculate the millisecond delta between two timeval structs 96 | * @param[in] start The start time 97 | * @param[in] stop The stop time 98 | * @return The millisecond delta between the two structs 99 | */ 100 | extern int tv_delta_msec(const struct timeval *start, const struct timeval *stop); 101 | 102 | 103 | /** 104 | * Get timeval delta as seconds 105 | * @param start The start time 106 | * @param stop The stop time 107 | * @return time difference in fractions of seconds 108 | */ 109 | extern float tv_delta_f(const struct timeval *start, const struct timeval *stop); 110 | 111 | /** @} */ 112 | #endif /* LIBNAGIOS_NSUTILS_H_INCLUDED */ 113 | -------------------------------------------------------------------------------- /include/nagios-4x/lib/nwrite.h: -------------------------------------------------------------------------------- 1 | #ifndef LIBNAGIOS_NWRITE_H_INCLUDED 2 | #define LIBNAGIOS_NWRITE_H_INCLUDED 3 | 4 | /** 5 | * @file nwrite.h 6 | * @brief Functions that properly handle incomplete write()'s 7 | * 8 | * Some functions simply use write() to send data through a socket. 9 | * These calls are sometimes interrupted, especially in the case of 10 | * an overly large buffer. Even though the write() _could_ finish, 11 | * the incomplete write is treated as an error. The functions here 12 | * properly handle those cases. 13 | * 14 | * @{ 15 | */ 16 | 17 | /** 18 | * Send data through a socket 19 | * This function will send data through a socket and return 20 | * the number of bytes written. 21 | * @param sock The socket to write to 22 | * @param data The data to write 23 | * @param lth The length of the data 24 | * @param sent The number of bytes written (can be NULL) 25 | * @return The number of bytes written or -1 if error 26 | */ 27 | static inline ssize_t nwrite(int fd, const void *buf, size_t count, ssize_t *written) 28 | { 29 | /* 30 | * Given the API we have to assume (unsigned) size_t 'count' fits into 31 | * a (signed) ssize_t because we can't return a larger value. 32 | * https://stackoverflow.com/questions/29722999/will-write2-always-write-less-than-or-equal-to-ssize-max 33 | */ 34 | ssize_t out, tot = 0; 35 | 36 | if (!buf || count == 0) 37 | return 0; 38 | 39 | while ((size_t) tot < count) { 40 | out = write(fd, (const char *) buf + tot, count - tot); 41 | if (out > 0) 42 | tot += out; 43 | else if(errno == EAGAIN || errno == EINTR) 44 | continue; 45 | else { 46 | if (written) 47 | *written = tot; 48 | return out; 49 | } 50 | } 51 | if (written) 52 | *written = tot; 53 | return tot; 54 | } 55 | 56 | /** @} */ 57 | #endif /* LIBNAGIOS_NWRITE_H_INCLUDED */ 58 | -------------------------------------------------------------------------------- /include/nagios-4x/lib/snprintf.h: -------------------------------------------------------------------------------- 1 | /* lib/snprintf.h. Generated from snprintf.h.in by configure. */ 2 | /* -*- C -*- */ 3 | #ifndef LIBNAGIOS_snprintf_h__ 4 | #define LIBNAGIOS_snprintf_h__ 5 | /* #undef HAVE_SNPRINTF */ 6 | /* #undef NEED_VA_LIST */ 7 | #endif 8 | -------------------------------------------------------------------------------- /include/nagios-4x/lib/t-utils.h: -------------------------------------------------------------------------------- 1 | #ifndef NAGIOS_T_UTILS_H_INCLUDED 2 | #define NAGIOS_T_UTILS_H_INCLUDED 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #ifndef ARRAY_SIZE 10 | # define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) 11 | #endif 12 | 13 | #define TEST_PASS 1 14 | #define TEST_FAIL 0 15 | 16 | #define CLR_RESET "\033[m" 17 | #define CLR_BOLD "\033[1m" 18 | #define CLR_RED "\033[31m" 19 | #define CLR_GREEN "\033[32m" 20 | #define CLR_BROWN "\033[33m" 21 | #define CLR_YELLOW "\033[33m\033[1m" 22 | #define CLR_BLUE "\033[34m" 23 | #define CLR_MAGENTA "\033[35m" 24 | #define CLR_CYAN "\033[36m" 25 | #define CLR_BG_RED "\033[41m" 26 | #define CLR_BRIGHT_RED "\033[31m\033[1m" 27 | #define CLR_BRIGHT_GREEN "\033[32m\033[1m" 28 | #define CLR_BRIGHT_BLUE "\033[34m\033[1m" 29 | #define CLR_BRIGHT_MAGENTA "\033[35m\033[1m" 30 | #define CLR_BRIGHT_CYAN "\033[36m\033[1m" 31 | 32 | extern const char *red, *green, *yellow, *cyan, *reset; 33 | extern unsigned int passed, failed, t_verbose; 34 | 35 | #define CHECKPOINT() \ 36 | do { \ 37 | fprintf(stderr, "ALIVE @ %s:%s:%d\n", __FILE__, __func__, __LINE__); \ 38 | } while(0) 39 | 40 | #define t_assert(expr) \ 41 | 42 | extern void t_set_colors(int force); 43 | extern void t_start(const char *fmt, ...) 44 | __attribute__((__format__(__printf__, 1, 2))); 45 | extern void t_pass(const char *fmt, ...) 46 | __attribute__((__format__(__printf__, 1, 2))); 47 | extern void t_fail(const char *fmt, ...) 48 | __attribute__((__format__(__printf__, 1, 2))); 49 | extern void t_diag(const char *fmt, ...) 50 | __attribute__((__format__(__printf__, 1, 2))); 51 | extern int t_ok(int success, const char *fmt, ...) 52 | __attribute__((__format__(__printf__, 2, 3))); 53 | #define test t_ok 54 | #define t_req(expr) \ 55 | if (!(expr)) \ 56 | crash("No further testing is possible: " #expr " @%s:%d", __FILE__, __LINE__) 57 | extern int ok_int(int a, int b, const char *name); 58 | extern int ok_uint(unsigned int a, unsigned int b, const char *name); 59 | extern int ok_str(const char *a, const char *b, const char *name); 60 | extern int t_end(void); 61 | extern void t_reset(void); 62 | extern void crash(const char *fmt, ...) 63 | __attribute__((__format__(__printf__, 1, 2), __noreturn__)); 64 | #endif 65 | -------------------------------------------------------------------------------- /include/nagios-4x/locations.h: -------------------------------------------------------------------------------- 1 | /************************************************************************ 2 | * 3 | * Nagios Locations Header File 4 | * Written By: Ethan Galstad (egalstad@nagios.org) 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License version 2 as 8 | * published by the Free Software Foundation. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program; if not, write to the Free Software 17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 | ************************************************************************/ 19 | 20 | #define DEFAULT_TEMP_FILE "/usr/local/nagios/var/tempfile" 21 | #define DEFAULT_TEMP_PATH "/tmp" 22 | #define DEFAULT_CHECK_RESULT_PATH "/usr/local/nagios/var/spool/checkresults" 23 | #define DEFAULT_STATUS_FILE "/usr/local/nagios/var/status.dat" 24 | #define DEFAULT_LOG_FILE "/usr/local/nagios/var/nagios.log" 25 | #define DEFAULT_LOG_ARCHIVE_PATH "/usr/local/nagios/var/archives/" 26 | #define DEFAULT_DEBUG_FILE "/usr/local/nagios/var/nagios.debug" 27 | #define DEFAULT_COMMENT_FILE "/usr/local/nagios/var/comments.dat" 28 | #define DEFAULT_DOWNTIME_FILE "/usr/local/nagios/var/downtime.dat" 29 | #define DEFAULT_RETENTION_FILE "/usr/local/nagios/var/retention.dat" 30 | #define DEFAULT_COMMAND_FILE "/usr/local/nagios/var/rw/nagios.cmd" 31 | #define DEFAULT_QUERY_SOCKET "/usr/local/nagios/var/rw/nagios.qh" 32 | #define DEFAULT_CONFIG_FILE "/usr/local/nagios/etc/nagios.cfg" 33 | #define DEFAULT_PHYSICAL_HTML_PATH "/usr/local/nagios/share" 34 | #define DEFAULT_URL_HTML_PATH "/nagios" 35 | #define DEFAULT_PHYSICAL_CGIBIN_PATH "/usr/local/nagios/sbin" 36 | #define DEFAULT_URL_CGIBIN_PATH "/nagios/cgi-bin" 37 | #define DEFAULT_CGI_CONFIG_FILE "/usr/local/nagios/etc/cgi.cfg" 38 | #define DEFAULT_LOCK_FILE "/run/nagios.lock" 39 | #define DEFAULT_OBJECT_CACHE_FILE "/usr/local/nagios/var/objects.cache" 40 | #define DEFAULT_PRECACHED_OBJECT_FILE "/usr/local/nagios/var/objects.precache" 41 | #define DEFAULT_EVENT_BROKER_FILE "/usr/local/nagios/var/broker.socket" 42 | -------------------------------------------------------------------------------- /include/nagios-4x/logging.h: -------------------------------------------------------------------------------- 1 | #ifndef NAGIOS_LOGGING_H_INCLUDED 2 | #define NAGIOS_LOGGING_H_INCLUDED 3 | 4 | #include "objects.h" 5 | 6 | /******************* LOGGING TYPES ********************/ 7 | 8 | #define NSLOG_RUNTIME_ERROR 1 9 | #define NSLOG_RUNTIME_WARNING 2 10 | 11 | #define NSLOG_VERIFICATION_ERROR 4 12 | #define NSLOG_VERIFICATION_WARNING 8 13 | 14 | #define NSLOG_CONFIG_ERROR 16 15 | #define NSLOG_CONFIG_WARNING 32 16 | 17 | #define NSLOG_PROCESS_INFO 64 18 | #define NSLOG_EVENT_HANDLER 128 19 | /*#define NSLOG_NOTIFICATION 256*/ /* NOT USED ANYMORE - CAN BE REUSED */ 20 | #define NSLOG_EXTERNAL_COMMAND 512 21 | 22 | #define NSLOG_HOST_UP 1024 23 | #define NSLOG_HOST_DOWN 2048 24 | #define NSLOG_HOST_UNREACHABLE 4096 25 | 26 | #define NSLOG_SERVICE_OK 8192 27 | #define NSLOG_SERVICE_UNKNOWN 16384 28 | #define NSLOG_SERVICE_WARNING 32768 29 | #define NSLOG_SERVICE_CRITICAL 65536 30 | 31 | #define NSLOG_PASSIVE_CHECK 131072 32 | 33 | #define NSLOG_INFO_MESSAGE 262144 34 | 35 | #define NSLOG_HOST_NOTIFICATION 524288 36 | #define NSLOG_SERVICE_NOTIFICATION 1048576 37 | 38 | /***************** DEBUGGING LEVELS *******************/ 39 | 40 | #define DEBUGL_ALL -1 41 | #define DEBUGL_NONE 0 42 | #define DEBUGL_FUNCTIONS 1 43 | #define DEBUGL_CONFIG 2 44 | #define DEBUGL_PROCESS 4 45 | #define DEBUGL_STATUSDATA 4 46 | #define DEBUGL_RETENTIONDATA 4 47 | #define DEBUGL_EVENTS 8 48 | #define DEBUGL_CHECKS 16 49 | #define DEBUGL_FLAPPING 16 50 | #define DEBUGL_EVENTHANDLERS 16 51 | #define DEBUGL_PERFDATA 16 52 | #define DEBUGL_NOTIFICATIONS 32 53 | #define DEBUGL_EVENTBROKER 64 54 | #define DEBUGL_EXTERNALCOMMANDS 128 55 | #define DEBUGL_COMMANDS 256 56 | #define DEBUGL_DOWNTIME 512 57 | #define DEBUGL_COMMENTS 1024 58 | #define DEBUGL_MACROS 2048 59 | #define DEBUGL_IPC 4096 60 | #define DEBUGL_SCHEDULING 8192 61 | #define DEBUGL_WORKERS 16384 62 | 63 | #define DEBUGV_BASIC 0 64 | #define DEBUGV_MORE 1 65 | #define DEBUGV_MOST 2 66 | 67 | NAGIOS_BEGIN_DECL 68 | /**** Logging Functions ****/ 69 | void logit(int, int, const char *, ...) 70 | __attribute__((__format__(__printf__, 3, 4))); 71 | int log_debug_info(int, int, const char *, ...) 72 | __attribute__((__format__(__printf__, 3, 4))); 73 | 74 | #ifndef NSCGI 75 | int write_to_all_logs(char *, unsigned long); /* writes a string to main log file and syslog facility */ 76 | int write_to_log(char *, unsigned long, time_t *); /* write a string to the main log file */ 77 | int write_to_syslog(char *, unsigned long); /* write a string to the syslog facility */ 78 | int log_service_event(service *); /* logs a service event */ 79 | int log_host_event(host *); /* logs a host event */ 80 | int log_host_states(int, time_t *); /* logs initial/current host states */ 81 | int log_service_states(int, time_t *); /* logs initial/current service states */ 82 | int rotate_log_file(time_t); /* rotates the main log file */ 83 | int write_log_file_info(time_t *); /* records log file/version info */ 84 | int open_debug_log(void); 85 | int close_debug_log(void); 86 | int close_log_file(void); 87 | int fix_log_file_owner(uid_t uid, gid_t gid); 88 | #endif /* !NSCGI */ 89 | 90 | NAGIOS_END_DECL 91 | #endif 92 | -------------------------------------------------------------------------------- /include/nagios-4x/nebcallbacks.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * NEBCALLBACKS.H - Include file for event broker modules 4 | * 5 | * 6 | * License: 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License version 2 as 10 | * published by the Free Software Foundation. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 | * 21 | *****************************************************************************/ 22 | 23 | #ifndef NAGIOS_NEBCALLBACKS_H_INCLUDED 24 | #define NAGIOS_NEBCALLBACKS_H_INCLUDED 25 | 26 | #include "nebmodules.h" 27 | 28 | 29 | /***** CALLBACK TYPES *****/ 30 | 31 | #define NEBCALLBACK_NUMITEMS 26 /* total number of callback types we have */ 32 | 33 | #define NEBCALLBACK_PROCESS_DATA 0 34 | #define NEBCALLBACK_TIMED_EVENT_DATA 1 35 | #define NEBCALLBACK_LOG_DATA 2 36 | #define NEBCALLBACK_SYSTEM_COMMAND_DATA 3 37 | #define NEBCALLBACK_EVENT_HANDLER_DATA 4 38 | #define NEBCALLBACK_NOTIFICATION_DATA 5 39 | #define NEBCALLBACK_SERVICE_CHECK_DATA 6 40 | #define NEBCALLBACK_HOST_CHECK_DATA 7 41 | #define NEBCALLBACK_COMMENT_DATA 8 42 | #define NEBCALLBACK_DOWNTIME_DATA 9 43 | #define NEBCALLBACK_FLAPPING_DATA 10 44 | #define NEBCALLBACK_PROGRAM_STATUS_DATA 11 45 | #define NEBCALLBACK_HOST_STATUS_DATA 12 46 | #define NEBCALLBACK_SERVICE_STATUS_DATA 13 47 | #define NEBCALLBACK_ADAPTIVE_PROGRAM_DATA 14 48 | #define NEBCALLBACK_ADAPTIVE_HOST_DATA 15 49 | #define NEBCALLBACK_ADAPTIVE_SERVICE_DATA 16 50 | #define NEBCALLBACK_EXTERNAL_COMMAND_DATA 17 51 | #define NEBCALLBACK_AGGREGATED_STATUS_DATA 18 52 | #define NEBCALLBACK_RETENTION_DATA 19 53 | #define NEBCALLBACK_CONTACT_NOTIFICATION_DATA 20 54 | #define NEBCALLBACK_CONTACT_NOTIFICATION_METHOD_DATA 21 55 | #define NEBCALLBACK_ACKNOWLEDGEMENT_DATA 22 56 | #define NEBCALLBACK_STATE_CHANGE_DATA 23 57 | #define NEBCALLBACK_CONTACT_STATUS_DATA 24 58 | #define NEBCALLBACK_ADAPTIVE_CONTACT_DATA 25 59 | 60 | #define nebcallback_flag(x) (1 << (x)) 61 | 62 | /***** CALLBACK FUNCTIONS *****/ 63 | NAGIOS_BEGIN_DECL 64 | 65 | int neb_register_callback(int callback_type, void *mod_handle, int priority, int (*callback_func)(int, void *)); 66 | int neb_deregister_callback(int callback_type, int (*callback_func)(int, void *)); 67 | int neb_deregister_module_callbacks(nebmodule *); 68 | 69 | NAGIOS_END_DECL 70 | #endif 71 | -------------------------------------------------------------------------------- /include/nagios-4x/neberrors.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * NEBERRORS.H - Event broker errors 4 | * 5 | * 6 | * License: 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License version 2 as 10 | * published by the Free Software Foundation. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 | * 21 | *****************************************************************************/ 22 | 23 | #ifndef NAGIOS_NEBERRORS_H_INCLUDED 24 | #define NAGIOS_NEBERRORS_H_INCLUDED 25 | 26 | 27 | /***** GENERIC DEFINES *****/ 28 | 29 | #define NEB_OK 0 30 | #define NEB_ERROR -1 31 | 32 | #define NEB_TRUE 1 33 | #define NEB_FALSE 0 34 | 35 | 36 | 37 | /***** GENERIC ERRORS *****/ 38 | 39 | #define NEBERROR_NOMEM 100 /* memory could not be allocated */ 40 | 41 | 42 | 43 | /***** CALLBACK ERRORS *****/ 44 | 45 | #define NEBERROR_NOCALLBACKFUNC 200 /* no callback function was specified */ 46 | #define NEBERROR_NOCALLBACKLIST 201 /* callback list not initialized */ 47 | #define NEBERROR_CALLBACKBOUNDS 202 /* callback type was out of bounds */ 48 | #define NEBERROR_CALLBACKNOTFOUND 203 /* the callback could not be found */ 49 | #define NEBERROR_NOMODULEHANDLE 204 /* no module handle specified */ 50 | #define NEBERROR_BADMODULEHANDLE 205 /* bad module handle */ 51 | #define NEBERROR_CALLBACKOVERRIDE 206 /* module wants to override default Nagios handling of event */ 52 | #define NEBERROR_CALLBACKCANCEL 207 /* module wants to cancel callbacks to other modules */ 53 | 54 | 55 | 56 | /***** MODULE ERRORS *****/ 57 | 58 | #define NEBERROR_NOMODULE 300 /* no module was specified */ 59 | 60 | 61 | 62 | /***** MODULE INFO ERRORS *****/ 63 | 64 | #define NEBERROR_MODINFOBOUNDS 400 /* module info index was out of bounds */ 65 | 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /include/nagios-4x/nebmods.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * NEBMODS.H - Include file for event broker modules 4 | * 5 | * 6 | * License: 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License version 2 as 10 | * published by the Free Software Foundation. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 | * 21 | *****************************************************************************/ 22 | 23 | #ifndef NAGIOS_NEBMODS_H_INCLUDED 24 | #define NAGIOS_NEBMODS_H_INCLUDED 25 | 26 | #include "nebcallbacks.h" 27 | #include "nebmodules.h" 28 | 29 | NAGIOS_BEGIN_DECL 30 | 31 | /***** MODULE STRUCTURES *****/ 32 | 33 | /* NEB module callback list struct */ 34 | typedef struct nebcallback_struct { 35 | void *callback_func; 36 | void *module_handle; 37 | int priority; 38 | struct nebcallback_struct *next; 39 | } nebcallback; 40 | 41 | 42 | 43 | /***** MODULE FUNCTIONS *****/ 44 | 45 | int neb_init_modules(void); 46 | int neb_deinit_modules(void); 47 | int neb_load_all_modules(void); 48 | int neb_load_module(nebmodule *); 49 | int neb_free_module_list(void); 50 | int neb_unload_all_modules(int, int); 51 | int neb_unload_module(nebmodule *, int, int); 52 | int neb_add_module(char *, char *, int); 53 | int neb_add_core_module(nebmodule *mod); 54 | 55 | 56 | /***** CALLBACK FUNCTIONS *****/ 57 | int neb_init_callback_list(void); 58 | int neb_free_callback_list(void); 59 | int neb_make_callbacks(int, void *); 60 | 61 | NAGIOS_END_DECL 62 | #endif 63 | -------------------------------------------------------------------------------- /include/nagios-4x/nebmodules.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * NEBMODULES.H - Include file for event broker modules 4 | * 5 | * 6 | * License: 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License version 2 as 10 | * published by the Free Software Foundation. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 | * 21 | *****************************************************************************/ 22 | 23 | #ifndef NAGIOS_NEBMODULES_H_INCLUDED 24 | #define NAGIOS_NEBMODULES_H_INCLUDED 25 | 26 | #include "common.h" 27 | NAGIOS_BEGIN_DECL 28 | 29 | /***** MODULE VERSION INFORMATION *****/ 30 | 31 | #define NEB_API_VERSION(x) int __neb_api_version = x; 32 | #define CURRENT_NEB_API_VERSION 4 33 | 34 | 35 | 36 | /***** MODULE INFORMATION *****/ 37 | 38 | #define NEBMODULE_MODINFO_NUMITEMS 6 39 | #define NEBMODULE_MODINFO_TITLE 0 40 | #define NEBMODULE_MODINFO_AUTHOR 1 41 | #define NEBMODULE_MODINFO_COPYRIGHT 2 42 | #define NEBMODULE_MODINFO_VERSION 3 43 | #define NEBMODULE_MODINFO_LICENSE 4 44 | #define NEBMODULE_MODINFO_DESC 5 45 | 46 | 47 | 48 | /***** MODULE LOAD/UNLOAD OPTIONS *****/ 49 | 50 | #define NEBMODULE_NORMAL_LOAD 0 /* module is being loaded normally */ 51 | #define NEBMODULE_REQUEST_UNLOAD 0 /* request module to unload (but don't force it) */ 52 | #define NEBMODULE_FORCE_UNLOAD 1 /* force module to unload */ 53 | 54 | 55 | 56 | /***** MODULES UNLOAD REASONS *****/ 57 | 58 | #define NEBMODULE_NEB_SHUTDOWN 1 /* event broker is shutting down */ 59 | #define NEBMODULE_NEB_RESTART 2 /* event broker is restarting */ 60 | #define NEBMODULE_ERROR_NO_INIT 3 /* _module_init() function was not found in module */ 61 | #define NEBMODULE_ERROR_BAD_INIT 4 /* _module_init() function returned a bad code */ 62 | #define NEBMODULE_ERROR_API_VERSION 5 /* module version is incompatible with current api */ 63 | 64 | 65 | 66 | /***** MODULE STRUCTURES *****/ 67 | 68 | /* NEB module structure */ 69 | typedef struct nebmodule_struct { 70 | char *filename; 71 | char *dl_file; /* the file we actually loaded */ 72 | char *args; 73 | char *info[NEBMODULE_MODINFO_NUMITEMS]; 74 | int should_be_loaded; 75 | int is_currently_loaded; 76 | int core_module; 77 | #ifdef USE_LTDL 78 | lt_dlhandle module_handle; 79 | lt_ptr init_func; 80 | lt_ptr deinit_func; 81 | #else 82 | void *module_handle; 83 | void *init_func; 84 | void *deinit_func; 85 | #endif 86 | struct nebmodule_struct *next; 87 | } nebmodule; 88 | 89 | 90 | /***** MODULE FUNCTIONS *****/ 91 | int neb_set_module_info(void *, int, char *); 92 | 93 | NAGIOS_END_DECL 94 | #endif 95 | -------------------------------------------------------------------------------- /include/nagios-4x/netutils.h: -------------------------------------------------------------------------------- 1 | #ifndef NAGIOS_NETUGILS_H_INCLUDED 2 | #define NAGIOS_NETUGILS_H_INCLUDED 3 | #include "common.h" 4 | 5 | #ifdef HAVE_SSL 6 | #include 7 | #endif 8 | 9 | NAGIOS_BEGIN_DECL 10 | 11 | #ifdef HAVE_SSL 12 | int my_ssl_connect(const char *host_name, int port, int *sd, SSL **ssl, SSL_CTX **ctx, int timeout); 13 | int my_ssl_sendall(int sd, SSL *ssl, const char *buf, int *len, int timeout); 14 | int my_ssl_recvall(int s, SSL *ssl, char *buf, int *len, int timeout); 15 | #endif 16 | 17 | int my_tcp_connect(const char *host_name, int port, int *sd, int timeout); 18 | int my_sendall(int s, const char *buf, int *len, int timeout); 19 | int my_recvall(int s, char *buf, int *len, int timeout); 20 | NAGIOS_END_DECL 21 | #endif 22 | 23 | -------------------------------------------------------------------------------- /include/nagios-4x/perfdata.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * PERFDATA.H - Include file for performance data routines 4 | * 5 | * 6 | * License: 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License version 2 as 10 | * published by the Free Software Foundation. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 | * 21 | *****************************************************************************/ 22 | 23 | #ifndef NAGIOS_PERFDATA_H_INCLUDED 24 | #define NAGIOS_PERFDATA_H_INCLUDED 25 | 26 | #include "common.h" 27 | #include "objects.h" 28 | 29 | NAGIOS_BEGIN_DECL 30 | 31 | int initialize_performance_data(const char *); /* initializes performance data */ 32 | int cleanup_performance_data(void); /* cleans up performance data */ 33 | 34 | int update_host_performance_data(host *); /* updates host performance data */ 35 | int update_service_performance_data(service *); /* updates service performance data */ 36 | 37 | NAGIOS_END_DECL 38 | #endif 39 | -------------------------------------------------------------------------------- /include/nagios-4x/shared.h: -------------------------------------------------------------------------------- 1 | #ifndef NAGIOS_SHARED_H_INCLUDED 2 | #define NAGIOS_SHARED_H_INCLUDED 3 | 4 | #include 5 | #include "lib/libnagios.h" 6 | 7 | NAGIOS_BEGIN_DECL 8 | 9 | /* mmapfile structure - used for reading files via mmap() */ 10 | typedef struct mmapfile_struct { 11 | char *path; 12 | int mode; 13 | int fd; 14 | unsigned long file_size; 15 | unsigned long current_position; 16 | unsigned long current_line; 17 | void *mmap_buf; 18 | } mmapfile; 19 | 20 | /* official count of first-class objects */ 21 | struct object_count { 22 | unsigned int commands; 23 | unsigned int timeperiods; 24 | unsigned int hosts; 25 | unsigned int hostescalations; 26 | unsigned int hostdependencies; 27 | unsigned int services; 28 | unsigned int serviceescalations; 29 | unsigned int servicedependencies; 30 | unsigned int contacts; 31 | unsigned int contactgroups; 32 | unsigned int hostgroups; 33 | unsigned int servicegroups; 34 | }; 35 | 36 | extern struct object_count num_objects; 37 | 38 | extern void init_shared_cfg_vars(int); 39 | extern void timing_point(const char *fmt, ...); /* print a message and the time since the first message */ 40 | extern char *my_strtok(char *buffer, const char *tokens); 41 | extern char *my_strtok_with_free(char *buffer, const char *tokens, int free_orig); 42 | extern char *my_strsep(char **stringp, const char *delim); 43 | extern mmapfile *mmap_fopen(const char *filename); 44 | extern int mmap_fclose(mmapfile *temp_mmapfile); 45 | extern char *mmap_fgets(mmapfile *temp_mmapfile); 46 | extern char *mmap_fgets_multiline(mmapfile * temp_mmapfile); 47 | extern void strip(char *buffer); 48 | extern int hashfunc(const char *name1, const char *name2, int hashslots); 49 | extern int compare_hashdata(const char *val1a, const char *val1b, const char *val2a, 50 | const char *val2b); 51 | extern void get_datetime_string(time_t *raw_time, char *buffer, 52 | int buffer_length, int type); 53 | extern void get_time_breakdown(unsigned long raw_time, int *days, int *hours, 54 | int *minutes, int *seconds); 55 | 56 | extern void ensure_path_separator(char *path, size_t size); 57 | 58 | NAGIOS_END_DECL 59 | #endif 60 | -------------------------------------------------------------------------------- /include/nagios-4x/snprintf.h: -------------------------------------------------------------------------------- 1 | /* include/snprintf.h. Generated from snprintf.h.in by configure. */ 2 | /* -*- C -*- */ 3 | /* #undef HAVE_SNPRINTF */ 4 | /* #undef NEED_VA_LIST */ 5 | -------------------------------------------------------------------------------- /include/nagios-4x/sretention.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * SRETENTION.H - Header for state retention routines 4 | * 5 | * 6 | * License: 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License version 2 as 10 | * published by the Free Software Foundation. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 | * 21 | *****************************************************************************/ 22 | 23 | #include "common.h" 24 | NAGIOS_BEGIN_DECL 25 | 26 | int initialize_retention_data(const char *); 27 | int cleanup_retention_data(void); 28 | int save_state_information(int); /* saves all host and state information */ 29 | int read_initial_state_information(void); /* reads in initial host and state information */ 30 | 31 | NAGIOS_END_DECL 32 | -------------------------------------------------------------------------------- /include/nagios-4x/workers.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_WORKERS_H_INCLUDED 2 | #define INCLUDE_WORKERS_H_INCLUDED 3 | #include "lib/libnagios.h" 4 | #include "lib/worker.h" 5 | #include "nagios.h" /* for check_result definition */ 6 | 7 | /* different jobtypes. We add more as needed */ 8 | #define WPJOB_CHECK 0 9 | #define WPJOB_NOTIFY 1 10 | #define WPJOB_OCSP 2 11 | #define WPJOB_OCHP 3 12 | #define WPJOB_GLOBAL_SVC_EVTHANDLER 4 13 | #define WPJOB_SVC_EVTHANDLER 5 14 | #define WPJOB_GLOBAL_HOST_EVTHANDLER 6 15 | #define WPJOB_HOST_EVTHANDLER 7 16 | #define WPJOB_CALLBACK 8 17 | #define WPJOB_HOST_PERFDATA 9 18 | #define WPJOB_SVC_PERFDATA 10 19 | 20 | #define WPROC_FORCE (1 << 0) 21 | 22 | NAGIOS_BEGIN_DECL 23 | 24 | typedef struct wproc_result { 25 | unsigned int job_id; 26 | unsigned int type; 27 | time_t timeout; 28 | struct timeval start; 29 | struct timeval stop; 30 | struct timeval runtime; 31 | char *command; 32 | char *outstd; 33 | char *outerr; 34 | char *error_msg; 35 | int wait_status; 36 | int error_code; 37 | int exited_ok; 38 | int early_timeout; 39 | struct kvvec *response; 40 | /* 5DEPR: rusage is deprecated for Nagios, will be removed in 5.0.0 */ 41 | struct rusage rusage; 42 | } wproc_result; 43 | 44 | extern unsigned int wproc_num_workers_spawned; 45 | extern unsigned int wproc_num_workers_online; 46 | extern unsigned int wproc_num_workers_desired; 47 | 48 | extern void wproc_reap(int jobs, int msecs); 49 | extern int wproc_can_spawn(struct load_control *lc); 50 | extern void free_worker_memory(int flags); 51 | extern int workers_alive(void); 52 | extern int get_desired_workers(int desired_workers); 53 | extern int init_workers(int desired_workers); 54 | extern int wproc_run_check(check_result *cr, char *cmd, nagios_macros *mac); 55 | extern int wproc_notify(char *cname, char *hname, char *sdesc, char *cmd, nagios_macros *mac); 56 | extern int wproc_run(int job_type, char *cmd, int timeout, nagios_macros *mac); 57 | extern int wproc_run_service_job(int jtype, int timeout, service *svc, char *cmd, nagios_macros *mac); 58 | extern int wproc_run_host_job(int jtype, int timeout, host *hst, char *cmd, nagios_macros *mac); 59 | extern int wproc_run_callback(char *cmt, int timeout, void (*cb)(struct wproc_result *, void *, int), void *data, nagios_macros *mac); 60 | 61 | NAGIOS_END_DECL 62 | #endif 63 | -------------------------------------------------------------------------------- /include/queue.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file queue.h Simple message queue for ndo2db daemon 3 | */ 4 | /* 5 | * Copyright 2012-2014 Nagios Core Development Team and Community Contributors 6 | * 7 | * This file is part of NDOUtils. 8 | * 9 | * NDOUtils is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License version 2 as 11 | * published by the Free Software Foundation. 12 | * 13 | * NDOUtils is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with NDOUtils. If not, see . 20 | */ 21 | 22 | #ifndef NDO_QUEUE_H_INCLUDED 23 | #define NDO_QUEUE_H_INCLUDED 24 | 25 | #define NDO_QUEUE_PATH "." 26 | #define NDO_QUEUE_ID 9504 27 | #define NDO_MAX_MSG_SIZE 1024 28 | #define NDO_MSG_TYPE 1 29 | 30 | struct queue_msg 31 | { 32 | long type; 33 | char text[NDO_MAX_MSG_SIZE]; 34 | }; 35 | 36 | /* remove queue from system */ 37 | void del_queue(); 38 | 39 | /* initialize new queue or open existing */ 40 | int get_queue_id(int); 41 | 42 | /* insert into queue */ 43 | void push_into_queue(char*); 44 | 45 | /* get and delete from queue */ 46 | char* pop_from_queue(); 47 | 48 | #endif /* NDO_QUEUE_H_INCLUDED */ 49 | -------------------------------------------------------------------------------- /include/utils.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file utils.h Miscellaneous common utility functions for NDO 3 | */ 4 | /* 5 | * Copyright 2009-2014 Nagios Core Development Team and Community Contributors 6 | * Copyright 2005-2009 Ethan Galstad 7 | * 8 | * This file is part of NDOUtils. 9 | * 10 | * NDOUtils is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU General Public License version 2 as 12 | * published by the Free Software Foundation. 13 | * 14 | * NDOUtils is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with NDOUtils. If not, see . 21 | */ 22 | 23 | #ifndef NDO_UTILS_H_INCLUDED 24 | #define NDO_UTILS_H_INCLUDED 25 | 26 | /* my_free has been freed from bondage as a function */ 27 | #ifdef BUILD_NAGIOS_2X 28 | #define my_free(ptr) { if(ptr) { free(ptr); ptr = NULL; } } 29 | #else 30 | #define my_free(ptr) do { if(ptr) { free(ptr); ptr = NULL; } } while(0) 31 | #endif 32 | 33 | 34 | typedef struct ndo_dbuf_struct{ 35 | char *buf; 36 | unsigned long used_size; 37 | unsigned long allocated_size; 38 | unsigned long chunk_size; 39 | }ndo_dbuf; 40 | 41 | 42 | int ndo_dbuf_init(ndo_dbuf *,int); 43 | int ndo_dbuf_free(ndo_dbuf *); 44 | int ndo_dbuf_strcat(ndo_dbuf *,char *); 45 | 46 | int my_rename(char *,char *); 47 | 48 | void ndomod_strip(char *); 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /m4/np_mysqlclient.m4: -------------------------------------------------------------------------------- 1 | # np_mysqlclient.m4 2 | dnl Copyright (C) 2007 Nagios Plugins Team 3 | dnl This file is free software; the Nagios Plugin Team 4 | dnl gives unlimited permission to copy and/or distribute it, 5 | dnl with or without modifications, as long as this notice is preserved. 6 | 7 | dnl Test for mysql availability using mysql_config 8 | dnl Uses --with-mysql= yes(autodetection - default) | no | path 9 | dnl Sets 4 variables: 10 | dnl with_mysql = path/to/mysql_config (if found and can compile mysqlclient) or "no" 11 | dnl np_mysql_include = flags for include, from mysql_config --include (will be guessed as $with_mysql/include if --include not found) 12 | dnl np_mysql_libs = flags for libs, from mysql_config --libs 13 | dnl np_mysql_cflags = flags for cflags, from mysql_config --cflags 14 | dnl Also sets in config.h: 15 | dnl HAVE_MYSQLCLIENT 16 | dnl Copile your code with: 17 | dnl $(CC) $(np_mysql_include) code.c $(np_mysql_libs) 18 | 19 | AC_DEFUN([np_mysqlclient], 20 | [ 21 | AC_ARG_WITH(mysql, 22 | AS_HELP_STRING([--with-mysql=DIR], 23 | [Locates mysql libraries. Expects DIR/bin/mysql_config. Default to search for mysql_config in PATH]), 24 | with_mysql=$withval, 25 | with_mysql=yes) 26 | 27 | if test "x$with_mysql" != "xno" ; then 28 | if test "x$with_mysql" = "xyes" ; then 29 | AC_PATH_PROG(np_mysql_config, mysql_config) 30 | else 31 | if test -x $with_mysql/bin/mysql_config ; then 32 | np_mysql_config="$with_mysql/bin/mysql_config" 33 | fi 34 | fi 35 | if test -z "$np_mysql_config"; then 36 | with_mysql="no" 37 | else 38 | np_mysql_include="`$np_mysql_config --include`" 39 | # Mysql 3 does not support --include. --cflags should be sufficient 40 | if test $? -ne 0; then 41 | np_mysql_include="-I$with_mysql/include" # Guessed location 42 | fi 43 | np_mysql_libs="`$np_mysql_config --libs`" 44 | np_mysql_cflags="`$np_mysql_config --cflags`" 45 | 46 | dnl Test a mysql_init. Some systems have mysql_config, but no headers 47 | _savedcppflags="$CPPFLAGS" 48 | CPPFLAGS="$CPPFLAGS $np_mysql_include" 49 | 50 | dnl Putting $np_mysql_libs as other libraries ensures that all mysql dependencies are linked in 51 | dnl Although -lmysqlclient is duplicated, it is not a problem 52 | AC_CHECK_LIB([mysqlclient], [mysql_init], [ 53 | with_mysql=$np_mysql_config 54 | AC_DEFINE(HAVE_MYSQLCLIENT, 1, [Defined if mysqlclient is found and can compile]) 55 | ], [with_mysql=no], [$np_mysql_libs]) 56 | CPPFLAGS=$_savedcppflags 57 | 58 | fi 59 | fi 60 | ]) 61 | 62 | dnl Will take $1, find last occurrence of -LDIR and add DIR to LD_RUN_PATH 63 | AC_DEFUN([np_add_to_runpath], 64 | [ 65 | dnl Need [[ ]] so autoconf gives us just one set 66 | np_libdir=`echo "$1" | sed -e 's/.*-L\([[^ ]]*\) .*/\1/'` 67 | if test "x$np_libdir" != x ; then 68 | LD_RUN_PATH="${np_libdir}${LD_RUN_PATH:+:}${LD_RUN_PATH}" 69 | fi 70 | ]) 71 | 72 | -------------------------------------------------------------------------------- /macros/.gitignore: -------------------------------------------------------------------------------- 1 | nbproject/ 2 | -------------------------------------------------------------------------------- /macros/ax_nagios_get_os: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # SYNOPSIS 3 | # 4 | # AX_NAGIOS_GET_OS 5 | # 6 | # DESCRIPTION 7 | # 8 | # This macro determines the operating system of the computer it is run on. 9 | # 10 | # LICENSE 11 | # 12 | # Copyright (c) 2016 Nagios Core Development Team 13 | # 14 | # This program is free software; you can redistribute it and/or modify it 15 | # under the terms of the GNU General Public License as published by the 16 | # Free Software Foundation; either version 2 of the License, or (at your 17 | # option) any later version. 18 | # 19 | # This program is distributed in the hope that it will be useful, but 20 | # WITHOUT ANY WARRANTY; without even the implied warranty of 21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 22 | # Public License for more details. 23 | # 24 | # You should have received a copy of the GNU General Public License along 25 | # with this program. If not, see . 26 | # 27 | # As a special exception, the respective Autoconf Macro's copyright owner 28 | # gives unlimited permission to copy, distribute and modify the configure 29 | # scripts that are the output of Autoconf when processing the Macro. You 30 | # need not follow the terms of the GNU General Public License when using 31 | # or distributing such scripts, even though portions of the text of the 32 | # Macro appear in them. The GNU General Public License (GPL) does govern 33 | # all other use of the material that constitutes the Autoconf Macro. 34 | # 35 | # This special exception to the GPL applies to versions of the Autoconf 36 | # Macro released by the Autoconf Archive. When you make and distribute a 37 | # modified version of the Autoconf Macro, you may extend this special 38 | # exception to the GPL to apply to your modified version as well. 39 | # =========================================================================== 40 | 41 | AU_ALIAS([AC_NAGIOS_GET_OS], [AX_NAGIOS_GET_OS]) 42 | AC_DEFUN([AX_NAGIOS_GET_OS], 43 | [ 44 | 45 | AC_SUBST(opsys) 46 | AC_SUBST(arch) 47 | 48 | # 49 | # Get user hints 50 | # 51 | AC_MSG_CHECKING(what the operating system is ) 52 | AC_ARG_WITH(opsys, AC_HELP_STRING([--with-opsys=OS], 53 | [specify operating system (linux, osx, bsd, solaris, irix, cygwin, 54 | aix, hp-ux, etc.)]), 55 | [ 56 | # 57 | # Run this if --with was specified 58 | # 59 | if test "x$withval" = x -o x$withval = xno; then 60 | opsys_wanted=yes 61 | else 62 | opsys_wanted=no 63 | opsys="$withval" 64 | AC_MSG_RESULT($opsys) 65 | fi 66 | ], [ 67 | # 68 | # Run this if --with was not specified 69 | # 70 | opsys_wanted=yes 71 | ]) 72 | 73 | if test x$opsys = xno; then 74 | opsys="" 75 | opsys_wanted=yes 76 | elif test x$opsys = xyes; then 77 | AC_MSG_ERROR([you must enter an O/S type if '--with-opsys' is specified]) 78 | fi 79 | 80 | # 81 | # Determine operating system if it wasn't supplied 82 | # 83 | if test $opsys_wanted=yes; then 84 | opsys=`uname -s | tr ["[A-Z]" "[a-z]"]` 85 | if test x"$opsys" = "x"; then opsys="unknown"; fi 86 | AS_CASE([$opsys], 87 | [darwin*], opsys="osx", 88 | [*bsd*], opsys="bsd", 89 | [dragonfly], opsys="bsd", 90 | [sunos], opsys="solaris", 91 | [gnu/hurd], opsys="linux", 92 | [irix*], opsys="irix", 93 | [cygwin*], opsys="cygwin", 94 | [mingw*], opsys="mingw", 95 | [msys*], opsys="msys") 96 | fi 97 | 98 | arch=`uname -m | tr ["[A-Z]" "[a-z]"]` 99 | 100 | AC_MSG_RESULT($opsys) 101 | ]) 102 | -------------------------------------------------------------------------------- /make-tarball: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | if [ "x$1" = "x" ] 3 | then 4 | echo "Usage: $0 " 5 | exit 1 6 | fi 7 | 8 | if test -e Makefile; then 9 | make distclean 10 | fi 11 | autoconf 12 | 13 | # Update version number and modification date in code 14 | ./update-version $1 15 | 16 | PWDSAVE=`pwd` 17 | PACKAGE=ndoutils 18 | pushd .. 19 | if [ ! -d $PACKAGE-$1 ]; then 20 | ln -s `basename $PWDSAVE` $PACKAGE-$1 21 | fi 22 | tar zhcvf $PACKAGE-$1.tar.gz --exclude RCS --exclude CVS --exclude ".git" --exclude autom4te.cache --exclude build-* --exclude *~ --exclude .\#* $PACKAGE-$1 23 | #rm $PACKAGE-$1 24 | popd 25 | 26 | -------------------------------------------------------------------------------- /src/protonum.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | int main(int argc, char **argv){ 7 | int fd=STDIN_FILENO; 8 | FILE *fp; 9 | int x=0; 10 | char temp_buffer[1024]; 11 | char *ptr1=NULL; 12 | char *ptr2=NULL; 13 | 14 | 15 | if(argc<2) 16 | exit(1); 17 | 18 | x=atoi(argv[1]); 19 | 20 | fp=fdopen(fd,"r"); 21 | while(fgets(temp_buffer,sizeof(temp_buffer),fp)){ 22 | 23 | ptr1=strtok(temp_buffer," "); 24 | ptr2=strtok(NULL," "); 25 | 26 | printf("%s %-44s %d\n",(ptr1==NULL)?"NULL":ptr1,(ptr2==NULL)?"NULL":ptr2,x); 27 | 28 | x++; 29 | } 30 | 31 | 32 | exit(1); 33 | } 34 | -------------------------------------------------------------------------------- /startup/bsd-init.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Start/stop/restart/reload ndo2db 4 | # Copyright (c) 2016 Nagios(R) Core(TM) Development Team 5 | 6 | BSDTYPE=@dist_type@ 7 | 8 | NDO2DB_BIN=@sbindir@/ndo2db 9 | NDO2DB_CFG=@pkgsysconfdir@/ndo2db.cfg 10 | PID_DIR=@piddir@ 11 | PID_FILE=@piddir@/ndo2db.pid 12 | 13 | # Get PID of running process 14 | ndo2db_get_pid() { 15 | if [ -r "$PID_FILE" ]; then 16 | pid1=$(cat "$PID_FILE") 17 | else 18 | pid1="" 19 | fi 20 | pid2=$(ps -A -o pid,command | grep ndo2db | grep -v grep | tr -s ' ' | sed -e 's/^ //' | cut -d' ' -f1) 21 | 22 | if [ $pid1 = $pid2 ]; then 23 | echo $pid1 24 | else 25 | echo $pid1 $pid2 26 | fi 27 | } 28 | 29 | # Start ndo2db 30 | ndo2db_start() { 31 | printf "Starting ndo2db daemon: $NDO2DB_BIN - " 32 | if [ ! -d "$PID_DIR" ]; then 33 | mkdir -p "$PID_DIR" 34 | fi 35 | $NDO2DB_BIN -c $NDO2DB_CFG 36 | if [ $? = 0 ]; then 37 | echo "started" 38 | else 39 | echo "failed" 40 | fi 41 | } 42 | 43 | # Stop ndo2db 44 | ndo2db_stop() { 45 | printf "Stopping ndo2db daemon - " 46 | pid=`ndo2db_get_pid` 47 | if [ -n "$pid" ]; then 48 | kill $(cat "$PID_FILE") 49 | if [ $? = 0 ]; then 50 | echo "stopped" 51 | else 52 | echo "failed" 53 | fi 54 | else 55 | echo "Does not appear to be running" 56 | fi 57 | } 58 | 59 | # Restart ndo2db 60 | ndo2db_restart() { 61 | ndo2db_stop 62 | sleep 1 63 | ndo2db_start 64 | } 65 | 66 | # ndo2db status 67 | ndo2db_status() { 68 | pid=`ndo2db_get_pid` 69 | if [ -n "$pid" ]; then 70 | if [ $BSDTYPE = aix ]; then 71 | echo "ndo2db is running ($pid)" 72 | elif ps -C ndo2db >/dev/null; then 73 | echo "ndo2db is running ($pid)" 74 | else 75 | echo "ndo2db is stopped." 76 | fi 77 | else 78 | echo "ndo2db is stopped." 79 | fi 80 | } 81 | 82 | case "$1" in 83 | 'start') 84 | ndo2db_start 85 | ;; 86 | 'stop') 87 | ndo2db_stop 88 | ;; 89 | 'restart') 90 | ndo2db_restart 91 | ;; 92 | 'status') 93 | ndo2db_status 94 | ;; 95 | *) 96 | echo "Usage $0 start|stop|restart|status" 97 | ;; 98 | esac 99 | -------------------------------------------------------------------------------- /startup/debian-init.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright (c) 2016 Nagios(R) Core(TM) Development Team 4 | # 5 | # Start/stop the ndo2db daemon. 6 | 7 | NDO2DB_BIN=@sbindir@/ndo2db 8 | NDO2DB_CFG=@pkgsysconfdir@/ndo2db.cfg 9 | PID_FILE=@piddir@/ndo2db.pid 10 | 11 | test -x $NDO2DB_BIN || exit 0 12 | 13 | case "$1" in 14 | 15 | start) 16 | echo -n "Starting nagios remote plugin daemon: ndo2db" 17 | start-stop-daemon --start --quiet --pidfile $PID_FILE --exec $NDO2DB_BIN -- -c $NDO2DB_CFG -d 18 | echo "." 19 | ;; 20 | 21 | stop) 22 | echo -n "Stopping nagios remote plugin daemon: ndo2db" 23 | start-stop-daemon --stop --quiet --pidfile $PID_FILE --exec $NDO2DB_BIN 24 | echo "." 25 | ;; 26 | 27 | restart|force-reload) 28 | echo -n "Restarting nagios remote plugin daemon: ndo2db" 29 | start-stop-daemon --stop --quiet --pidfile $PID_FILE --exec $NDO2DB_BIN 30 | start-stop-daemon --start --quiet --pidfile $PID_FILE --exec $NDO2DB_BIN -- -c $NDO2DB_CFG -d 31 | echo "." 32 | ;; 33 | 34 | reload) 35 | echo -n "Reloading configuration files for nagios remote plugin daemon: ndo2db" 36 | test -f $PID_FILE || exit 0 37 | test -x /bin/kill && /bin/kill -HUP `cat $PID_FILE` 38 | echo "." 39 | ;; 40 | 41 | *) 42 | echo "Usage: $0 start|stop|restart|reload|force-reload" 43 | exit 1 44 | ;; 45 | esac 46 | 47 | exit 0 48 | -------------------------------------------------------------------------------- /startup/default-inetd.in: -------------------------------------------------------------------------------- 1 | # 2 | # Enable the following entry to enable the ndo2db daemon 3 | #ndo2db stream tcp nowait @ndo2db_user@ @sbindir@/ndo2db ndo2db -c @pkgsysconfdir@/ndo2db.cfg -i 4 | # Enable the following entry if the ndo2db daemon didn't link with libwrap 5 | #ndo2db stream tcp nowait @ndo2db_user@ /usr/sbin/tcpd @sbindir@/ndo2db -c @pkgsysconfdir@/ndo2db.cfg -i 6 | -------------------------------------------------------------------------------- /startup/default-init.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright (c) 2016 Nagios(R) Core(TM) Development Team 4 | # 5 | # chkconfig: - 80 30 6 | # description: Starts and stops the Nagios Data Out Daemon \ 7 | # to store data in a database 8 | 9 | # 10 | ### BEGIN INIT INFO 11 | # Provides: ndo2db 12 | # Required-Start: $local_fs $remote_fs $time 13 | # Required-Stop: $local_fs $remote_fs 14 | # Should-Start: $syslog $network 15 | # Should-Stop: $syslog $network 16 | # Default-Start: 2 3 4 5 17 | # Default-Stop: 0 1 6 18 | # Short-Description: Starts and stops the Nagios Data Out Daemon 19 | # Description: Starts and stops the Nagios Data Out Daemon 20 | # to store data in a database 21 | ### END INIT INFO 22 | 23 | export SYSTEMCTL_SKIP_REDIRECT=1 24 | 25 | NDO2DB_BIN=@sbindir@/ndo2db 26 | NDO2DB_CFG=@pkgsysconfdir@/ndo2db.cfg 27 | LOCK_DIR=@subsyslockdir@ 28 | LOCK_FILE=@subsyslockfile@ 29 | PID_FILE=@piddir@/ndo2db.pid 30 | 31 | test -x $NDO2DB_BIN || exit 5 32 | 33 | RETVAL=0 34 | 35 | # Default these commands/functions to RedHat/CentOS etc. values 36 | MSG_CMD="echo -n" 37 | START_CMD="daemon --pidfile $PID_FILE" 38 | TERM_CMD="killproc -p $PID_FILE $NDO2DB_BIN -TERM" 39 | HUP_CMD="killproc -p $PID_FILE $NDO2DB_BIN -HUP" 40 | PRT_STAT="echo" 41 | STAT_MSG="echo -n Checking for ndo2db daemon... " 42 | STAT_CMD="status ndo2db" 43 | EXIT_CMD="exit" 44 | 45 | _set_rc (){ return; } 46 | 47 | # Source the function library 48 | if [ -f /etc/rc.status ]; then 49 | 50 | . /etc/rc.status 51 | 52 | _set_rc (){ return $RETVAL; } 53 | 54 | # Set these commands/functions to SuSE etc. values 55 | START_CMD="startproc -p $PID_FILE" 56 | TERM_CMD="killproc -p $PID_FILE -TERM $NDO2DB_BIN" 57 | HUP_CMD="killproc -p $PID_FILE -HUP $NDO2DB_BIN" 58 | PRT_STAT="rc_status -v -r" 59 | STAT_CMD="checkproc -p $PID_FILE $NDO2DB_BIN" 60 | EXIT_CMD="rc_exit" 61 | rc_reset 62 | 63 | elif [ -f /etc/rc.d/init.d/functions ]; then 64 | 65 | . /etc/rc.d/init.d/functions 66 | 67 | elif [ -f /etc/init.d/functions ]; then 68 | 69 | . /etc/init.d/functions 70 | 71 | elif [ -f /lib/lsb/init-functions ]; then 72 | 73 | . /lib/lsb/init-functions 74 | 75 | MSG_CMD="log_daemon_msg" 76 | START_CMD="start_daemon -p $PID_FILE" 77 | PRT_STAT="log_end_msg" 78 | STAT_MSG= 79 | STAT_CMD="status_of_proc -p $PID_FILE $NDO2DB_BIN ndo2db" 80 | 81 | elif [ -f /etc/rc.d/functions ]; then 82 | 83 | . /etc/rc.d/functions 84 | 85 | fi 86 | 87 | 88 | # See how we were called. 89 | case "$1" in 90 | 91 | start) 92 | # Start daemons. 93 | $MSG_CMD "Starting ndo2db " 94 | $START_CMD $NDO2DB_BIN -c $NDO2DB_CFG 95 | RETVAL=$? 96 | if test "$PRT_STAT" = log_end_msg; then 97 | $PRT_STAT $RETVAL 98 | else 99 | _set_rc; $PRT_STAT 100 | fi 101 | if [ $RETVAL = 0 ]; then 102 | [ -d $LOCK_DIR ] && touch $LOCK_FILE || true 103 | fi 104 | ;; 105 | 106 | stop) 107 | # Stop daemons. 108 | $MSG_CMD "Shutting down ndo2db " 109 | $TERM_CMD 110 | RETVAL=$? 111 | if test "$PRT_STAT" = log_end_msg; then 112 | $PRT_STAT $RETVAL 113 | else 114 | _set_rc; $PRT_STAT 115 | fi 116 | if [ $RETVAL = 0 ]; then 117 | [ -d $LOCK_DIR ] && rm -f $LOCK_FILE 118 | fi 119 | ;; 120 | 121 | restart|force-reload) 122 | $0 stop 123 | $0 start 124 | RETVAL=$? 125 | ;; 126 | 127 | try-restart|condrestart) 128 | $STAT_CMD || exit 0 129 | $0 stop 130 | $0 start 131 | RETVAL=$? 132 | ;; 133 | 134 | status) 135 | $STAT_MSG 136 | $STAT_CMD 137 | RETVAL=$? 138 | if test "$PRT_STAT" != log_end_msg; then 139 | _set_rc; $PRT_STAT 140 | fi 141 | ;; 142 | 143 | *) 144 | echo "Usage: ndo2db {start|stop|restart|try-restart|condrestart|status}" 145 | exit 1 146 | esac 147 | 148 | $EXIT_CMD $RETVAL 149 | -------------------------------------------------------------------------------- /startup/default-service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Nagios Data Out Daemon 3 | Documentation=http://www.nagios.org/documentation 4 | After=var-run.mount nss-lookup.target network.target local-fs.target time-sync.target 5 | Before=getty@tty1.service plymouth-quit.service xdm.service 6 | Conflicts=ndo2db.socket 7 | 8 | [Install] 9 | WantedBy=multi-user.target 10 | 11 | [Service] 12 | Type=simple 13 | Restart=on-abort 14 | PIDFile=@piddir@/ndo2db.pid 15 | RuntimeDirectory=ndo2db 16 | RuntimeDirectoryMode=0755 17 | ExecStart=@sbindir@/ndo2db -c @pkgsysconfdir@/ndo2db.cfg -f 18 | ExecStopPost=/bin/rm -f @piddir@/ndo2db.pid 19 | TimeoutStopSec=60 20 | User=@ndo2db_user@ 21 | Group=@ndo2db_group@ 22 | PrivateTmp=true 23 | OOMScoreAdjust=-500 24 | -------------------------------------------------------------------------------- /startup/default-socket-svc.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Nagios Data Out Daemon 3 | Documentation=http://www.nagios.org/documentation 4 | After=var-run.mount nss-lookup.target network.target local-fs.target time-sync.target 5 | 6 | [Service] 7 | Restart=on-failure 8 | ExecStart=@sbindir@/ndo2db -c @pkgsysconfdir@/ndo2db.cfg -i 9 | KillMode=process 10 | User=@ndo2db_user@ 11 | Group=@ndo2db_group@ 12 | PrivateTmp=true 13 | OOMScoreAdjust=-500 14 | 15 | [Install] 16 | WantedBy=multi-user.target 17 | -------------------------------------------------------------------------------- /startup/default-socket.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Nagios Data Out Daemon 3 | Documentation=http://www.nagios.org/documentation 4 | Before=ndo2db.service 5 | Conflicts=ndo2db.service 6 | 7 | [Socket] 8 | ListenStream=@ndo2db_port@ 9 | Accept=yes 10 | 11 | [Install] 12 | WantedBy=sockets.target 13 | -------------------------------------------------------------------------------- /startup/default-xinetd.in: -------------------------------------------------------------------------------- 1 | # default: off 2 | # description: NDO2DB (Nagios Data Out Daemon) 3 | service ndo2db 4 | { 5 | disable = yes 6 | socket_type = stream 7 | port = @ndo2db_port@ 8 | wait = no 9 | user = @ndo2db_user@ 10 | group = @ndo2db_group@ 11 | server = @sbindir@/ndo2db 12 | server_args = -c @pkgsysconfdir@/ndo2db.cfg -i 13 | only_from = 127.0.0.1 14 | log_on_failure += USERID 15 | } 16 | -------------------------------------------------------------------------------- /startup/mac-inetd.plist.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Label 6 | org.nagios.ndo2db 7 | UserName 8 | @ndo2db_user@ 9 | GroupName 10 | @ndo2db_group@ 11 | Program 12 | @sbindir@/ndo2db 13 | ProgramArguments 14 | 15 | ndo2db 16 | -c 17 | @pkgsysconfdir@/ndo2db.cfg 18 | -i 19 | 20 | Sockets 21 | 22 | Listeners 23 | 24 | SockServiceName 25 | @ndo2db_port@ 26 | SockType 27 | stream 28 | SockFamily 29 | IPv4 30 | 31 | 32 | inetdCompatibility 33 | 34 | Wait 35 | 36 | 37 | ProcessType 38 | Background 39 | 40 | 41 | -------------------------------------------------------------------------------- /startup/mac-init.plist.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Label 6 | org.nagios.ndo2db 7 | UserName 8 | @ndo2db_user@ 9 | GroupName 10 | @ndo2db_group@ 11 | Program 12 | @sbindir@/ndo2db 13 | ProgramArguments 14 | 15 | ndo2db 16 | -c 17 | @pkgsysconfdir@/ndo2db.cfg 18 | -f 19 | 20 | KeepAlive 21 | 22 | SuccessfulExit 23 | 24 | NetworkState 25 | 26 | 27 | RunAtLoad 28 | 29 | ProcessType 30 | Background 31 | 32 | 33 | -------------------------------------------------------------------------------- /startup/newbsd-init.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright (c) 2016 Nagios(R) Core(TM) Development Team 4 | # 5 | # PROVIDE: ndo2db 6 | # REQUIRE: DAEMON 7 | # KEYWORD: shutdown 8 | 9 | . /etc/rc.subr 10 | 11 | : ${ndo2db@bsd_enable@:="NO"} 12 | : ${ndo2db_configfile:="@pkgsysconfdir@/ndo2db.cfg"} 13 | 14 | name=ndo2db 15 | command="@sbindir@/ndo2db" 16 | command_args="-c $ndo2db_configfile" 17 | pidfile="@piddir@/ndo2db.pid" 18 | extra_commands=reload 19 | sig_reload=HUP 20 | rcvar=ndo2db@bsd_enable@ 21 | load_rc_config "$name" 22 | required_files="$ndo2db_configfile" 23 | sig_reload=HUP 24 | 25 | start_precmd=ndo2db_prestart 26 | 27 | ndo2db_prestart() 28 | { 29 | [ -n "$ndo2db_pidfile" ] && 30 | warn "No longer necessary to set ndo2db_pidfile in rc.conf[.local]" 31 | 32 | install -d -o @ndo2db_user@ ${pidfile%/*} 33 | } 34 | 35 | run_rc_command "$1" 36 | -------------------------------------------------------------------------------- /startup/openbsd-init.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright (c) 2016 Nagios(R) Core(TM) Development Team 4 | # 5 | 6 | daemon="@sbindir@/ndo2db" 7 | 8 | . /etc/rc.d/rc.subr 9 | 10 | rc_pre() { 11 | install -d -o @ndo2db_user@ ${pidfile%/*} 12 | } 13 | 14 | rc_reload() { 15 | pkill -HUP -xf "${pexp}" 16 | } 17 | 18 | rc_cmd "$1" 19 | -------------------------------------------------------------------------------- /startup/openrc-conf.in: -------------------------------------------------------------------------------- 1 | # The configuration file to use for ndo2db. 2 | NDO2DB_CFG="@sysconfdir@/ndo2db.cfg" 3 | -------------------------------------------------------------------------------- /startup/openrc-init.in: -------------------------------------------------------------------------------- 1 | #!/sbin/openrc-run 2 | # 3 | # Copyright (c) 2017 Nagios(R) Core(TM) Development Team 4 | # 5 | 6 | command="@sbindir@/ndo2db" 7 | command_args="-c ${NDO2DB_CFG}" 8 | description="Nagios Data Out daemon" 9 | pidfile="@piddir@/ndo2db.pid" 10 | 11 | depend() { 12 | # The Nagios core daemon creates the socket that ndo2db tries to 13 | # connect to upon starting. 14 | need mysql nagios 15 | } 16 | -------------------------------------------------------------------------------- /startup/rh-upstart-init.in: -------------------------------------------------------------------------------- 1 | # ndo2db - the Nagios Data Out Daemon 2 | # 3 | # ndo2db is a program that adds nagios related 4 | # records to a database 5 | # 6 | # Copyright (c) 2016 Nagios(R) Core(TM) Development Team 7 | 8 | description "the Nagios Data Out Daemon" 9 | 10 | oom -10 11 | 12 | start on started network 13 | stop on runlevel [!2345] 14 | 15 | respawn 16 | 17 | exec @sbindir@/ndo2db -c @pkgsysconfdir@/ndo2db.cfg -f 18 | -------------------------------------------------------------------------------- /startup/solaris-inetd.xml.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 14 | 15 | 16 | 17 | 18 | 19 | 23 | 25 | 26 | 27 | 32 | 33 | 34 | 35 | 36 | 37 | 42 | 43 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 62 | 65 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /startup/solaris-init.xml.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 14 | 15 | 16 | 17 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 38 | 39 | 40 | 41 | 46 | 47 | 48 | 49 | 54 | 55 | 56 | 57 | 62 | 63 | 64 | 65 | 70 | 72 | 73 | 74 | 79 | 80 | 81 | 82 | 86 | 87 | 88 | 89 | 94 | 95 | 96 | 97 | 98 | 99 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 113 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 134 | 135 | 136 | 137 | 138 | -------------------------------------------------------------------------------- /startup/tmpfile.conf.in: -------------------------------------------------------------------------------- 1 | #Type Path Mode UID GID Age Argument 2 | d @piddir@ 0755 @ndo2db_user@ @ndo2db_group@ - - 3 | -------------------------------------------------------------------------------- /startup/upstart-init.in: -------------------------------------------------------------------------------- 1 | # ndo2db - the Nagios Remote Plugin Executor 2 | # 3 | # ndo2db is a program that runs plugins on this host 4 | # and reports the results back to a nagios server 5 | # 6 | # Copyright (c) 2016 Nagios(R) Core(TM) Development Team 7 | 8 | description "the Nagios Remote Plugin Executor" 9 | 10 | oom score -800 11 | setgid @ndo2db_group@ 12 | setuid @ndo2db_user@ 13 | 14 | start on (local-filesystems and net-device-up IFACE!=lo) 15 | stop on runlevel [!2345] 16 | 17 | respawn 18 | 19 | exec @sbindir@/ndo2db -c @pkgsysconfdir@/ndo2db.cfg -f 20 | -------------------------------------------------------------------------------- /update-version: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Get date (two formats) 4 | if [ -n "$2" ]; then 5 | LONGDATE=`date -d "$2" "+%B %d, %Y"` 6 | SHORTDATE=`date -d "$2" "+%Y-%m-%d"` 7 | else 8 | LONGDATE=`date "+%B %d, %Y"` 9 | SHORTDATE=`date "+%Y-%m-%d"` 10 | fi 11 | 12 | # Current version number 13 | CURRENTVERSION=2.1.5 14 | 15 | # Last date 16 | LASTDATE=2025-03-11 17 | 18 | if [ "x$1" = "x" ] 19 | then 20 | echo "Usage: $0 [revision date]" 21 | echo "" 22 | echo "Run this script with the name of the new version (i.e \"1.4\") to" 23 | echo "update version number and modification date in files." 24 | echo "Use the \"newdate\" argument if you want to keep the current version" 25 | echo "number and just update the modification date." 26 | echo "" 27 | echo "Current version=$CURRENTVERSION" 28 | echo "Current Modification date=$LASTDATE" 29 | echo "" 30 | exit 1 31 | fi 32 | 33 | newversion=$1 34 | if [ "x$newversion" = "xnewdate" ] 35 | then 36 | newversion=$CURRENTVERSION 37 | fi 38 | 39 | # Update version number and release date in source code 40 | perl -i -p -e "s/NDOMOD_VERSION \"[0-9].*\"/NDOMOD_VERSION \"$newversion\"/;" src/ndomod.c 41 | perl -i -p -e "s/NDOMOD_DATE \"[0-9].*\"/NDOMOD_DATE \"$SHORTDATE\"/;" src/ndomod.c 42 | perl -i -p -e "s/Last Modified: [0-9].*/Last Modified: $SHORTDATE/;" src/ndomod.c 43 | 44 | perl -i -p -e "s/NDO2DB_VERSION \"[0-9].*\"/NDO2DB_VERSION \"$newversion\"/;" src/ndo2db.c 45 | perl -i -p -e "s/NDO2DB_DATE \"[0-9].*\"/NDO2DB_DATE \"$SHORTDATE\"/;" src/ndo2db.c 46 | perl -i -p -e "s/Last Modified: [0-9].*/Last Modified: $SHORTDATE/;" src/ndo2db.c 47 | 48 | perl -i -p -e "s/LOG2NDO_VERSION \"[0-9].*\"/LOG2NDO_VERSION \"$newversion\"/;" src/log2ndo.c 49 | perl -i -p -e "s/LOG2NDO_DATE \"[0-9].*\"/LOG2NDO_DATE \"$SHORTDATE\"/;" src/log2ndo.c 50 | perl -i -p -e "s/Last Modified: [0-9].*/Last Modified: $SHORTDATE/;" src/log2ndo.c 51 | 52 | perl -i -p -e "s/FILE2SOCK_VERSION \"[0-9].*\"/FILE2SOCK_VERSION \"$newversion\"/;" src/file2sock.c 53 | perl -i -p -e "s/FILE2SOCK_DATE \"[0-9].*\"/FILE2SOCK_DATE \"$SHORTDATE\"/;" src/file2sock.c 54 | perl -i -p -e "s/Last Modified: [0-9].*/Last Modified: $SHORTDATE/;" src/file2sock.c 55 | 56 | perl -i -p -e "s/SOCKDEBUG_VERSION \"[0-9].*\"/SOCKDEBUG_VERSION \"$newversion\"/;" src/sockdebug.c 57 | perl -i -p -e "s/SOCKDEBUG_DATE \"[0-9].*\"/SOCKDEBUG_DATE \"$SHORTDATE\"/;" src/sockdebug.c 58 | perl -i -p -e "s/Last Modified: [0-9].*/Last Modified: $SHORTDATE/;" src/sockdebug.c 59 | 60 | # Update version number and release date in configure script and configure.ac 61 | perl -i -p -e "s/PKG_VERSION=.*/PKG_VERSION=\"$newversion\"/;" configure 62 | perl -i -p -e "s/PKG_REL_DATE=.*\"/PKG_REL_DATE=\"$SHORTDATE\"/;" configure 63 | perl -i -p -e "s/PKG_VERSION=.*/PKG_VERSION=\"$newversion\"/;" configure.ac 64 | perl -i -p -e "s/PKG_REL_DATE=.*\"/PKG_REL_DATE=\"$SHORTDATE\"/;" configure.ac 65 | 66 | # Update this file with version number and last date 67 | perl -i -p -e "s/^CURRENTVERSION=.*/CURRENTVERSION=$newversion/;" update-version 68 | perl -i -p -e "s/^LASTDATE=.*/LASTDATE=$SHORTDATE/;" update-version 69 | 70 | --------------------------------------------------------------------------------