Git Product home page Git Product logo

nook24 / statusengine Goto Github PK

View Code? Open in Web Editor NEW
16.0 6.0 8.0 4.26 MB

New PHP based MySQL Backend for Naemon and Nagios 4 + responsive web frontend

Home Page: https://statusengine.org/

License: GNU General Public License v2.0

Makefile 0.06% PHP 86.53% Shell 0.17% CSS 0.31% JavaScript 0.50% C 12.01% Batchfile 0.02% C++ 0.04% Objective-C 0.34% TSQL 0.01%
monitoring database nagios naemon workers

statusengine's Introduction

Statusengine 2 (Old Stable)

This Version of Statusengine is marked as old stable. You can still use it, but take a look at Version 3 or the FAQ.

Visit the project page for more information.

Statusengine - the missing event broker

Statusengine is a drop in replacement for NDOutils and it is able to use the same database schema. Statusengine uses gearmand as Queueing engine, so your MySQL database will not slow down the Nagios/Naemon core.

Additionally Statusengine is worker based. If your system grows and you need to process more data, you can simply increase the number of worker processes.

To make your data visible Statusengine comes with a responsive web interface which allows you to submit commands and provides a nice way to process the data with external scripts by quering the HTTP API and append the url with .json or .xml extension.

Statusengine is modular, so you can use just the parts you need!

Visit the project page for more information.

Features

  • Worker based Nagios/Naemon event data processor
  • Based on MySQL
  • Json based communication
  • Automatic database schema updates
  • Responsive Web Interface
  • Processing of performance data (RRDTool and Graphite)
  • Full UTF-8 support
  • In memory engine
  • Modular
  • Tested on PHP5 and PHP7!

Requirements

  • Nagios 4 or Naemon
  • MySQL server
  • PHP 5.4 or greater
  • Ubuntu 14.04 LTS

Looking for other Ubuntu or Debian version?Take a look at the supported operating systems for more information.

Installation

Check the documentation for the installation guide

  1. Clone repository
chmod +x install.sh
./install.sh
  1. Set your username and password of MySQL server in /opt/statusengine/cakephp/app/Config/database.php
        public $legacy = array(
                'datasource' => 'Database/Mysql',
                'persistent' => false,
                'host' => 'localhost',
                'login' => 'naemon',
                'password' => '12345',
                'database' => 'naemon',
                'prefix' => 'naemon_',
                'encoding' => 'utf8',
        );
  1. Create database (using CakePHP shell) MyISAM
/opt/statusengine/cakephp/app/Console/cake schema update --plugin Legacy --file legacy_schema.php --connection legacy

or:

  1. Create database InnoDB (Recommended!)
/opt/statusengine/cakephp/app/Console/cake schema update --plugin Legacy --file legacy_schema_innodb.php --connection legacy
  1. Change path to your nagios.cfg / naemon.cfg in /opt/statusengine/cakephp/app/Config/Statusengine.php if different on your system
'coreconfig' => '/etc/naemon/naemon.cfg',
  1. Start Statusengine in legacy mode (forground):
/opt/statusengine/cakephp/app/Console/cake statusengine_legacy -w

or

  1. Start Statusengine in legacy mode (background):
service statusengine start

Check the documentation for the migration guide

Tested with

  • Naemon 0.8.0
  • Naemon 1.0.3
  • Naemon master (development)
  • Nagios 4.0.8
  • Nagios 4.1.1
  • mod_gearman
  • NagVis
  • MySQL
  • MariaDB
  • PHP5
  • PHP7
  • PHP7.2

Changelog

2.2.2

  • Try to convert non UTF-8 characters into UTF-8

2.2.2

  • Set output length to 1024 and 2048 for performance data
  • Add CDATA section to XML file for pnp4nagios

2.2.0

  • Restart dead childs in case of database errors #44
  • Fix restart through systemd
  • Thanks to dhoffend

2.1.5

  • Remove bulk insert debug messages
  • Fix a bug where downtimes got reset on nagios/naemon restart in downtimehistory table
  • Downtimes with start time in future get now be delete gracefully

2.1.4 Update CakePHP to Version 2.10.9 for better PHP7.2 compatibility

2.1.3

  • Resolve missing notifications in database - again
  • The queues statusngin_notifications and statusngin_contactnotificationdata are no longer in use by StatusengineLegacyShell.
  • All data is parsed out of statusngin_contactnotificationmethod

2.1.2

  • Resolve missing notifications in database

2.1.1

  • Resolve Gab in servicestatus_id due to MySQL behavior #40

2.1.0

  • Add method for bulk insert - Many thanks to dhoffend
  • Add broker option gearman_server_addr - Many thanks to mjameswh
  • Fixed typos in Statusengine Web Interface - Many thanks to BlangTech
  • Update Makefile

2.0.5

  • Fix parsing of negative performance data

2.0.4

  • Add broker option enable_ochp
  • Add broker option enable_ocsp
  • Add broker option use_object_data
  • Fix that objects will be dumped if use_process_data=0 and use_object_data=1

2.0.3

  • Add index for object_id in history tables

