NSClient++ in the new millenium! (re)Discovering NSClient++ Name: Michael Medin (@mickem) Email: michael@medin.name Blog: http://blog.medin.name Project: NSClient++ Web: http://nsclient.org Hello my name is Michael Medin. I am from Stockholm, Sweden NSClient++: I am here to talk about NSClient++ (as always) but NOT about Windows (so much) this time Different: For those of you who have seen me before (Means I will screw up more) Questions: Any questions: feel free to chime in at any time • ∘
No disclaimer this year… Still your fault though!
Michael Medin dev not ops worked in ops a long time ago by misstake Always been a fan of DEVOPS Work with soa work with “soa” not, C/C++, nagios, icinga, …
No agenda this year either…
About NSClient++ (the program) linux and windows <0.4.0 Since 2003? Open source Open source not open core 0.4.0: 2012-05-xx modular (pluggable) Written in C++ Since 2003 Windows (pre 0.4.0) Linux and Windows Modular Open source (not core) 0.4.0 (may) 0.4.1 (October) 0.4.2 (next year) Releases every year (in the past) .0 and .1 (same same) .2 and .3 (same same) 0.4.1 is the new stable, means 0.4.0 is legacy, 0.3.9: Time to move on: QUEUE Comic 0.4.1: 2012-10-xx 0.4.2: 2013-02-xx?
About NSClient++ (the project) one-man-band no company , no commercial version , no payed time Please don’t be angry! but… sponsoring! = feedback donations! One man band Don’t be angry If I missed your comment … it was because I forgot not because I hate you support?
NSClient++ (What can I do?) Update the wiki! Fork me on github Respond in the forums… Submit patches Submit bug reports Update wiki Use the forums Submit patches Fork on github Report bugs Come with ideas Tell me what you need Come with ideas Tell me what you need! • ∘
NSClient++ (What’s new) Sockets: ipv6, ssl (true) Protocols: NRPE, NSCA, NRDP, check_mk, check_nt, Graphite, syslog, smtp Real-time checks (eventlog, logfiles) Whats new? Sockets Protocols Realtime checks Command line syntax Command line syntax ∘ •
Thank you! Thank you to my sponsors
More then a 1000 words? The logo: Windows ∘ •
…for windows… ∘ • but it runs on linux …time for a new logo? Probably! By ~Nac-Mac-Feegle but it runs on linux …time for a new logo? …for windows… Probably! Runs on Linux • ∘
Building on Linux ∘ • apt-get install … git clone git://github.com/mickem/nscp.git mkdir build ; cd build cmake ../nscp apt-get install git clone mkdir build cmake make make • ∘
Building on windows… ∘ • Get visual studio (express), python and cmake Download unpack nscp source python nscp\build\python\fetchdeps.py --target x64 --cmake-config dist Manually install visual studio, python, cmake git clone (or download source) Build all dependencies cmake msbuild cmake ../nscp msbuild /p:Configuration=RelWithDebInfo NSCP.sln • ∘
More then a 1000 words? • ∘ The logo: Daemon And this is stretching it a bit but I liked the logo transition concept ∘ •
…daemon ∘ • let me work let nagios/icinga/* rest passive monitoring? Tobias Leeger let me work …daemon let nagios/icinga/* rest passive monitoring? NO! event based monitoring? real-time monitoring? Distribute your monitoring load (less strain on central server) Luleå story Would you want your doctor to call you every 5 minutes asking if you are ok? The right way to do monitoring? simplified monitoring? preventive monitoring? • ∘
More then a 1000 words? The logo: Secure ∘ •
Secure monitoring ∘ • Check_nt: no encryption! Check_nrpe: no authentication, encryption? Check_nsca: no (strong) authentication! Check_mk: no authentication, no encryption! Problems => Solutions Not supported in the various clients though Check_nrdp: No ecryption (in nsclient++) Check_nscp: Encryption! Authentication! • ∘
Secure monitoring • ∘ Check_nt: Encryption! Authentication! Check_nrpe: Encryption! Authentication! Check_nsca: Encryption! Authentication! Check_mk: Encryption! Authentication! Problems => Solutions Not supported in the various clients though Check_nrdp: No ecryption (Yet!) Check_nscp: Encryption! Authentication! ∘ •
Security ∘ • Strong encryption Ssl (standard) Certificates Certificate based authentication Client AND(or) server Standard SSL solution …but you never know… Remember clients usually do not support it Secure? I hope so… • ∘
∘ • Secure? I hope so… But you never know… Standard SSL solution Remember clients usually do not support it Secure? I hope so… But you never know… • ∘
DEMO: Using NSClient++ Time to get real… DEMO: Using NSClient++ Time to make a fool of my self • ∘
General usage nscp Display all(?) available context nscp --help Get help (can be used in many places) nscp <context or alias> [options] [-- [module options]] General usage syntax
Contexts help Get help client Act as a client. (think check_nrpe) Usually aliases we can use instead. service (un)Install and display windows service settings Work with configuration test Find errors and problems unit Run unit test scripts
Aliases lua Run lua scripts python Run python scripts nrpe Think check_nrpe nsca Think send_nsca sys Nice pdh front-end (more to come) wmi WMI front end eventlog Add event log message from command line
Settings (Configuration) nscp settings --help nscp settings --add-missing --generate [--load-all] Will update your configuration with ALL keys nscp settings --add-missing --activate-module <module> Great way to "enable a new module“ nscp settings --remove-defaults --generate Will remove all default keys/sections nscp settings --validate Show problems with the settings file Remember there is no "--delete-missing“ (yet)
check_nrpe nscp nrpe -- --help The -- is important nscp nrpe -- -H 127.0.0.1 -c foo -a foo bar Execute nrpe query from nsclient++ 0.4.2 will introduce: nrpe_client -H 127.0.0.1 -c foo -a foo bar nsca_client … …_client … Time for demo rm nsclient.ini ./nscp settings --activate-module NRPEServer --add-defaults vi nsclient.ini # change port ./nscp settings --remove-defaults --generate #add foo=bar ./nscp settings --validate
DEMO: real-time log file monitoring Time to get real… DEMO: real-time log file monitoring More demos (this time for real) • ∘
Modules CheckLogFile Subscribes to filechanges SimpleFileWriter Write notifications to file NSCAClient Submit NSCA messages ./nscp settings --activate-module CheckLogFile --add-defaults vi nsclient.ini # file=./test.txt # filter=column1 like ‘hello’ # warning = column2 like ‘warn’ # critical = column2 like ‘crit’ # destination = FILE ./nscp settings --activate-module SimpleFileWriter ./nscp test echo –e “hello\tworld” echo –e “hello\tcrit” ./nscp settings --activate-module NSCAClient # encryption = xor # password = secret ./nscp settings –generate --remove-defaults NSCP NSCA NSCAClient CheckLogFile FILE SimpleFileWriter
Resulting config from DEMO [/modules] CheckLogFile = enabled SimpleFileWriter = enabled [/settings/logfile/real-time/checks/sample] critical = column2 like 'crit' destination = FILE file = ./test.txt filter = column1 like 'hello' warning = column2 like 'warn' [/settings/logfile/real-time] enabled = true
Resulting config from DEMO [/modules] CheckLogFile = enabled NSCAClient = enabled SimpleFileWriter = enabled [/settings/logfile/real-time/checks/sample] critical = column2 like 'crit' destination = FILE,NSCA file = ./test.txt filter = column1 like 'hello' warning = column2 like 'warn' [/settings/logfile/real-time] enabled = true [/settings/NSCA/client/targets/default] address = 127.0.0.1 encryption = xor password = secret
Run the following ./nscp test tail –f ./output.txt echo –e “hello\tworld” echo –e “hello\twarn” echo –e “hello\tcrit”
DEMO: real-time log file monitoring… Time to get real… DEMO: real-time log file monitoring… …via NRPE? After all these mistakes…yet more demos? • ∘
Modules CheckLogFile Subscribes to filechanges SimpleCache Store our result NRPEClient Accept remote checks (if there is time) NRPEServer NSCP CheckLogFile CACHE SimpleCache
Resulting config from DEMO [/modules] CheckLogFile = enabled NSCAClient = enabled SimpleFileWriter = enabled SimleCache = enabled [/settings/logfile/real-time/checks/sample] critical = column2 like 'crit' destination = FILE,NSCA,CACHE file = ./test.txt filter = column1 like 'hello' warning = column2 like 'warn' [/settings/logfile/real-time] enabled = true [/settings/NSCA/client/targets/default] address = 127.0.0.1 encryption = xor password = secret
Run the following ./nscp test echo –e “hello\tworld” echo –e “hello\twarn” echo –e “hello\tcrit” In nsclient console execute: check_cache index=sample
Photo by Olga Berrios Questions? Q&A
facebook.com/nsclient Thank You! Michael Medin michael@medin.name http://www. .com/in/mickem http://blog.medin.name/ Information about NSClient++ http://nsclient.org facebook.com/nsclient Slides, and examples http://nsclient.org/nscp/conferances/osmc/2012/ The end!