Recent posts (max 20) - Browse or Archive for more

Gong Xi Fa Cái

Since I forgot xmas and new years eve (was ill) I figured I'd post the Chinese new year instead! :)

  • Posted: 2012-01-22 19:24
  • Categories: ot
  • Comments (0)

NSClient++ 0.4.0 RC1! (Finally)

build 126, 127 will be out later tonight whith some fixes to NSCA unit-tests.

After years of vapor ware and many broken promises I can finally proudly pressent the first release candidate of NSCLient++ 0.4.0!

So what can you expect you ask? Quite a lot in fact but currently the rather sad answer will be unfortunetly "not much". Now this is a good thing and the reason is that the idea is that anyone runnign on a previous version of NSCLient++ should be able to just upgrade and not notice the difference (except for the odd bug fix here and there).

But for all the rest of you who do not want to "just upgrade" there is a massive amount of new features. The two biggest changes will undoubtedly be the linux support as well as is a shift from beeing a "NRPE client" to more of a monitoring gateway which supports more protocols (with even more in the pipe). Another other major change is ofcourse the embedded python interpreter and the very extensive python API making it possible to create plugins in python which can have state across your monitoring.

So now it is just for everyone to go out test it and let me know what is not working so we can release a bug free version in the near future. I have not set a date as I am relaying on the community (yes, that is you!) for doing much of the test work and that may or may not take a lot of time (depending on how much YOU! test).

Stability and quality wise I hope it is farily stable and everything works as-is but one never knows when there is such a massive update. Especially as it is apretty free-form application which has a lot of the edge cases. But another major improvment is that there are now unit-tests which test various parts of the application at the time of writing there is around 1000 unit tests which more to come.

Many new protocols

We now support a number of new protocols (as well as old).

Currently supported:

  • NRPE
  • NSCA
  • "check_nt"
  • SysLog?
  • SMTP
  • NSCP (early concept version, both as distributed (think gearman) and non distributed (think NSCA/NRPE))

In the works:

  • http (rest)
  • Graphite
  • check_mk
  • NRDP
  • SNMP
  • WMI
  • "native remote windows checks"

Brand new API

Major new API changes which allows a lot more flexibility as well as extensible from modules and scripts.

Currently supported:

  • Python
  • plugins
  • Lua (old API currently)

In the works:

  • Lua
  • .Net

Brand new settings sub systems

Brand new flexible settings sub systems which supports many new formats as well as generation and including cross formats.

Currently supported:

  • ini-files
  • registry
  • http (ini files)
  • old
  • dummy (in memory store)

In the works:

  • XML
  • improved http

Other fixes and enhancments

We have of course a myrriad of bug fixes enhancments and and such here are a few highlights.

highlights:

  • Brand new (easy to use?) command line interface
  • Linux suppport (as mentioned previously)
  • CheckProcState: Enchancements
  • CheckEventLog: Real time checking
  • CheckWMI: Remote check support (rather crude currently)
  • lots of other things but focus is mainly on internals so checks are mainly the same

So! Test away, and hit me with your bugs, defects, problems, and issues... Michael Medin

Migration and concepts guide for 0.4.0

Hello google bot!

Just a quick heads up that the first draft of the migration guide as well as the concepts guide is now live!

Now I am off to make some last minute changes before releasing RC1!

Michael Medin

Documentation for 0.4.x

I have started to write documentation for the 0.4.x version. Currently we have the following documents:

Next up is a migration guide as well as a concept document. RC1 is still scheduled for this weekend so please help out next week to do some testing!

Note that all documents are "first draft" so it is a bit all over the place currently :P

Michael Medin

Status

Well, I sort of promised to release rc1 of 0.4.0 on which has now become last year. This was in fact almost about to happen but unfortunately I grew ill shortly after xmas (nothing serious really). But this has keep me away from the computer for about 2 weeks now meaning I am slightly behind. And what is worse I missed the golden "holiday opportunity" to do some serious documentation.

Now it is not too bad I finished the NRPE unit test last night and hopefully I will get some spare time during night this week to document the initial usage of 0.4.0 so with luck next week we will in fact see the first RC of 0.4.0!

Michael Medin

Second 0.4.0 beta out!

Hello,

The main new things is a much improved client syntax as well as fully functional client modules and much improved handling of "Clients".

Get it from the download section (113) or here:

I will post a guide to getting started with 0.4.0 later tonight.

Michael Medin

Full change log:

2011-12-06 MickeM
 * Fixed so command line client wont try to run commands in modules which does not support it.
 * Changed to when no settings is found a default one is created
 * Removed old "location" key from switch context and changed so it use the new number scheme
 
2011-12-06 MickeM
 * Added python unittests to make sure threading is working properly
 * Simpliefied and cleaned up the command line syntax a bit
 * Now --exec is the default option for client mode (but it will notify you it thought so)
 * Added "command-less" execution to PythonScript so you can do --exec --script ... (without having --exec run)
 * Fixed an issue related to python threading
 * Fixed Scheduler header propgation
 * Fixed so all Client module use "complex" API meaning headers are propagated correctly
 * Fixed scheduler alias issue

2011-11-27 MickeM
 * Fixed some NSCA issues (reading from new conf)
 * Fixed some linux build issues (related to refactoring)

2011-11-27 MickeM
 * Major refactoring in the command line interface
 * Added support for alias to many common module (command line)
   so: nscp eventlog (is the same as nscp client --module CheckEventLog)
 * Fixed issue with CheckEventLog message rendering and eventid
 * Refactored all Client modules to all support command line, commands and submissions.
 * Added uniform handling of "everything" to all Client plugins
 * Fixed SyslogClient to work "as advertised" (ie. all hardcoded stuff is removed)
 * Fixed utf8 issue with text strings (now have a working concept which needs to be implementd "all over the place")
 * Many issues and fixes related to clients.
 * Fixed so CheckEvent log (insert) works much better (added new options)

Python Script Performance: 10930 checks/second

This is really about Python threadsafeness I guess (but the numbers sounds cool).

I have had various issues with python through out the development of the module (mainly related to pythons rather strange threading model). After discovering some issues the night before the conferance pressentation I set it upon myself to write some unit-tests for the python script module to make sure the threads are actually safe and works correctly.

And in doing so I got some interesting numbers.

OK: Summary Collected 109989 checks in 10 seconds: 10930/s