2.0.2

  • Fix buildProcessPerfdataCache on low loaded systems

2.0.1

2.0.0

  • Update to CakePHP Version 2.8.2
  • Add support for PHP7
  • Add support for various debian based distributions
  • Add support for Graphite
  • Add new responsive theme based on AdminLTE
  • Fixed hard and soft state display issue for hosts
  • Fixed strange URL issue
  • Better external command success messages for mobile devices
  • Usage of CakeResponse::file() to transmit RRDTool-Graphs PNGs
  • Moved version numbers to app/Config/bootstrap.php
  • App name can be set now over Interface.php
  • Prepare for Naemon >= 1.0.4
  • Add missing closing form tag for search bar
  • Fix display of acknowledgements
  • Fix SQL schema for host and service dependencies

1.6.0

  • Resolve issue with orphaned child processes Issue 14
  • Remove /var/log/statusengine.log [LogfileTask.php] and use syslog instead Issue 15
  • Refactored performance data parser
  • Add test for performance data parser
  • Set own cache prefix for the CLI app to avoid permission issues
  • Add demo mode for Statusengine Web Interface

1.5.3

  • Add Pull-To-Refresh to the web interface for mobile devices

1.5.2

  • Improved performance of StatusengineLegacyShell (GEARMAN_WORKER_NON_BLOCKING)

1.5.1

  • Fixed "MySQL has gone away" crashes of StatusengineLegacyShell

1.5.0

  • Add responsive web interface

1.4.1

  • Add support for Naemon configuration process_performance_data for each service

1.4.0

  • Add native performance data processor
  • Add mod_perfdata (performance data processor for mod_german)

1.3.0

  • Multithreading for Servicestatus

1.2.0

  • Add in memory engine

1.0.1

  • First stable version of Statusengine

Licence

Copyright (c) 2014 - present Daniel Ziegler [email protected]

Statusengine is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation in version 2

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

statusengine's People

Contributors

blangtech avatar dhoffend avatar jackdown avatar mjameswh avatar nook24 avatar statusengin avatar svedrin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

statusengine's Issues

Disable anonymous mode

Is there a way to disable the anonymous/guest mode, or at least prevent it from acting on nodes (disabling, etc)?

Hardcoded is_volatile

I missed the is_volatile option in statusengine.c, so i need to add: SERVICEOBJECT_INT(is_volatile); on service dumping

Statusengine 3 - FAQ

Statusengine 3 is available

Today I released the next generation of Statusengine, Version 3.

SE3 has a complete new code base, new database schema, and supports more database backends.
Read more about Statusenngine 3 at the project page: https://statusengine.org/

Why Statusengine 3?
Step by step Statusengine became more than a simple Event Broker Module. Three years ago, I started development of Statusengine to debug the Monitoring Core - seriously :D

Than I started to add feature, like database backend, performance data processor and so on. I never planned to do this, but i was annoyed...

To keep the code maintainable, it was time to refactor and to get rid of things...

Is Statusengine 2 dead now?
Due to the fact, that my spare time is limited I will not implement new features to Statusengine 2.

If you found a bug, or want to improve Statusengine, please don't hesitate to create an Issue or send an Pull Request!

Can I stay on Version 2?
Yes, why not! But keep in mind, that the Event Broker Module is this repository is getting older and older every day.
I would recommend you, that you use the event broker module from the new repository. It's 100% compatible! https://github.com/statusengine/module

Where is the documentation of Version 2?
Version 2 is now "old stable" and the documentation will be still available on the Statusengine project page.

New Repositories
To make it easier, I created a new GitHub organization for Statusengine, to split all components into a single repository.
All new developments are done there: https://github.com/statusengine

Feedback welcomed!

  • You like Statusengine 3?
  • You miss a feature or found a bug?
    Please don't hesitate to create an Issue!

Gab in servicestatus_id due to MySQL behavior

MySQL increases the value of auto increment by every single ON DUPLICATE KEY UPDATEor REPLACE query.
Due to this, you can easily hit the auto increment max value.

So, i would recommend to truncate the prefix_hoststatus and prefix_servicestatus tables on every restart of the monitoring core, inside of the FINISH_OBJECT_DUMP event handler...

See: https://www.percona.com/blog/2011/11/29/avoiding-auto-increment-holes-on-innodb-with-insert-ignore/

This is an example of a system with 60 services.
example

Patch

