Git Product home page Git Product logo

nagira's People

Contributors

dmytro avatar ivan-gusev avatar

Stargazers

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

Watchers

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

nagira's Issues

Any way to speed up 404s or current_state for hosts?

Hi there,

Is there any way to speed up how long it takes for Nagira to return a 404 when a hostname is not found?

Also is there a more efficient way of getting 'current_state' for a host other than doing this?

10.1.0.1:4567/_status/hostname

performance numbers all over the place:

10.1.0.9 - - [29/Feb/2016:15:09:35 -0500] "GET /_status/srv181 HTTP/1.1" 404 59 0.3411
10.1.0.9 - - [29/Feb/2016:15:09:35 -0500] "GET /_status/srv183 HTTP/1.1" 404 59 0.0024
10.1.0.9 - - [29/Feb/2016:15:09:36 -0500] "GET /_status/srv184 HTTP/1.1" 404 59 0.0021
10.1.0.9 - - [29/Feb/2016:15:09:38 -0500] "GET /_status/srv185 HTTP/1.1" 404 59 0.0021
10.1.0.9 - - [29/Feb/2016:15:09:40 -0500] "GET /_status/srv186 HTTP/1.1" 404 59 0.0021
10.1.0.9 - - [29/Feb/2016:15:09:40 -0500] "GET /_status/srv187 HTTP/1.1" 404 59 0.0021
10.1.0.9 - - [29/Feb/2016:15:09:43 -0500] "GET /_status/srv189 HTTP/1.1" 404 59 0.1617
10.1.0.9 - - [29/Feb/2016:15:09:43 -0500] "GET /_status/srv193 HTTP/1.1" 404 59 0.0022
10.1.0.9 - - [29/Feb/2016:15:09:43 -0500] "GET /_status/srv194 HTTP/1.1" 404 59 0.0020
10.1.0.9 - - [29/Feb/2016:15:09:43 -0500] "GET /_status/srv195 HTTP/1.1" 404 59 0.0020
10.1.0.9 - - [29/Feb/2016:15:09:44 -0500] "GET /_status/srv197 HTTP/1.1" 404 59 0.0028
10.1.0.9 - - [29/Feb/2016:15:09:44 -0500] "GET /_status/srv141 HTTP/1.1" 404 59 0.0138
10.1.0.9 - - [29/Feb/2016:15:09:45 -0500] "GET /_status/srv156 HTTP/1.1" 404 59 0.0022
10.1.0.9 - - [29/Feb/2016:15:09:45 -0500] "GET /_status/srv198 HTTP/1.1" 404 59 0.0021
10.1.0.9 - - [29/Feb/2016:15:09:45 -0500] "GET /_status/srv199 HTTP/1.1" 404 59 0.0021
10.1.0.9 - - [29/Feb/2016:15:09:45 -0500] "GET /_status/srv201 HTTP/1.1" 404 59 0.0024

YARD methods overload

Covert all YARD documentation to use YARD macros below:

  # @method get_config
  # @overload get("/_config")

It's only partial now.

Cannot get servicecomments from API

I haven't been able to figure out a way to get service comments from the API. I see that it's implemented in the ruby gem "ruby-nagios-0.1.0" but don't see any end point in the API that lets me get to it. I'd love to be able to get the comment from a service alert that has been acknowledged.

Basic authentication

Hi, Its possible to use authentication to http requests to nagira?

I dont want all my nagios info to be public.

Thanks for your work.

Cheers,

init.d function `get_pid` using `ps -C` failing to identify nagira process

echo $(ps -C ruby -o pid,cmd | awk '$2 ~ /^\/usr.*bin\/nagira *$/ {print $1}')

running
root@nagios:~# echo $(ps -C ruby -o pid,cmd | awk '$2 ~ /^\/usr.*bin\/nagira *$/ {print $1}')
returns nothing..

The process is being spawned, but the get_pid function is failing.

# sherlock
OS=Linux
MACH=x86_64
KERNEL=3.13.0-48-generic
DISTRIBUTION=debian
FAMILY=debian
DERIVATIVE=Ubuntu
RELEASE=14.04
CODENAME=trusty