At the OSMC conference the other day they presented some numbers comparing Shinken with Nagios and Icinga and the gist of it was that Shinken was around 4 times as fast as Nagios with Shinken running 120k checks in 5 minutes which roughly translates to 400 checks/second.

Now in my python unit test what I do is I run an internal python based check (forwarding the result via internal channels again to Python) but in doing so to be able to force simultaneousness I run 50 threads pumping around 15k checks per second. This means I get (after running around 100000 checks) an average measured from python 10930 checks per second. This at an average 30% CPU load on my machine...

And yes, this is not fair at all, first off I have no idea what kind of hardware they used to run their checks and neither do I do any proper service checks (in fact running 10k+ service checks per second could actually even exhaust my local port stash since each remote check would probably take a few seconds).

Regardless I think it shows that NSClient++ is able to schedule a lot of checks and more importantly for me Python is now thread safe (I hope :) )...

Michael Medin

  • Posted: 2011-12-07 00:07
  • Categories: (none)
  • Comments (0)

First beta version of 0.4.0

Hello,

We now have the first beta version of 0.4.0 released. The main goal of this version is to verify that everything works "smoothly" for existing users. So essentally try to upgrade an existing 0.3.x version and let me know if everything is working out alright.

Everything should be the same after upgrading to 0.4.0 and you should not notice any differences. But this is an early release so please be carefull as it probably will have many issues and defects yet.

But it would realley help me and speed things along if a lot of people could help test this version with various existing configurations.

Also please do a backup of your existing configuration before installing this version (in case the installer is broken).

Download:

Also I will tonight try to start answering all questions last few weeks, I have been busy elesewhere last few weeks...

Since elfichero asked for a changelog I pasted it in. Notice These are changes since 0.4.x was split apart. But during a lot of the internal work I did not keep track of changes are things were moving back and forth so the "internal changes" will not be reflected here in detail.

I will write up a blog post about "whats new" in 0.4.x but in essence the "core" is new whereas the plugins (check_xxx) are the same (ish). There is also also a lot of new plugins (which were not part of 0.3.9).

2011-11-14 MickeM
 * Fixed issue with installer not saving nsc.ini when upgrading from 0.3.9

2011-11-09 MickeM
 * Added initial SyslogClient module to allow syuslog forwarding (of passive checks ish)
   Still requires template support and configuration options (mainly PoC right now).
 * Added initial SMTPClient to allow sending messages via SMTP.
   Still requires template support and configuration options (mainly PoC right now).
 * Fixed unicode log issue (still not sure message format is correct)
 * Renamed Message to log in internal wrapper API
 * Fixed issue in settings old (regarding readin new keys, not 100% supported yet)

