Permalink
Browse files

New environment variableis support: see history file

  • Loading branch information...
1 parent a4421c8 commit 2959267e2b24b9a28b4f7b95b411b37f99ffdc61 @dmytro committed Mar 15, 2013
Showing with 59 additions and 51 deletions.
  1. +7 −2 History.md
  2. +13 −46 README.md
  3. +2 −0 config/environment.rb
  4. +36 −2 config/nagira.defaults
  5. +1 −1 version.txt
View
9 History.md
@@ -1,6 +1,11 @@
-### v.0.2.2
+### v.0.2.5
-* Fri Mar 15 14:55:41 JST 2013 -- Dmytro Kovalov
+* Fri Mar 15 2013 -- Dmytro Kovalov
+ - Environment variables support and defaults file:
+ - `NAGIRA_TTL`
+ - `NAGIRA_BG_PARSING`
+ - `NAGIRA_PORT` - see Sinatra `set :port`
+ - `NAGIRA_BIND` - see Sinatra `set :bind`
- Packaged as gem
- nagira and nagira-setup binaries
- cleaner init.d script, support for Debian and RedHat
View
59 README.md
@@ -31,17 +31,21 @@ Source code available from Github https://github.com/dmytro/nagira
## Installation
-See {file:INSTALL.rdoc}
+```
+ gem install nagira
+```
+
+For more details look at {file:INSTALL.rdoc}
## Usage
-1. Run Sinatra application `bundle exec ./nagira.rb`
+1. Run Sinatra application `nagira`
2. Use HTTP client to get information:
```
- curl http://localhost:4567/objects/contact/list
+ curl http://localhost:4567/_objects/contact/_list
- curl http://localhost:4567/status/list
+ curl http://localhost:4567/_status/_list
```
or to send check result to Nagios:
@@ -59,11 +63,11 @@ curl -X PUT -H "Content-type: application/json;" \
```
-See more in {file:FEATURES.rdoc}
+See more in {file:FEATURES.rdoc} and API documentation in {file:API.md}
## Documentation
-YARD documentation included with the project, run `yardoc` in project root directory. Generated YARD docs are available at http://dmytro.github.com/nagira/doc
+YARD documentation included with the project, run `yardoc` in project root directory. Generated YARD docs are available at http://dmytro.github.com/nagira
## How and why?
@@ -78,50 +82,13 @@ YARD documentation included with the project, run `yardoc` in project root direc
If necessary at a later stages this could be implemented using Nagios' NEB interface, but the disadvantage of the NEB API is that it could block Nagios process and introduce latencies in Nagios.
-File parsing obviously takes resources for each single parse, however
-if application -- Rails, Sinatra or similar -- is able to keep state
-of the parser, is not a problem. IF application can keep track of file
-parse times and file modification time it is possible to parse file
-only if it was changed and infrequently enough.
+File parsing obviously takes resources for each single parse, however if application -- Rails, Sinatra or similar -- is able to keep state of the parser, is not a problem. IF application can keep track of file parse times and file modification time it is possible to parse file only if it was changed and infrequently enough.
# Road-map blueprint
-When implemented API could provide foundation for development of
-well-defined, modular, distributed Nagios monitoring: distributed
-Nagios nodes communicating with each other, retrieving status and
-submitting check results, distributed, load-balanced, fault tolerant
-configuration.
-
-Web GUI (IMHO weakest part of the Nagios) could be completely
-de-coupled from Nagios core and is not required to run on the Nagios
-core host.
-
-## First stage
-
-Note: *Implemented in version 0.1*
-
-Read-only (GET) routes to access lists of monitored objects and states
-of the objects.
-
-There are examples of various Nagios interfaces: [NDOUTILS][ndoutils], [IdoUtils][idoutils], [MK_Livestatus][mk_livestatus]. This is an attempt to do similar things using web services API.
-
-[ndoutils]: http://exchange.nagios.org/directory/Addons/Database-Backends/NDOUtils/details
-[idoutils]: http://docs.icinga.org/latest/en/quickstart-idoutils.html
-[mk_livestatus]: http://mathias-kettner.de/checkmk_livestatus.html
-
-## Second stage
-
-Note: *Implemented starting from v0.2.*
-
-Implement NCSA passive checks submission functionality using HTTP(S) web service.
-
-Starting version v0.2 two Nagios external commands implemented `PROCESS_HOST_CHECK_RESULT` and `PROCESS_SERVICE_CHECK_RESULT`. This allows submitting passive check results for hosts and services, and implements accordingly functionality NSCA.
-
-## Later stages
-
-Use POST/PUT/DELETE HTTP methods to control Nagios - automatically change configuration, control notifications, contacts; in many cases this requires Nagios process restarts/reloads.
+When implemented API could provide foundation for development of well-defined, modular, distributed Nagios monitoring: distributed Nagios nodes communicating with each other, retrieving status and submitting check results, distributed, load-balanced, fault tolerant configuration.
-There are 157 external commands in Nagios 3, compared to 2 implemented, so this is still far away...
+Web UI could be completely de-coupled from Nagios core, not required to run on the Nagios host and can retrive data over the network. It's possible to build complete Javascript web application running in the browser server-less.
## Author
View
2 config/environment.rb
@@ -4,6 +4,8 @@ class Nagira < Sinatra::Base
disable :protection
enable :logging
+ set :port, ENV['NAGIRA_PORT'].to_i if ENV['NAGIRA_PORT']
+ set :bind, ENV['NAGIRA_BIND'] if ENV['NAGIRA_BIND']
configure do
set :format, :json
View
38 config/nagira.defaults
@@ -2,29 +2,63 @@
# Defaults configuration file for Nagira
# --------------------------------------------
#
+# ----------------------
+# Port. Default 4567
+# ----------------------
+# NAGIRA_PORT=
+#
+# ----------------------
+# BIND
+# ----------------------
+# String specifying the hostname or IP address of the interface to
+# listen on when the :run setting is enabled. The default value –
+# '0.0.0.0' – causes the server to listen on all available
+# interfaces. To listen on the loopback interface only, use: 'localhost'
+#
+# NAGIRA_BIND=localhost
+# ----------------------
+# Environment
+# ----------------------
+# Usually needs to be production
+#
# RACK_ENV=production
#
+# ----------------------
+# Nagira user
+# ----------------------
# Usually nagira process should be run by same user ID as Nagios. In
# many cases this is nagios user.
#
# NAGIRA_USER=nagios
#
-#
+# ----------------------
+# RVM
+# ----------------------
# RVM_STRING="rvm use default"
#
+# ----------------------
# Log file
+# ----------------------
# NAGIRA_LOG=/var/log/nagios/nagira.log
#
-#
+# ----------------------
+# TTL for data
+# ----------------------
# Number of seconds between re-parses. All Nagios file are parsed no
# more often than this. Default is 5 sec. Setting this to 0 or
# negative number disables TTL and backgroiund prser as well.
#
# NAGIRA_TTL=20
#
+# ----------------------
+# Background parsing
+# ----------------------
# Set this to 0, to disable background parsing.
# NAGIRA_BG_PARSING=1
#
+# ----------------------
+# Nagios configuration file
+# ----------------------
# Where main Nagios configuration file is located. usually this does
# not need to change.
#
View
2 version.txt
@@ -1 +1 @@
-0.2.2
+0.2.5

0 comments on commit 2959267

Please sign in to comment.