Code switched to

echo $(ps aux| grep nagira| grep ruby| awk '{print $2}')
root@nagios:~# service nagira start
Starting Sinatra Nagira services:    [OK]
Process Sinatra Nagira services is running with PID: 2185

root@nagios:~# service nagira status
Process Sinatra Nagira services is running with PID: 2185

root@nagios:~# service nagira stop
Shutting down Sinatra Nagira services:    OK

Logs in rspec

Start messages are implemented as configure in nagira.rb. When running rspec, messages are printed to STDOUT.

Find a way to use Sinatra logger for this.

$ rspec 
[2013-02-15 12:07:40 +0900] -- Starting Nagira apllication
[2013-02-15 12:07:40 +0900] -- Using nagios file config: /data/nagios.cfg
[2013-02-15 12:07:40 +0900] -- Using nagios file status: /data/status.dat
[2013-02-15 12:07:40 +0900] -- Using nagios file objects: /data/objects.cache
[2013-02-15 12:07:40 +0900] -- Using nagios file commands: /tmp/nagios.cmd
[2013-02-15 12:07:40 +0900] Starting background parser thread with interval 4.9 sec
...................................................................................................

Finished in 1.31 seconds

Fails to run from bundle

When nagira installed as part of bundle, for example from Gemfile in Rails app, its start script fails to run. Can not find sherlock command.

Running from capistrano:

* executing "/etc/init.d/nagira restart"
    servers: ["192.168.56.99"]
    [192.168.56.99] executing command
 ** [out :: 192.168.56.99] Process Sinatra Nagira services is not running
 ** [out :: 192.168.56.99] Starting Sinatra Nagira services:
 ** [out :: 192.168.56.99] sherlock not found
    command finished in 307ms

Travis CI fails with rbx

https://travis-ci.org/dmytro/nagira/jobs/3769887

$ rvm use rbx-19mode
Using /home/travis/.rvm/gems/rbx-head-d19
$ ruby --version
rubinius 2.0.0rc1 (1.9.3 release 2012-11-02 JI) [i686-pc-linux-gnu]
$ gem --version
1.8.24
....
$ bundle exec rspec spec
....F.F.F.F........................................................................................

Increase Max thread count. Performance Tuning of Nagira/Sinatra for _full call.

How could we do performance improvement of Nagira / Sinatra frame work to get better results. We have certain integrations that are utilizing Nagira to get the _full dump but its taking lot of time (output is approximately 45MB size). many times in a day it fails with 500 internal error - particularly there are overlapping _full calls:
"GET /_status/_full HTTP/1.1" 500 30 15.5245"

Often I'm seeing below in nagira.logs so I was wondering if I can increase the max thread count (or something similar) to achieve better performance? I've much beefier box.

Snippet form the logs:
Puma 2.8.2 starting...

  • Min threads: 0, max threads: 16
  • Environment: production
  • Listening on tcp://0.0.0.0:4567
    == Sinatra/1.4.5 has taken the stage on 4567 for production with backup from Puma

XML & ActiveSuport

In app.rb, Parse nagios files

##
# TODO: This stuff breaks XML valid. Will have to wait.
#    
#     idx = 0
#     @status.keys.uniq.each do |hostname|
#       @status[idx] = @status[hostname]
#       idx += 1
#     end

To add full ActiveSupport need to have routes like: /_status/0 additionally to /_status/hostname. But because of tags like <0> XML validation breaks completely.

run on same port as nagios

Is there a way to run this on top of the nagios web server so I don't have to open up another port? That would be very useful.

nagios.cfg parser

  • better error reporting for parser
    • report line number and
    • full line (before parse)
  • extra spaces removal

long status file parse time causes incomplete object with background parsing enabled

We have huge status file(16M) so I was hoping that background parsing would help us a lot. Unfortunately I had to rollback due to an issue when api calls are made while nagios[:status] still being populated - this causes 404 errors in cases where we get hostgroups and then query hostgroup members for particular service (that is present for every hostgroup member).