2011-11-06 MickeM
 * Had some "vacation" so no updates for a while
 * A lot of fixes to the NSCA parts (now 100% compatible with old settings file)
 * Added option to read sections (to plugin API)
 * Fixed issues in settings wrapper so child paths are also mapped (not just keys)
 * Many fixes related to NRPE/NSCA/*
 * "RC quality" expect RC within the week (only need to fix default config file somehow)
 * Upgraded all unit test to use the simplified API
 * Fixed a some unicode issues in PythonScript module
 * Improved threading a bit
 * Fixed CheckSystem (service check)
 * Fixed duplicate keys (when replacing) in old settings client
 
2011-10-21 MickeM
 * Some more threading issues in Python (works perfectly(?) now)
 * Refactored the tests a bit making test suites runable from a central hub
 * Fixed soo everything builds and works on Linux

2011-10-19 MickeM
 * Fixed some threadding issues in PythonScript
 * Still working on refactoring the unittest helpers a bit

2011-10-16 MickeM
 * Fixed issue with loading zero-byte UTF-8 config files
 * Fixed some issues with settings subsystem (debug log as well as createing instances for --generate)
 * Added ability to set event log to real-time
 * Added support for multiple eventlogs in real-time

2011-10-09 MickeM
 * Real-time CheckEventLog working (still only for one, and I think application log)
 * Added python tests to validfate that Real-time eventlog is working.
 * Fixed som defects here and there (now builds on Linux again)
 * Fixed so it builds in "debug mode"
 * Fixed issue in grammar which caused infiniate loop in som cases
 * Fixed so error rendering in eventlog works with "infininate number of argumnets"
 * Added support for targeting execs (in API)
 * Fixed some invalid return messages
 * Streamlined submissions wrappers to be more inline with "other wrappers"
 * Fixed a myrriad of minor python script bugs
 * Added sleep command (which sometimes causes issues so use with care)

2011-10-06 MickeM
 * Initial command for createing eventlog records
 * Initial real-time eventlog checker
 * Fixed obscure c-tor issue with filters
 
2011-09-27 MickeM
 * Fixed many many issues all over the place as I tried to make things working for my pressention at nwc.
 
2011-09-24 MickeM
 * Started on NSCA unit-tests in python
 * Refactored channel API a bit to better suite NSCA (and how it actually works)
 * Changed how headers are created (nothice this might have broken NSCP stuff, havent checked)
 * Created helper lib for Python Unittests

2011-09-21 MickeM
 * Renamed NSCAAgent to NSCAClient (to be consistant)
 * Created a NSCAServer module (again for consistancy)
   This will be the defenition of the new "channels" so keep a lookout in the next few weeks

2011-09-18 MickeM
 * Implemented first version of DistributedClient and DistributedSServer which work so now we have a proper message based transport.
   Still a lot of rough edges such as cookie and authentication support is hard coded.
   We also need a proper two way distributed server as well as implement "all" payload types.

2011-09-11 MickeM
 * Massive overhaul here and there
 * Added new helper for handling "targets" (so they are the same)
 * Extracted "command line handling" so all clients will work the same
 * Extracted command processor to a common class to make all clients work the same
 * Added initial zeromq stuff (nothing usable)
 * Added an implementation layer for NSCP protocol parsing (so zeromq stuff can reuse it)
 
2011-09-05 MickeM
 * Cleaned up some dependencies (on config.h)
 * Fixed invalid data in config.h.in

2011-09-03 MickeM (0.4.0.93)
 * Created a protcol buffer free version of the python test script
 * Upgraded to new version of simpleinin class
 * Added new component for python protocol buffer library to installer
 * Added installer for unittests to test.py run like so:
   nscp --client --module PythonScript --command execute-and-load-python --script test.py
 * Fixed so settings are created if not existing
 * Fixed so plugins are not loaded in client mode
 * Fixed so core is booting correctly in client mode
 * Added new option --settings --switch <context> to allow switching context without migrating data
 * Fixed unicode error on linux (settings file)

2011-09-02 MickeM
 * Fixed several issues in PythonScript
 * PythonScript supports loading multiple instances as well as scripts
 * Added some basic channel test to test.py script (the idea is that this will become "unit tests" eventually)

2011-09-01 MickeM
 * Implemented registration of channels (so no longer faked)
 * Added settings key to change the NSCAAgent channel name
 * Addded proper channel handling to PythonScript module
 * Improved error handling in channels API
 * Rewrote wrapper API to use templates and classes instead of macros (ish)
 * Improved the internal plugin wrapping API to support multiple plugin load
 * Fixed so PythonScript module supports multiple plugin load (with new argument for plugin_id)
 * Added API for registrying routers and handling routing (almost there now)

2011-09-01 MickeM
 * Fixed issue with messages due to new API

2011-08-31 MickeM
 * Added support for loading same plugin twice (in different sessions)
 * Added preliminary support for routing passive checks

2011-08-30 MickeM
 * Fixed uncaught exception in test client
 * Added protocol buffers to source (needs to be added to installer as well)
 * Added example python protocol buffer handler
 * Added lib folder to python scripting (and automagicall load)

2011-08-29 MickeM
 * Fixed some *nix build issues...

2011-08-25 MickeM
 * Fixed some issues in the NSCPClient
 * Fixed debug log issue in core
 * Added support for "pushing" passive checks via NSCP

2011-08-24 MickeM
 * Sever refactoring of the new API (there is now two pb files ipc for NSCP protocol and plugin for plugin communication)
 * Cleaned up API helper functions
 * Fixed client argument for "client mode" to allow arbitrary arguments
 * Cleaned up the argument processor code now requires "mode" to be first argument

2011-08-23 MickeM
 * Fixed issue in the NSCP server

2011-08-22 MickeM
 * Added initial NSCP protocol implenmentation (very vrude and not really usefull yet)
 * Fixed so it builds on linux
 * Fixed so automagic plugin renaming add lib<LIB name> on *nix.
 * Fixed so it works on linux (fixed issues with timeout)

2011-08-16 MickeM (0.4.0.85)
 * Added support for remote WMI checking using target/username/password options like so:
    CheckWMI target=192.168.0.123 user=\\foobar password=foobar namespace=root\\cimv2 MaxCrit=3 MinWarn=1 "Query:load=Select * from win32_Processor"
 * Added support for looking up targets to CheckWMI
   CheckWMI target=my_test_xp MaxCrit=3 MinWarn=1 "Query:load=Select * from win32_Processor"
   Where <target> is defined under /settings/targets as well as /settings/targets/my_test_xp

2011-08-15 MickeM
 * Readded allowed hosts function
 * Moved default socket options to /settings/default/socket
 * Added more default socket options
 * Added support for target in default plugin helpers
 * Added remote WMI commands
 * Added target section under /settings/targets

2011-08-14 MickeM
 * NRPEClient now works on linux
 * Added "portable" settings map file to installer (so it will work with old installed versions)
 * Rename Function to Registry in PythonScript API as well as some other function renames
 * Started to clean up the helpers around the API
 * Added support for execute to PythonScripts to execute commands
 * BUG: just realised that static plugin instances prevent multiple instances :)
   Will fix but not now as it is not important (for me)...
 * Added initial support for channels to PythonScript
   Core still lacks support for subscribing to arbitrary channels

2011-08-13 MickeM
 * Added support for command line execution to PythonScript module
 * Readded support for specifying module on command line with --client mode
 * Fixed some issues with the NRPEClient module
 
2011-08-12 MickeM
  * Finnished (rough) adding back command line exec (with modern API)
  * Fixed so installer uses correct name for dll:s (now Server not Listsener)
  
2011-08-11 MickeM
  * Started to add back command line exec (with modern API)
  
2011-08-10 MickeM
 * Fixed linus issues and defect
 * Fixed some issues in the test python script regarding how prefix is handled
 * Fixed PythonScript module to actually use the correct function map :)
 * Fixed so it builds and runs on linux (but parser had issues so disabled som grammar rules whichneeds to be enabled again)
 * Added a lot of freatures and cleand up the PythonScript module
 * Started to merge som features from PythonScript back to Lua script
 
2011-08-07 MickeM
 * Fixed a lot of issues with PythonScript module adding suport for alias and "raw command processing"
 * Fixed issue with loading plugins and aliases as well as duplicate plugin detection
 
2011-08-01 MickeM
 * Added new module: PythonScript

2011-07-25 MickeM
 * merged in all 0.3.9 changes
 * refactored where filter to be "non template" to drastically reduce compile time (as well as potentially size if I ever go dll instead of static link)
 * streamlined checkeventlog toi be same as "the other" where filters as well as dropped support of "old" syntax.

2010-02-05
 * Multiple fixes all over the place
 * Availible modules: CheckExternalScripts, CheckHelpers, FileLogger, NRPEClient, NRPEServer, Scheduler
 ! Performance data is still missing (will be for a while yet)
 
2010-01-31 MickeM
 + Added google protocol buffers
 ! Changed internal handle command logic (now uses protocol buffers)
 - Removed (temporarily) performance data (due to protocol buffer changes)

2010-01-19 MickeM
 + Rename NRPEListener to NRPEServer
 + Added NRPEServer to CMake build

Michael Medin

Help wanted: Please attempt to recover you password!

Hello,

If you have an old account please attempt to recover your password and let me know if it works, and/or if it does not. As I, might not have said, the changes were due to replacing a file based password store with a database based one so importing passwords was not "possible" as I only store hashes and they have (or so I think) different hashing algorithms.

Michael Medin

  • Posted: 2011-10-10 10:55
  • Categories: (none)
  • Comments (0)

Cleaned out user database!

Hello,

I have cleaned out the user database as there was a lot of spam email and "strange users". So what you need to do is go to password reset dialog enter you user id and email address to request a new password (which will arrive via email).

 http://nsclient.org/nscp/reset_password

I have also activated authentication emails (instead of spam filter) so lets see if this works better. Hopefully spam bots does not have too many valid emails...

Michael Medin

Going to do some changes to the Trac site so expect erratic behavior today...

Making some updates as well changes to the trac infrastructure. Going to add some new plugins as well as change some configuration and what not...

Michael Medin

Beer or somesuch at (or around) Nagios World Conference: North America?

Hello,

I will be attending (and speaking) at the Nagios World Conference: North America so if anyone want to grab a beer or just wanna meetup and ask some question or have some ideas feel free to drop me a line at michael<AT>medin<DOT>name,  facebook or  linkedin. Various other contact details can be found at MickeM.

I will be therr all week (Saturday till Saturday) and I normally try to be "online" when I travel but I am unsure how 3G internet cash card work in the US so I cant promise anything...

Michael Medin

Looking for distributed monitorers (not necessarily using NSClient++)

I am looking for people interested in distributed monitoring!

As some of you might know I am building some features do manage distributed and incoherent monitoring (ie. more then one monitoring tool) so I am interested in getting some real world insight into this area. So if you or anyone you know are interested in this area and want to come with feedback on some ideas I have please don't hesitate to contact me (michael <AT> medin <DOT> name).

Also on a bit more sad note, lack of updates on the wiki/forums is due to ion part preparing for NWC but also on me trying to complete some new cool(?) features which hopefully shall be out this week.

Michael Medin

0.4.0 build 93 out and how to play with Python: NSClient++ style!

Hello again dearest Google bot!

Today I have a pretty big announcement for all you 0.4.0 waiters out there. I have release another nightly build which is the result of a lot of work put in during august. The main new features is of course the new protocol as well as a very extended PythonScript? module.

Since there is so much new it is a bit difficult to create s short blog post to summarize the new features. But I hope that the new test.py and test_pb.py scripts will eventually cover most of the features if nothing else as a test script.

Installing Scripts

The best way to get start with these scripts are to "install them". Something which is now supported from the command line lik so:

nscp --client --module PythonScript --command execute-and-load-python --script test.py

This is a pretty complicated command actually. The first thing we do is add --client which runs command line queries as well as commands on modules without launching NSClient++ in server mode. IN essence this is the "offline mode".

Then we have --module PythonScript? which tells the "client" to load the PythonScript? module (regardless of what your configuration says) this also prevents any configured modules from being loaded.

The next step is the --command execute-and-load-python which actually just sends a command down the pipeline to see if any plugin want to run it. In this case the PythonScript? module will run it and do so by executing the ---script test.py script.

This script is then the magic, if we look at the main function of this script we can see the following:

def install_test(arguments):
	log('-+---==(TEST INSTALLER)==---------------------------------------------------+-')
	log(' | Setup nessecary configuration for running test                           |')
	log(' | This includes: Loading the PythonScript module at startup                |')
#...
	log('-+--------------------------------------------------------==(DAS ENDE!)==---+-')
	conf = Settings.get()
	conf.set_string('/modules', 'pytest', 'PythonScript')
	conf.set_string('/settings/pytest/scripts', 'pytest', 'test.py')
	conf.save()

def __main__():
	install_test([])

The interesting thing here is that we have a python script which is modifying our configuration by first enabling the PythonScript? module (using an alias: pytest) and then adds the relevant script (again with an alias pytest). The reason for using the alias is so we can easily "uninstall" this without messing up your configuration. This is thanks to the new fully supported multiple module support. Now unfortunately NSClient++ does not (yet) support uninstalling but that will come.

The next step is (as the install command above will tell you) to reun the test script from the "test mode".

Test mode

Test mode is nothing new since as far as I can remember it has been possible to run NSClient++ is "test mode" previously we used -test and for 0.4.0 we use

nscp --test

This will start NSClient++ like a service with three main exceptions:

  1. The program will run with YOUR privileges and in YOUR session (not system)
  2. The program will run with console log and debug log enabled
  3. You will be able to interact with NSClient++ directly

So lets try it out.

D:\source\nscp\build\x64>nscp --test
l    ..\..\..\trunk\service\NSClient++.cpp:536  NSClient++ 0,4,0,93 2011-09-04 x64 booting...
d ttings_manager\settings_manager_impl.cpp:148  Boot.ini found in: D:/source/nscp/build/x64//boot.ini
d ttings_manager\settings_manager_impl.cpp:165  Boot order: ini://${shared-path}/nsclient.ini, old://${exe-path}/nsc.ini
d ttings_manager\settings_manager_impl.cpp:168  Activating: ini://${shared-path}/nsclient.ini
d ttings_manager\settings_manager_impl.cpp:68   Creating instance for: ini://${shared-path}//nsclient.ini
d \trunk\include\settings/settings_ini.hpp:256  Reading INI settings from: D:/source/nscp/build/x64//nsclient.ini
d \trunk\include\settings/settings_ini.hpp:230  Loading: D:/source/nscp/build/x64//nsclient.ini from ini://${shared-path}/nsclient.ini
l    ..\..\..\trunk\service\NSClient++.cpp:541  Booted settings subsystem...
d    ..\..\..\trunk\service\NSClient++.cpp:602  On crash: restart: NSClientpp
d    ..\..\..\trunk\service\NSClient++.cpp:614  Archiving crash dumps in: D:/source/nscp/build/x64//crash-dumps
d    ..\..\..\trunk\service\NSClient++.cpp:681  booting::loading plugins
d    ..\..\..\trunk\service\NSClient++.cpp:389  Found: PythonScript as pytest
d    ..\..\..\trunk\service\NSClient++.cpp:689  Processing plugin: PythonScript.dll as pytest
d    ..\..\..\trunk\service\NSClient++.cpp:926  addPlugin(D:/source/nscp/build/x64//modules/PythonScript.dll as pytest)
d    ..\..\..\trunk\service\NSClient++.cpp:902  Loading plugin: PythonScript as pytest
d nk\modules\PythonScript\PythoDn:S/csroiuprtc.ec/pnps:c1p5/6b u iLloda/dxE6x4 /isnc rPiyptthso/npSyctrhiopnt/ taess tp.yptye
st
d nk\modules\PythonScript\PythonScript.cpp:213  Looking for: test.py
d nk\modules\PythonScript\PythonScript.cpp:213  Looking for: D:/source/nscp/build/x64/scripts/python/test.py
d nk\modules\PythonScript\PythonScript.cpp:259  Adding script: pytest (D:/source/nscp/build/x64/scripts/python/test.py)
d nk\modules\PythonScript\PythonScript.cpp:106  Loading python script: D:/source/nscp/build/x64/scripts/python/test.py
e \modules\PythonScript\script_wrapper.cpp:15   Testing to register a function
d    ..\..\..\trunk\service\NSClient++.cpp:714  NSClient++ - 0,4,0,93 2011-09-04 Started!
l rce\nscp\trunk\service\simple_client.hpp:30   Enter command to inject or exit to terminate...

So now we are all set. The next step is to run the commands command which will list all available commands:

commands
l rce\nscp\trunk\service\simple_client.hpp:12   Commands:
l rce\nscp\trunk\service\simple_client.hpp:12   | pytest_test: Run python unittest

Now this is a pretty slim set of commands as I am only loading my script and my module. Normally you will have a lot more commands here. But lets run the command and see what happens:

pytest_test
d    ..\..\..\trunk\service\NSClient++.cpp:1021 Injecting: pytest_test...
d    ..\..\..\trunk\service\NSClient++.cpp:1021 Injecting: _pytest_test_channel_001...
d    ..\..\..\trunk\service\NSClient++.cpp:1051 Result _pytest_test_channel_001: OK
e \modules\PythonScript\script_wrapper.cpp:15   OK - Test successfull: simple ok
d    ..\..\..\trunk\service\NSClient++.cpp:1021 Injecting: _pytest_test_channel_001...
d    ..\..\..\trunk\service\NSClient++.cpp:1051 Result _pytest_test_channel_001: WARNING
e \modules\PythonScript\script_wrapper.cpp:15   OK - Test successfull: simple warning
d    ..\..\..\trunk\service\NSClient++.cpp:1021 Injecting: _pytest_test_channel_001...
d    ..\..\..\trunk\service\NSClient++.cpp:1051 Result _pytest_test_channel_001: CRITICAL
e \modules\PythonScript\script_wrapper.cpp:15   OK - Test successfull: simple critical
d    ..\..\..\trunk\service\NSClient++.cpp:1021 Injecting: _pytest_test_channel_001...
d    ..\..\..\trunk\service\NSClient++.cpp:1051 Result _pytest_test_channel_001: WARNING
e \modules\PythonScript\script_wrapper.cpp:15   OK - Test successfull: simple unknown
d    ..\..\..\trunk\service\NSClient++.cpp:1021 Injecting: _pytest_test_channel_001...
d    ..\..\..\trunk\service\NSClient++.cpp:1051 Result _pytest_test_channel_001: OK
e \modules\PythonScript\script_wrapper.cpp:15   OK - Test successfull: simple performance data 001
d    ..\..\..\trunk\service\NSClient++.cpp:1021 Injecting: _pytest_test_channel_001...
d    ..\..\..\trunk\service\NSClient++.cpp:1051 Result _pytest_test_channel_001: OK
e \modules\PythonScript\script_wrapper.cpp:15   FAILED - Test did not get the correct retuirn code: 'foo'=5% = 'foo'=5%;10
d    ..\..\..\trunk\service\NSClient++.cpp:1021 Injecting: _pytest_test_channel_001...
d    ..\..\..\trunk\service\NSClient++.cpp:1051 Result _pytest_test_channel_001: OK
e \modules\PythonScript\script_wrapper.cpp:15   OK - Test successfull: simple performance data 003
d    ..\..\..\trunk\service\NSClient++.cpp:1021 Injecting: _pytest_test_channel_001...
d    ..\..\..\trunk\service\NSClient++.cpp:1051 Result _pytest_test_channel_001: OK
e \modules\PythonScript\script_wrapper.cpp:15   OK - Test successfull: simple performance data 004
d    ..\..\..\trunk\service\NSClient++.cpp:1021 Injecting: _pytest_test_channel_001...
d    ..\..\..\trunk\service\NSClient++.cpp:1051 Result _pytest_test_channel_001: OK
e \modules\PythonScript\script_wrapper.cpp:15   OK - Test successfull: simple performance data 005
e \modules\PythonScript\script_wrapper.cpp:15   ERROR: 1 tests failed
e \modules\PythonScript\script_wrapper.cpp:15   Tested Testing that channels work (1 of 9)
d    ..\..\..\trunk\service\NSClient++.cpp:1021 Injecting: _pytest_test_command_001...
d    ..\..\..\trunk\service\NSClient++.cpp:1051 Result _pytest_test_command_001: OK
e \modules\PythonScript\script_wrapper.cpp:15   OK - Test successfull: simple check
d    ..\..\..\trunk\service\NSClient++.cpp:1021 Injecting: _pytest_test_command_001...
d    ..\..\..\trunk\service\NSClient++.cpp:1051 Result _pytest_test_command_001: OK
e \modules\PythonScript\script_wrapper.cpp:15   OK - Test successfull: simple check: Ok
d    ..\..\..\trunk\service\NSClient++.cpp:1021 Injecting: _pytest_test_command_001...
d    ..\..\..\trunk\service\NSClient++.cpp:1051 Result _pytest_test_command_001: WARNING
e \modules\PythonScript\script_wrapper.cpp:15   OK - Test successfull: simple check: Warn
d    ..\..\..\trunk\service\NSClient++.cpp:1021 Injecting: _pytest_test_command_001...
d    ..\..\..\trunk\service\NSClient++.cpp:1051 Result _pytest_test_command_001: WARNING
e \modules\PythonScript\script_wrapper.cpp:15   OK - Test successfull: simple check: Unknown
d    ..\..\..\trunk\service\NSClient++.cpp:1021 Injecting: _pytest_test_command_001...
d    ..\..\..\trunk\service\NSClient++.cpp:1051 Result _pytest_test_command_001: CRITICAL
e \modules\PythonScript\script_wrapper.cpp:15   OK - Test successfull: simple check: Crit
e \modules\PythonScript\script_wrapper.cpp:15   OK: all tests successfull
e \modules\PythonScript\script_wrapper.cpp:15   Tested Testing that channels work (0 of 9)
d    ..\..\..\trunk\service\NSClient++.cpp:1051 Result pytest_test: CRITICAL
l rce\nscp\trunk\service\simple_client.hpp:12   CRITICAL:Tests failed 1 of 18

This is a big chunk of output and unfortunetly we get a lot of debug output here as well, some day I shall improve this to list all relevant output at the end. But the interesting tidbits (cleaned up below)

pytest_test
e \modules\PythonScript\script_wrapper.cpp:15   OK - Test successfull: simple ok
e \modules\PythonScript\script_wrapper.cpp:15   OK - Test successfull: simple warning
e \modules\PythonScript\script_wrapper.cpp:15   OK - Test successfull: simple critical
e \modules\PythonScript\script_wrapper.cpp:15   OK - Test successfull: simple unknown
e \modules\PythonScript\script_wrapper.cpp:15   OK - Test successfull: simple performance data 001
e \modules\PythonScript\script_wrapper.cpp:15   FAILED - Test did not get the correct retuirn code: 'foo'=5% = 'foo'=5%;10
e \modules\PythonScript\script_wrapper.cpp:15   OK - Test successfull: simple performance data 003
e \modules\PythonScript\script_wrapper.cpp:15   OK - Test successfull: simple performance data 004
e \modules\PythonScript\script_wrapper.cpp:15   OK - Test successfull: simple performance data 005
e \modules\PythonScript\script_wrapper.cpp:15   ERROR: 1 tests failed
e \modules\PythonScript\script_wrapper.cpp:15   Tested Testing that channels work (1 of 9)
e \modules\PythonScript\script_wrapper.cpp:15   OK - Test successfull: simple check
e \modules\PythonScript\script_wrapper.cpp:15   OK - Test successfull: simple check: Ok
e \modules\PythonScript\script_wrapper.cpp:15   OK - Test successfull: simple check: Warn
e \modules\PythonScript\script_wrapper.cpp:15   OK - Test successfull: simple check: Unknown
e \modules\PythonScript\script_wrapper.cpp:15   OK - Test successfull: simple check: Crit
e \modules\PythonScript\script_wrapper.cpp:15   OK: all tests successfull
e \modules\PythonScript\script_wrapper.cpp:15   Tested Testing that channels work (0 of 9)
l rce\nscp\trunk\service\simple_client.hpp:12   CRITICAL:Tests failed 1 of 18

And as we can see all tests but one succeeded and that is a but I shall fix at some point. When you only have a warning threshold and no critical threshold the warning one is discarded in the parser.

Now the cool thing is that this all work the same from linux... and with the right setup and some tinkering... remotely... pretty cool huh?

Michael Medin

0.3.9 (re)Release: take 2

I have fixed two issues in the 0.3.9 release and update the binaries. They are also on their way to sourceforge so soon you can download them from there as well.

Changelog:

2011-09-02 MickeM - 0.3.9 take 2
 * Fixed issue with CheckFile and filtering on times and dates
 * Fixed issue with check_battery
 * Added breakpad support to /about

Michael Medin

New nightly 0.4.0 build as well some som information on distributed monitoring

First off Linux seems to be doing great most features just works and thus far I am pretty impressed with the "portability". I have written a page on how to build on Linux if you want to try it out for your self build/04x/linux.

The new nightly has a lot of new features as well an updated installer with I hope works better. If you have upgraded previously from 0.3.9 I would recommend downgrading/upgrading again as you will most likely have a broken setup. (or you can just upgrade again removing any boot.ini / nsclient.ini fille you may have).

Main highlight is the PythonModule? which now supports many advanced features of NSClient++ (see the included script) as well as some new remote WMI stuff. As I have said before (I hope) one of the main new features of 0.4.x is the distribution so I have started to implement that now and one step there is the new remote WMI checking thingy.

The new remote checking features works like this. First you configure a remote host:

[/settings/targets]
my_test_xp_vm=

[/settings/targets/my_test_xp_vm]
hostname=192.168.0.123
username=\\foobar
password=foobar
protocol=none

Then the idea is that you can run checks on "this host" which will transparently be transported to the other host. Now since NRPE does not support this (natively) we have to fake this using an argument like so:

CheckWMI target=my_test_xp MaxCrit=3 MinWarn=1 "Query:load=Select * from win32_Processor"

But the idea is that in the future you can just do:

nscp_client --target my_test_xp --command CheckWMI  ... 

And this will happen magically using the internal routing (regardless of how nsclient++ needs to do it).

For instance the idea is that the following should be "magically":

<master node> -{NRPE}-> <main emea node> -{SSH}-> <nordics node> -{NSCP}-> <local agent> -{WMI}-> <target>

But this is pretty far down the line so dont expect anything next few days :P

Michael Medin

Linux love!

Yaaay...

mickem@kubuntu-VirtualBox:/mnt/nscp/build/linux$ ./nscp --test
l   /mnt/nscp/trunk/service/NSClient++.cpp:553  Attempting to start
d ttings_manager/settings_manager_impl.cpp:156  No entries found looking in (adding default): /mnt/nscp/build/linux/boot.ini
d ttings_manager/settings_manager_impl.cpp:165  Boot order: old://${exe-path}/nsc.ini, ini://${shared-path}/nsclient.ini
d ttings_manager/settings_manager_impl.cpp:168  Activating: ini://${shared-path}/nsclient.ini
d ttings_manager/settings_manager_impl.cpp:68   Creating instance for: ini://${shared-path}//nsclient.ini
d /trunk/include/settings/settings_ini.hpp:254  Reading INI settings from: /mnt/nscp/build/linux/nsclient.ini
d /trunk/include/settings/settings_ini.hpp:228  Loading: /mnt/nscp/build/linux/nsclient.ini from ini://${shared-path}/nsclient.ini
l   /mnt/nscp/trunk/service/NSClient++.cpp:558  Booted settings subsystem...
e   /mnt/nscp/trunk/service/NSClient++.cpp:641  Warning Not compiled with google breakpad support!
d   /mnt/nscp/trunk/service/NSClient++.cpp:410  Found: PythonScript as 
d   /mnt/nscp/trunk/service/NSClient++.cpp:702  Processing plugin: libPythonScript.so as 
d   /mnt/nscp/trunk/service/NSClient++.cpp:986  addPlugin(/mnt/nscp/build/linux/modules/libPythonScript.so as )
d   /mnt/nscp/trunk/service/NSClient++.cpp:962  Loading plugin: PythonScript...
d nk/modules/PythonScript/PythonScript.cpp:187  Looking for: q
d nk/modules/PythonScript/PythonScript.cpp:187  Looking for: /mnt/nscp/build/linux/scripts/python/q
d nk/modules/PythonScript/PythonScript.cpp:187  Looking for: /mnt/nscp/build/linux/scripts/q
d nk/modules/PythonScript/PythonScript.cpp:187  Looking for: /mnt/nscp/build/linux/python/q
d nk/modules/PythonScript/PythonScript.cpp:187  Looking for: /mnt/nscp/build/linux/q
e nk/modules/PythonScript/PythonScript.cpp:191  Script not found: q
d nk/modules/PythonScript/PythonScript.cpp:187  Looking for: test.py
d nk/modules/PythonScript/PythonScript.cpp:187  Looking for: /mnt/nscp/build/linux/scripts/python/test.py
d nk/modules/PythonScript/PythonScript.cpp:205  Adding script: py (/mnt/nscp/build/linux/scripts/python/test.py)
e /modules/PythonScript/script_wrapper.cpp:12   Hello World
e /modules/PythonScript/script_wrapper.cpp:12   Got it: 
e /modules/PythonScript/script_wrapper.cpp:12   Testing to register a function
l /modules/PythonScript/script_wrapper.cpp:27   Added simple command: py_test to list of: py_test
l /modules/PythonScript/script_wrapper.cpp:27   Added simple command: py_normal to list of: py_normal, py_test
l /modules/PythonScript/script_wrapper.cpp:27   Added simple command: py_nop to list of: py_nop, py_normal, py_test
l /modules/PythonScript/script_wrapper.cpp:27   Added simple command: py_nom to list of: py_nom, py_nop, py_normal, py_test
l /modules/PythonScript/script_wrapper.cpp:27   Added simple command: py_nor to list of: py_nom, py_nop, py_nor, py_normal, py_test
e /modules/PythonScript/script_wrapper.cpp:12   Testing to register settings keys
e /modules/PythonScript/script_wrapper.cpp:12   Testing to get key (nonexistant): 4
e /modules/PythonScript/script_wrapper.cpp:12   Testing to get it (after setting it): 4
e /modules/PythonScript/script_wrapper.cpp:12   Saving configuration...
d   /mnt/nscp/trunk/service/NSClient++.cpp:727  NSClient++ - 0,4,0,83 2011-08-07 Started!
l mnt/nscp/trunk/service/simple_client.hpp:26   Enter command to inject or exit to terminate...
py_test
d   /mnt/nscp/trunk/service/NSClient++.cpp:1106 Injecting: py_test...
e /modules/PythonScript/script_wrapper.cpp:12   inside test
d   /mnt/nscp/trunk/service/NSClient++.cpp:1106 Injecting: py_normal...
e /modules/PythonScript/script_wrapper.cpp:12   inside normal
d   /mnt/nscp/trunk/service/NSClient++.cpp:1136 Result py_normal: OK
d   /mnt/nscp/trunk/service/NSClient++.cpp:1106 Injecting: py_normal...
e /modules/PythonScript/script_wrapper.cpp:12   inside normal
e /modules/PythonScript/script_wrapper.cpp:12    | Got argument: hello
d   /mnt/nscp/trunk/service/NSClient++.cpp:1136 Result py_normal: OK
d   /mnt/nscp/trunk/service/NSClient++.cpp:1106 Injecting: py_normal...
e /modules/PythonScript/script_wrapper.cpp:12   inside normal
e /modules/PythonScript/script_wrapper.cpp:12    | Got argument: hello
e /modules/PythonScript/script_wrapper.cpp:12    | Got argument: world
d   /mnt/nscp/trunk/service/NSClient++.cpp:1136 Result py_normal: OK
d   /mnt/nscp/trunk/service/NSClient++.cpp:1136 Result py_test: OK
l mnt/nscp/trunk/service/simple_client.hpp:12   OK:Tests ok
exit
l mnt/nscp/trunk/service/simple_client.hpp:12   Exiting...
d   /mnt/nscp/trunk/service/NSClient++.cpp:763  Attempting to stop
d   /mnt/nscp/trunk/service/NSClient++.cpp:766  Stopping: NON Message Handling Plugins
d   /mnt/nscp/trunk/service/NSClient++.cpp:916  Unloading plugin: PythonScript...
e /modules/PythonScript/script_wrapper.cpp:12   Unloading script...
d   /mnt/nscp/trunk/service/NSClient++.cpp:794  Stopping: Settings instance
d   /mnt/nscp/trunk/service/NSClient++.cpp:818  Stopping: Message handling Plugins
d   /mnt/nscp/trunk/service/NSClient++.cpp:916  Unloading plugin: PythonScript...
l   /mnt/nscp/trunk/service/NSClient++.cpp:826  Stopped succcessfully
mickem@kubuntu-VirtualBox:/mnt/nscp/build/linux$ uname -a
Linux kubuntu-VirtualBox 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:24 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux
mickem@kubuntu-VirtualBox:/mnt/nscp/build/linux$ 

A few issues here and there but at least the python script module is working on Linux :P Tomorrow I am gonna see if I can get NRPE and such up as well... Then I guess it is time to get some third party feedback

UPDATE: NRPE is also working actually:

mickem@kubuntu-VirtualBox:/mnt/nscp/build/linux$ /usr/lib/nagios/plugins/check_nrpe -H localhost -c py_test
Tests ok

Soo... maybe I shall writeup a guide on how to build it?

Michael Medin

  • Posted: 2011-08-10 14:54 (Updated: 2011-08-10 16:04)
  • Categories: 0.4.0 linux
  • Comments (0)

Nagios World Conferance

I will be speaking at Nagios world conference letting you all know whats new in the 0.3.9 version as well as latest news from the 0.4.0 version as well as the usual introduction to windows monitoring. I will also in addition to this give a short workshop on how to write scripts for monitoring windows machines including the all new Python options in 0.4.0.

For details on the Nagios World conference please visit:  http://go.nagios.com/conference

Michael Medin

Nightly build with python script module

The first nightly build witch includes the PythonScript? module is out. The module has support for most things but still lacks some of the new features of 0.4.x such as channels but that will be added in the near future. I am linking this with python 2.7 which needs to be installed for it to work but I am unsure which versions of python are supported but hopefully a few more (but not I guess 3.0 as it is a "new" version). This is pretty new for me so please let me know anything that does not work in regards to linking and platforms and such. Also note that the x64 versions requires x64 version of python.

Scripts are loaded in the following order:

  1. absolute path
  2. ./scripts/python
  3. ./scripts

So it makes sense to put all python script inside the python folder. The sample script (found inside scripts/python) which looks like this (subject to change):

from NSCP import Settings, Functions, Core, log, status

core = Core.get()

def test(arguments):
	log('inside test')
	for a in arguments:
		log('Got argument: %s'%a)
	(retcode, msg, perf) = core.simple_query("normal", [])
	if msg != "ok got: ":
		return (status.CRITICAL, "Test failed")
	(retcode, msg, perf) = core.simple_query("normal", ["hello"])
	if msg != "ok got: hello":
		return (status.CRITICAL, "Test failed")
	(retcode, msg, perf) = core.simple_query("normal", ["hello", "world"])
	if perf != "'args'=2":
		return (status.CRITICAL, "Test failed: -%s-"%perf)
	return (status.OK, 'Tests ok')

def normal(arguments):
	log('inside normal')
	for a in arguments:
		log(' | Got argument: %s'%a)
	if arguments:
		return (status.OK, 'ok got: %s'%arguments[0], "args=%d; "%len(arguments))
	return (status.OK, 'ok got: ', "args=%d; "%len(arguments))
	
def no_perf(arguments):
	log('inside no_perf')
	for a in arguments:
		log('Got argument: %s'%a)
	return (status.WARNING, 'I am ok')

def no_msg(arguments):
	log('inside no_perf')
	for a in arguments:
		log('Got argument: %s'%a)
	return (1)

def no_ret(arguments):
	log('inside no_perf')
	for a in arguments:
		log('Got argument: %s'%a)
	
def init(alias):
	prefix = 'py_'
	if alias:
		prefix = '%s_'%alias

	log('Hello World')

	conf = Settings.get()
	val = conf.get_string('/modules', 'PythonScript', 'foo')

	log('Got it: %s'%val)
	
	log('Testing to register a function')
	fun = Functions.get()
	fun.register_simple('%stest'%prefix, test, 'This is a sample command')
	fun.register_simple('%snormal'%prefix, normal, 'This is a sample command')
	fun.register_simple('%snop'%prefix, no_perf, 'No performance data')
	fun.register_simple('%snom'%prefix, no_msg, 'No performance data')
	fun.register_simple('%snor'%prefix, no_ret, 'No performance data')

	log('Testing to register settings keys')
	conf.register_path('hello', 'PYTHON SETTINGS', 'This is stuff for python')
	conf.register_key('hello', 'python', 'int', 'KEY', 'This is a key', '42')

	log('Testing to get key (nonexistant): %d' % conf.get_int('hello', 'python', -1))
	conf.set_int('hello', 'python', 4)
	log('Testing to get it (after setting it): %d' % conf.get_int('hello', 'python', -1))

	log('Saving configuration...')
	conf.save()

def shutdown():
	log('Unloading script...')

Necessary configuration to load the sample script:

[/modules]
; PythonScript - PythonScript...
PythonScript=

; A list of scripts available to run from the PythonScript module.
[/settings/python/scripts]
py2=test.py

So as you can see it supports settings (getting/setting/writing) as well as "running other commands" and exposing commands. The main benefit to using python scripts over "normal python scripts" are that they better integrate with other aspects of NSCP.

Michael Medin

  • Posted: 2011-08-08 06:55
  • Categories: (none)
  • Comments (0)

Python scripting!

Hello just a quick status update.

I have been working on the python scripting module last few days and it is starting to come together now so with a bit of luck it will be out in alfa early next week..

Currently my test script looks like this:

from NSCP import Settings, Functions, log
log('Hello World')

conf = Settings.get()
val = conf.get_string('/modules', 'PythonScript', 'foo')

log('Got it: %s'%val)

def test(foox):
	log('inside proc: %s'%foox)

log('Testing to register a function')
fun = Functions.get()
fun.register_simple('py', test, 'This is a sample command')

log('Testing to register settings keys')
conf.register_path('hello', 'PYTHON SETTINGS', 'THis is stuff for python')
conf.register_key('hello', 'python', 'int', 'KEY', 'This is a key', '42')

log('Testing to get key (nonexistant): %d' % conf.get_int('hello', 'python', -1))
conf.set_int('hello', 'python', 4)
log('Testing to get it (after setting it): %d' % conf.get_int('hello', 'python', -1))

log('Saving configuration...')
conf.save()

And the result:

...
d    ..\..\..\trunk\service\NSClient++.cpp:952  Loading plugin: PythonScript...
e nk\modules\PythonScript\PythonScript.cpp:181  Hello World
e nk\modules\PythonScript\PythonScript.cpp:181  Got it: alias
e nk\modules\PythonScript\PythonScript.cpp:181  Testing to register a function
e nk\modules\PythonScript\PythonScript.cpp:181  Testing to register settings keys
e nk\modules\PythonScript\PythonScript.cpp:181  Testing to get key (nonexistant): -1
e nk\modules\PythonScript\PythonScript.cpp:181  Testing to get it (after setting it): 4
e nk\modules\PythonScript\PythonScript.cpp:181  Saving configuration...
d    ..\..\..\trunk\service\NSClient++.cpp:717  NSClient++ - 0,4,0,77 2011-07-06 Started!
l rce\nscp\trunk\service\simple_client.hpp:26   Enter command to inject or exit to terminate...
commands
l rce\nscp\trunk\service\simple_client.hpp:12   Commands:
l rce\nscp\trunk\service\simple_client.hpp:12   | py: This is a sample command
py
d    ..\..\..\trunk\service\NSClient++.cpp:1096 Injecting: py...
e nk\modules\PythonScript\PythonScript.cpp:181  inside proc: py
d    ..\..\..\trunk\service\NSClient++.cpp:1126 Result py: OK
l rce\nscp\trunk\service\simple_client.hpp:12   OK:
...

The resulting settings file looks like this:

...

; THis is stuff for python
[hello]

; KEY - This is a key
python=4
...

So it is looking pretty nice I think. Next thing is to create proper function bindings so you can actually create monitoring scripts using python.

Michael Medin