--- cakephp/app/Console/Command/StatusengineLegacyShell.php
+++ cakephp/app/Console/Command/StatusengineLegacyShell.php
@@ -549,9 +549,15 @@ class StatusengineLegacyShell extends AppShell{
                                $this->activateObjects($this->dumpIds);

                                //Remove deprecated status records
-                               CakeLog::info('Delete deprecated status records');
-                               $this->removeDeprecatedHoststatusRecords($this->dumpIds);
-                               $this->removeDeprecatedServicestatusRecords($this->dumpIds);
+                               //Removed due to: https://www.percona.com/blog/2011/11/29/avoiding-auto-increment-holes-on-innodb-with-insert-ignore/
+                               //CakeLog::info('Delete deprecated status records');
+                               //$this->removeDeprecatedHoststatusRecords($this->dumpIds);
+                               //$this->removeDeprecatedServicestatusRecords($this->dumpIds);
+
+                               CakeLog::info('Truncate table hoststatus');
+                               $this->Hoststatus->truncate();
+                               CakeLog::info('Truncate table servicestatus');
+                               $this->Servicestatus->truncate();

                                $this->dumpIds = [];

Naemon - statuseninge fails to start

When I try to integrate statusengine into naemon, I get the following error:

Could not load module '/opt/statusengine/statusengine.o' -> /opt/statusengine/statusengine.o: undefined symbol: hostescalation_ary

I use naemon on an Cent OS 7 with Naemon Core 1.0.5-pkg

Logging of statusengine

I've realized different things with the logging of statusengine cakephp application

  1. The LegacyShell Daemon uses a hardcoded file handler to write the output to

  2. The current hardcoded file handler logging doesn't log any timestamps in the logfile which makes it harder to analyse future possible problems or crashes.

  3. The current code doesn't support logfile rotation. StatusengineLegacyShell.php could reopen (close/open) the logfile on SIGHUP or similar to support log rotation.

  4. CakePHP provides a generic LogHandlerInterface which supports file, syslog and other handler. Is there a reason for not using the generic logging interface instead of fopen/fwrite? With generic logging and syslog you would tackle the logrotation problem also since logrotation can be taken care on the syslog server, etc

Wrong value in Servicestatus.last_hard_state

In the field Servicestatus.last_hard_state Statusenige writes 1970. I trached the error back to the function
servicestatusIdFromCache lines:
'last_hard_state_change' => date('Y-m-d H:i:s', $payload->servicestatus->last_hard_state_change),
'last_hard_state' => date('Y-m-d H:i:s', $payload->servicestatus->last_hard_state),

Problem with mod_gearman

Rename the &client variable, because it gets "merged" with mod_gearmans client variable if both brokers are running in one naemon process!

Documented installation procedure doesn't include "users" table creation

Following the documented installation procedure leads to statusengine's PHP interface complaining about non-existence of MySQL table "users". Structure of that table can be found in the source code (https://github.com/nook24/statusengine/blob/master/sql/statusengine.sql), but that file is not mentioned anywhere in documentation.

A closely related issue is that this file create a default admin user, with a hardcoded password hash, yet the actual password seems not to be documented anywhere. It seems that either the default password should be documented and users be advised to immediately change that default password, or the documentation should explain how to create the initial user (which might be difficult given that MySQL doesn't support blowfish encryption).

Multiple dashboards per customer

Today I make available to my customers a modified version of https://exchange.nagios.org/directory/Addons/Frontends-%28GUIs-and-CLIs%29/Web-Interfaces/Simple-Nagios-PHP-Dashboard/, where I create the service groups in NagiosBPI (with a personalized field with the customer's name) and present a unique dashboard for each customer.

I would like to adopt StatusEngine, for my clients. My idea is, according to the @Domain of the login it loads only the hosts and services of that client.

Any suggestions on how I can implement this? It could even be an installation for each client (I create subdomains) and an environment variable for StatusENgine to search only the client's hosts and services information.

Any idea? # #

Gearman's server address should be configurable

Gearman's server address is currently hard coded to 127.0.0.1 in the broker binary module. The address should be configurable through module arguments.

My use case is to have nagios-core (including the status engine module), run inside a dedicated docker container (with the web interface, gearmand and mysql each running in distinct containers). I am pretty sure that others persons might have other legitimate use case for this requirement.

Worker/Childs are left behind if main app crashes

When using the provided start script, several worker process are being started and forked into background without any real parent pid.

start-stop-daemon creates a pid file of the main php script which then gets closed after all worker processes are being created.

When calling the init script with the status parameter you get an error that statusengine is not running cause the pid file created by start-stop-daemon has already ended but the forked childs still live on.

When you try to stop statusengine it tells you that statusengine has already been stopped (the process to the pid file .... same as status).

Flappdetection

If flaptedection is enabled, but no flap detection options are set, status engine will dump an not valide configuration to services table i guess.

need cancel downtime for host and services.

Hi Nook,

We have a requirement that down time need to canceled when we cancelled for node.
currently we do not have that option.
could it possible to achieve that option with any UI code changes.
Could you please help on achieve this.

Thanks
Vijay

truncate tables

The query that CakePHP builds to truncate the tables is not that good because it is using IN($ALL_IDS)

DELETE `Command` FROM `naemon`.`naemon_commands` AS `Command`   WHERE `Command`.`command_id` IN (1188, 1189, 1190, 1191, 1192, 1193, 1194, 1195, 1196, 1197, 1198, 1199, 1200, 1201, 1202, 1203, 1204, 1205, 1206, 1207, 1208, 1209, 1210, 1211, 1212, 1213, 1214, 1215, 1216, 1217, 1218, 1219)

Solution: Replace with TRUNCATE TABLE ...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.