I tried to fix this issue with simple mutex.synchronize around parse! in bg thread and having mutex.synchronize in "before do", but it essentially disables background parsing because all http threads have to wait for bg thread to complete parsing.

The right way of dealing with this situation would be having an active nagios[:status] instance and "being populated" instance and swap them (or reference) once parsing is complete. I'll try to implement something like this myself, but I wonder if Dmytro has any better ideas on how to tackle this problem.

get_pid() does not return the current pid

OS: Red Hat 4.4.7-3

when run: /etc/init.d/nagira status it always returns the service is not running

it seems the following command need some fix:
echo $(ps -C ruby -o pid,cmd | awk '$2 ~ /^/usr.*bin/nagira *$/ {print $1}')

Starting nagira by services command fails

[root@nagios log]# service nagira start
Starting Sinatra Nagira services: sherlock not found
[root@nagios log]# sherlock
OS=Linux
MACH=x86_64
KERNEL=2.6.18-308.el5
DISTRIBUTION=redhat
FAMILY=rh
DERIVATIVE=centos
RELEASE=5.8
[root@nagios log]# /etc/init.d/nagira start
Starting Sinatra Nagira services: [OK]
Process Sinatra Nagira services is running with PID: 7399
[root@nagios log]#

Redcarpet Travis JRuby

https://travis-ci.org/dmytro/nagira/jobs/5522168

Installing rack-test (0.6.2) 
Installing redcarpet (2.2.2) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /home/travis/.rvm/rubies/jruby-1.7.3-d19/bin/jruby extconf.rb 
NotImplementedError: C extension support is not enabled. Pass -Xcext.enabled=true to JRuby or set JRUBY_OPTS or modify .jrubyrc to enable.

   (root) at /home/travis/.rvm/rubies/jruby-1.7.3-d19/lib/ruby/shared/mkmf.rb:8
  require at org/jruby/RubyKernel.java:1027
   (root) at /home/travis/.rvm/rubies/jruby-1.7.3-d19/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1
   (root) at extconf.rb:1


Gem files will remain installed in /home/travis/.rvm/gems/jruby-1.7.3-d19/gems/redcarpet-2.2.2 for inspection.
Results logged to /home/travis/.rvm/gems/jruby-1.7.3-d19/gems/redcarpet-2.2.2/ext/redcarpet/gem_make.out

An error occurred while installing redcarpet (2.2.2), and Bundler cannot
continue.
Make sure that `gem install redcarpet -v '2.2.2'` succeeds before bundling.

The command "bundle install" failed and exited with 5 during install.

Your build has been stopped.

host_status vs status

Have an alias route /_host_status, which should be the same as /_status, but it's not implemented.

/etc/init.d/nagira start doesn't start

When I run the nagira-setup config:all everything works except when the services have to start.

And I check on the log file and I got this error:

/usr/local/rvm/gems/ruby-1.9.2-p320/gems/nagira-0.3.3/lib/app.rb:70:in block in <class:Nagira>': undefined methodstatus_file' for #Nagios::Config:0x00000015b5fcb0 (NoMethodError)
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/sinatra-1.3.6/lib/sinatra/base.rb:1356:in configure' from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/nagira-0.3.3/lib/app.rb:62:inclass:Nagira'
from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/nagira-0.3.3/lib/app.rb:53:in <top (required)>' from /usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:inrequire'
from /usr/local/rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in require' from /usr/local/rvm/gems/ruby-1.9.2-p320/gems/nagira-0.3.3/bin/nagira:4:in<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.2-p320/bin/nagira:23:in load' from /usr/local/rvm/gems/ruby-1.9.2-p320/bin/nagira:23:in

'
from /usr/local/rvm/gems/ruby-1.9.2-p320/bin/ruby_executable_hooks:15:in eval' from /usr/local/rvm/gems/ruby-1.9.2-p320/bin/ruby_executable_hooks:15:in'

It strange because I try with different version of nagira and different version of ruby.
Maybe I do something wrong but I don't know.

For the moment nagira works only in test when I run it in the command line "nagira"

Thanks in advance.

Refactor code and make it into gem

Dependencies:

  • merger code of upstream fork of ruby-nagios
  • remove ruby-nagios git module and switch to gem instead
  • then convert Nagira to gem

nagira_active_resource json 1.7.7 dependency causing conflicts with other gems

I'm using Rails 3.2.13 with a number of other gems, notably carrierwave and a jQuery UI gem, both of which now require json 1.8.0. I can't install the nagira_active_resource gem because it requires json 1.7.7.

: jkirk@imac:my_rails_app ; bundle install
Fetching gem metadata from https://rubygems.org/........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Bundler could not find compatible versions for gem "json":
  In Gemfile:
    nagira_active_resource (>= 0) ruby depends on
      json (= 1.7.7) ruby

    carrierwave (>= 0) ruby depends on
      json (1.8.0)

Namespace cleanup

Namespace cleanup - for all attributes, used in Nagios, their names should correspond to variable names in code.

For example:

hostname -> to host_name, etc

objects.cache is not parsed correctly for service blocks

This is more an issue in ruby-nagios but I couldn't add an issue on that project. In objects.rb the objects.cache file is parsed and an assumption that all blocks have _name is made:

@objects[handler][block["#{handler.to_s}_name".to_sym]] = block

Unfortunately service blocks use service_description and not service_name.

In addition, in order to be unique, the host_name + service_description need to be combined somehow.

JRuby Travis fail

https://travis-ci.org/dmytro/nagira/jobs/5522395

Installing sinatra (1.3.5) 

Psych::SyntaxError: (<unknown>): 'reader' unacceptable character '�' (0x82) special characters are not allowed
in "'reader'", position 278 at line 0 column 0
An error occurred while installing sinatra-contrib (1.3.2), and Bundler cannot
continue.
Make sure that `gem install sinatra-contrib -v '1.3.2'` succeeds before
bundling.

The command "bundle install" failed and exited with 5 during install.

Your build has been stopped.

feature/background_parsing

Add background thread to parse status.dat file periodically even if there are no client requests.

  • should be configurable (enable/disable)
  • parse on intervals shorter that TTL

Client requests will not have delay waiting for parsing.

TTL test

Add test scenarios for testing:

  • ttl expired
  • ttl parsing with BG parser
  • BG parser and user request

Unable to run the test configuration

Hello I am able to install the gem and run ''nagira', then when I try to setup test configuration i am facing this problem
Students-iMac:student1 student1$ nagira-setup config:test:install
(in /Users/student1/.rvm/gems/ruby-2.2.3/gems/nagira-0.5.0)
rake aborted!
NameError: uninitialized constant ActiveSupport::Concern
/Users/student1/.rvm/gems/ruby-2.2.3/gems/activemodel-4.2.5/lib/active_model/serializers/xml.rb:11:in <module:Xml>' /Users/student1/.rvm/gems/ruby-2.2.3/gems/activemodel-4.2.5/lib/active_model/serializers/xml.rb:10:inmodule:Serializers'
/Users/student1/.rvm/gems/ruby-2.2.3/gems/activemodel-4.2.5/lib/active_model/serializers/xml.rb:8:in <module:ActiveModel>' /Users/student1/.rvm/gems/ruby-2.2.3/gems/activemodel-4.2.5/lib/active_model/serializers/xml.rb:7:in<top (required)>'
/Users/student1/.rvm/gems/ruby-2.2.3/gems/nagira-0.5.0/lib/nagira.rb:2:in <top (required)>' /Users/student1/.rvm/gems/ruby-2.2.3/gems/nagira-0.5.0/Rakefile:2:inrequire_relative'
/Users/student1/.rvm/gems/ruby-2.2.3/gems/nagira-0.5.0/Rakefile:2:in `<top (required)>'
(See full trace by running task with --trace)

Any help will be appreciated.
Ravanliyski

Directory permissions for init.d

Add check to /etc/init.d script to check permissions of Nagira installation directory.

If nagira started as nagios user and dir is not accessible init script fails without reporting an error.

#  /etc/init.d/nagira  start
Starting Sinatra Nagira services:    [FAIL]

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.