SlideShare a Scribd company logo
Scripting...…on the Windows side
These slides represent the work and opinions of the author and do not constitute official positions of any organization sponsoring the author’s work This material has not been peer reviewed and is presented here as-is with the permission of the author.The author assumes no liability for any content or opinion expressed in this presentation and or use of content herein.Disclaimer!It is not their fault!It is not my fault!It is your fault!
External ScriptsInternal ScriptsArgumentsScripting: Batch filesWrapped scriptsScripting: VBAInternal ScriptsAgenda
Windows monitoringNSClient++ (from a scripters perspecitve)
External ScriptsThe normal kind of scriptsCan be written in:BatchVBA/VBScript (pretty popular on Windows)Powershell (a rather strange language)But also:Perl, python, bash, etc etc…Internal ScriptsCan interact with (other) internal commandsCan access settingsCan hold stateCan be written in:LuaPython (requires python on the machine)Two kinds of scripts
Enable the check module[/modules]CheckExternalScripts=	# Runs the scriptNRPEServer=			# NRPE serverEach script requires a definition[/settings/External Scripts]check_es_test=scripts\test.batOptions disabled by default (for a reason)allow arguments = falseallow nasty characters = falseConfiguring External Scripts
Enable the check module[/modules]LUAScript=PythonScript=Each script requires a definition[/settings/LUA/Scripts]<alias>=test.lua[/settings/python/Scripts]<alias>=test.pyScripts requires NRPE/NSCA (or NSCP)[/modules]NRPEServer=Configuring Internal Scripts
Can be configured in many placesIs probably more confusing then it is worthThe server moduleMeans NO commands can have argumentsThe script moduleMeans NO external script can have argumentsAllow arguments
Allow arguments
Writing our first ScriptsThe first batch script
Output:Use: echo <text>Don’t forget @echo off (or all commands will be echoed)Exit statuses:Use: exit <code>0 = OK1 = Warning2 = Critical3 = UnknownNSC.ini syntax:[/settings/External Scripts/scripts]my_script=scripts\script.batReference:http://www.ss64.com/nt/Don’t let preconceptions fool you: batch can actually do a lot!Writing a Script (Batch)
@echo offecho CRITICAL: Everything is not going to be fineexit 2A basic script (batch)
…\NSClient++\scripts>cmd /ctest.batCRITICAL: Everything is not going to be fine…\NSClient++\scripts>echo %ERRORLEVEL%2Running from Command Line
D:\demo>nscp --testNSClient++ 0,4,0,98 2011-09-06 x64 booting...Boot.ini found in: D:/demo//boot.iniBoot order: ini://${shared-path}/nsclient.ini, old://${exe-path}/nsc.iniActivating: ini://${shared-path}/nsclient.iniCreating instance for: ini://${shared-path}:80/nsclient.iniReading INI settings from: D:/demo//nsclient.iniLoading: D:/demo//nsclient.ini from ini://${shared-path}/nsclient.iniBooted settings subsystem...On crash: restart: NSClientppArchiving crash dumps in: D:/demo//crash-dumpsbooting::loading pluginsFound: CheckExternalScripts asProcessing plugin: CheckExternalScripts.dll asaddPlugin(D:/demo//modules/CheckExternalScripts.dll as )Loading plugin: Check External Scripts asNSClient++ - 0,4,0,98 2011-09-06 Started!Enter command to inject or exit to terminate...Running from NSClient
Enter command to inject or exit to terminate...my_scriptsInjecting: my_script...Arguments:Result my_script: WARNINGWARNING:Hello WorldRunning from NSClientCommandReturn StatusReturn Message
DemoWriting our first Scripts
Writing our first ScriptsKilling notepad once and or all!
TASKKILL [/S dator [/U användarnamn [/P lösenord]]]]         { [/FI filter] [/PID process-ID | /IM avbildning] } [/T][/F]Beskrivning:    Det här verktyget används för att avsluta en eller flera aktiviteter    utifrån process-ID (PID) eller avbildningsnamn.Parameterlista:…    /FI   filter           Använder ett filter för att välja aktiviteter.                           Jokertecknet * kan användas, t.ex:imagenameeq note*    /PID  process-ID       Anger process-ID för den process som ska avbrytas.                           Använd kommandot Tasklist för att hämta process-ID    /IM   avbildning       Anger avbildning för den process som                           för den process som ska avslutas. Jokertecknet *                           användas för att ange alla aktiviteter eller                           avbildningar.Killing notepad once and for all!
@echo offtaskkill /im notepad.exe 1>NUL 2>NULIF ERRORLEVEL 128 GOTO errIF ERRORLEVEL 0 GOTO okGOTO unknown:unknownecho UNKNOWN: unknown problem killing notepad...exit /B 3:errecho CRITICAL: Notepad was not killed...exit /B 1:okecho OK: Notepad was killed!exit /B 0KILL!!!
DemoKilling notepad…
Wrapped scriptsInterlude
NSC.ini syntax:[External Scripts]check_bat=scripts\check_test.batOr[Wrapped Scripts]check_test=check_test.batAdding a Script (.bat)
NSC.ini syntax:[External Scripts]check_test=cscript.exe /T:30 /NoLogo scripts\check_test.vbsOr[Wrapped Scripts]check_test=check_test.vbsAdding a Script (.VBS)
NSC.ini syntax:[External Scripts]check_test=cscript.exe /T:30 /NoLogo scripts\lib\wrapper.vbs scripts\check_test.vbsOr[Wrapped Scripts]check_test=check_test.vbsAdding a Script (.VBS) w/ libs
NSC.ini syntax:[External Scripts]check_test=cmd /c echo scripts\check_test.ps1; exit($lastexitcode) | powershell.exe -command -Or[Wrapped Scripts]check_test=check_test.ps1Adding a Script (.PS1)
[…/wrappings]bat=scripts\%SCRIPT% %ARGS%vbs=cscript.exe //T:30 //NoLogo scripts\lib\wrapper.vbs %SCRIPT% %ARGS%ps1=cmd /c echo scripts\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -[…/wrapped scripts]check_test_vbs=check_test.vbs /arg1:1 /variable:1check_test_ps1=check_test.ps1 arg1 arg2check_test_bat=check_test.bat $ARG1$ arg2check_battery=check_battery.vbscheck_printer=check_printer.vbs; So essentially it is a macro! (but a nice one)What is wrapped scripts?
Writing your first ScriptsWriting a simple VB script
Output:Use: Wscript.StdOut.WriteLine <text>Exit statuses:Use: Wscript.Quit(<code>)0 = OK1 = Warning2 = Critical3 = UnknownNSC.ini syntax:[External Scripts]check_vbs=cscript.exe //T:30 //NoLogo scripts\check_vbs.vbs	//T:30 Is the timeout and might need to be changed.Reference:http://msdn.microsoft.com/en-us/library/t0aew7h6(VS.85).aspxWriting a Script (VBS)
wscript.echo ”Hello World"wscript.quit(0)Hello_World.vbs
Set <variable name>=CreateObject(“<COM Object>")There is A LOT of objects you can createA nice way to interact with other applicationsFor instance:Set objWord = CreateObject("Word.Application")objWord.Visible = TrueSet objDoc = objWord.Documents.Add()Set objSelection = objWord.SelectionobjSelection.Font.Name = “Comic Sans MS"objSelection.Font.Size = “28"objSelection.TypeText“Hello World"objSelection.TypeParagraph()objSelection.Font.Size = "14"objSelection.TypeText "" & Date()objSelection.TypeParagraph()Object oriented programming (ish)
Demo:Words…
strFile=”c:\windows”Dim oFSOSet oFSO=CreateObject("Scripting.FileSystemObject")If oFSO.FileExists(strFile) Thenwscript.echo”Yaay!"wscript.quit(0)elsewscript.echo“Whhh… what the f***!"wscript.quit(2)end ifAre we running windows?
Demo:Are we running Windows?
Using the libraryDissecting a VBScript
Can be used to extend NSClient++Are very powerfulA good way to:Alter things you do not likeCreate advanced thingsAre written in Lua or PythonPossibly unsafeRuns inside NSClient++Internal Scripts
Internal scripts are fundamentally differentOne script is NOT equals to one functionA script (at startup) can:Register query (commands) handlersRegister submission (passive checks) handlersRegister exec handlersRegister configurationAccess configurationHandlers can:Execute queries (commands)Submit submissions (passive checks)Etc etc…Anatomy of an internal script
definit(plugin_id, plugin_alias, script_alias):conf = Settings.get()reg = Registry.get(plugin_id)reg.simple_cmdline('help', get_help)reg.simple_function(‘command', cmd, ‘A command…')conf.set_int('hello', 'python', 42)	log(Answer: %d'%conf.get_int('hello','python',-1))def shutdown():	log(“Shutting down…”)A basic script
defget_help(arguments):	return (status.OK, ‘Im not helpful ')def test(arguments):	core = Core.get()count = len(arguments)(retcode, retmessage, retperf) =core.simple_query(‘CHECK_NSCP’, [])return (status.OK, ‘Life is good… %d'%count)A basic script
Questions?Q&A
Michael Medinmichael@medin.namehttp://www.linkedin.com/in/mickemInformation about NSClient++http://nsclient.orgFacebook: facebook.com/nsclientSlides, and exampleshttp://nsclient.org/nscp/conferances/2011/nwcna/Thank You!
Ad

More Related Content

What's hot (19)

ruxc0n 2012
ruxc0n 2012ruxc0n 2012
ruxc0n 2012
mimeframe
 
Javascript TDD with Jasmine, Karma, and Gulp
Javascript TDD with Jasmine, Karma, and GulpJavascript TDD with Jasmine, Karma, and Gulp
Javascript TDD with Jasmine, Karma, and Gulp
All Things Open
 
.NET Debugging Workshop
.NET Debugging Workshop.NET Debugging Workshop
.NET Debugging Workshop
Sasha Goldshtein
 
Integration tests: use the containers, Luke!
Integration tests: use the containers, Luke!Integration tests: use the containers, Luke!
Integration tests: use the containers, Luke!
Roberto Franchini
 
Windows attacks - AT is the new black
Windows attacks - AT is the new blackWindows attacks - AT is the new black
Windows attacks - AT is the new black
Chris Gates
 
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytes
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytesWindows Kernel Exploitation : This Time Font hunt you down in 4 bytes
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytes
Peter Hlavaty
 
Jenkins Evolutions - JEEConf 2012
Jenkins Evolutions - JEEConf 2012Jenkins Evolutions - JEEConf 2012
Jenkins Evolutions - JEEConf 2012
Anton Arhipov
 
Node.js essentials
 Node.js essentials Node.js essentials
Node.js essentials
Bedis ElAchèche
 
Mastering IntelliTrace in Development and Production
Mastering IntelliTrace in Development and ProductionMastering IntelliTrace in Development and Production
Mastering IntelliTrace in Development and Production
Sasha Goldshtein
 
Automated User Tests with Apache Flex
Automated User Tests with Apache FlexAutomated User Tests with Apache Flex
Automated User Tests with Apache Flex
Gert Poppe
 
Introduction to .NET Performance Measurement
Introduction to .NET Performance MeasurementIntroduction to .NET Performance Measurement
Introduction to .NET Performance Measurement
Sasha Goldshtein
 
OrientDB - The 2nd generation of (multi-model) NoSQL
OrientDB - The 2nd generation of  (multi-model) NoSQLOrientDB - The 2nd generation of  (multi-model) NoSQL
OrientDB - The 2nd generation of (multi-model) NoSQL
Roberto Franchini
 
Супер быстрая автоматизация тестирования на iOS
Супер быстрая автоматизация тестирования на iOSСупер быстрая автоматизация тестирования на iOS
Супер быстрая автоматизация тестирования на iOS
SQALab
 
Unit testing patterns for concurrent code
Unit testing patterns for concurrent codeUnit testing patterns for concurrent code
Unit testing patterns for concurrent code
Dror Helper
 
Everything as a code
Everything as a codeEverything as a code
Everything as a code
Aleksandr Tarasov
 
OHHttpStubs
OHHttpStubsOHHttpStubs
OHHttpStubs
CocoaHeads France
 
Bypassing patchguard on Windows 8.1 and Windows 10
Bypassing patchguard on Windows 8.1 and Windows 10Bypassing patchguard on Windows 8.1 and Windows 10
Bypassing patchguard on Windows 8.1 and Windows 10
Honorary_BoT
 
Se lancer dans l'aventure microservices avec Spring Cloud - Julien Roy
Se lancer dans l'aventure microservices avec Spring Cloud - Julien RoySe lancer dans l'aventure microservices avec Spring Cloud - Julien Roy
Se lancer dans l'aventure microservices avec Spring Cloud - Julien Roy
ekino
 
Testing with PostgreSQL
Testing with PostgreSQLTesting with PostgreSQL
Testing with PostgreSQL
Shawn Sorichetti
 
Javascript TDD with Jasmine, Karma, and Gulp
Javascript TDD with Jasmine, Karma, and GulpJavascript TDD with Jasmine, Karma, and Gulp
Javascript TDD with Jasmine, Karma, and Gulp
All Things Open
 
Integration tests: use the containers, Luke!
Integration tests: use the containers, Luke!Integration tests: use the containers, Luke!
Integration tests: use the containers, Luke!
Roberto Franchini
 
Windows attacks - AT is the new black
Windows attacks - AT is the new blackWindows attacks - AT is the new black
Windows attacks - AT is the new black
Chris Gates
 
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytes
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytesWindows Kernel Exploitation : This Time Font hunt you down in 4 bytes
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytes
Peter Hlavaty
 
Jenkins Evolutions - JEEConf 2012
Jenkins Evolutions - JEEConf 2012Jenkins Evolutions - JEEConf 2012
Jenkins Evolutions - JEEConf 2012
Anton Arhipov
 
Mastering IntelliTrace in Development and Production
Mastering IntelliTrace in Development and ProductionMastering IntelliTrace in Development and Production
Mastering IntelliTrace in Development and Production
Sasha Goldshtein
 
Automated User Tests with Apache Flex
Automated User Tests with Apache FlexAutomated User Tests with Apache Flex
Automated User Tests with Apache Flex
Gert Poppe
 
Introduction to .NET Performance Measurement
Introduction to .NET Performance MeasurementIntroduction to .NET Performance Measurement
Introduction to .NET Performance Measurement
Sasha Goldshtein
 
OrientDB - The 2nd generation of (multi-model) NoSQL
OrientDB - The 2nd generation of  (multi-model) NoSQLOrientDB - The 2nd generation of  (multi-model) NoSQL
OrientDB - The 2nd generation of (multi-model) NoSQL
Roberto Franchini
 
Супер быстрая автоматизация тестирования на iOS
Супер быстрая автоматизация тестирования на iOSСупер быстрая автоматизация тестирования на iOS
Супер быстрая автоматизация тестирования на iOS
SQALab
 
Unit testing patterns for concurrent code
Unit testing patterns for concurrent codeUnit testing patterns for concurrent code
Unit testing patterns for concurrent code
Dror Helper
 
Bypassing patchguard on Windows 8.1 and Windows 10
Bypassing patchguard on Windows 8.1 and Windows 10Bypassing patchguard on Windows 8.1 and Windows 10
Bypassing patchguard on Windows 8.1 and Windows 10
Honorary_BoT
 
Se lancer dans l'aventure microservices avec Spring Cloud - Julien Roy
Se lancer dans l'aventure microservices avec Spring Cloud - Julien RoySe lancer dans l'aventure microservices avec Spring Cloud - Julien Roy
Se lancer dans l'aventure microservices avec Spring Cloud - Julien Roy
ekino
 

Viewers also liked (6)

Nagios Conference 2011 - Mike Weber - Training: Monitoring Linux Mail Servers...
Nagios Conference 2011 - Mike Weber - Training: Monitoring Linux Mail Servers...Nagios Conference 2011 - Mike Weber - Training: Monitoring Linux Mail Servers...
Nagios Conference 2011 - Mike Weber - Training: Monitoring Linux Mail Servers...
Nagios
 
Nagios
NagiosNagios
Nagios
Assil Fradi
 
Nagios
NagiosNagios
Nagios
Nick Arancio
 
Nagios Conference 2011 - Jared Bird - Using Nagios As A Security Tool
Nagios Conference 2011 - Jared Bird - Using Nagios As A Security ToolNagios Conference 2011 - Jared Bird - Using Nagios As A Security Tool
Nagios Conference 2011 - Jared Bird - Using Nagios As A Security Tool
Nagios
 
Nagios Conference 2012 - Ethan Galstad - Keynote
Nagios Conference 2012 - Ethan Galstad - KeynoteNagios Conference 2012 - Ethan Galstad - Keynote
Nagios Conference 2012 - Ethan Galstad - Keynote
Nagios
 
Nagios Conference 2011 - Arun Ramanathan - Environment Monitoring With Nagios
Nagios Conference 2011 - Arun Ramanathan - Environment Monitoring With NagiosNagios Conference 2011 - Arun Ramanathan - Environment Monitoring With Nagios
Nagios Conference 2011 - Arun Ramanathan - Environment Monitoring With Nagios
Nagios
 
Nagios Conference 2011 - Mike Weber - Training: Monitoring Linux Mail Servers...
Nagios Conference 2011 - Mike Weber - Training: Monitoring Linux Mail Servers...Nagios Conference 2011 - Mike Weber - Training: Monitoring Linux Mail Servers...
Nagios Conference 2011 - Mike Weber - Training: Monitoring Linux Mail Servers...
Nagios
 
Nagios Conference 2011 - Jared Bird - Using Nagios As A Security Tool
Nagios Conference 2011 - Jared Bird - Using Nagios As A Security ToolNagios Conference 2011 - Jared Bird - Using Nagios As A Security Tool
Nagios Conference 2011 - Jared Bird - Using Nagios As A Security Tool
Nagios
 
Nagios Conference 2012 - Ethan Galstad - Keynote
Nagios Conference 2012 - Ethan Galstad - KeynoteNagios Conference 2012 - Ethan Galstad - Keynote
Nagios Conference 2012 - Ethan Galstad - Keynote
Nagios
 
Nagios Conference 2011 - Arun Ramanathan - Environment Monitoring With Nagios
Nagios Conference 2011 - Arun Ramanathan - Environment Monitoring With NagiosNagios Conference 2011 - Arun Ramanathan - Environment Monitoring With Nagios
Nagios Conference 2011 - Arun Ramanathan - Environment Monitoring With Nagios
Nagios
 
Ad

Similar to Nagios Conference 2011 - Michael Medin - Workshop: Scripting On The Windows Side (20)

A Life of breakpoint
A Life of breakpointA Life of breakpoint
A Life of breakpoint
Hajime Morrita
 
[COSCUP 2021] A trip about how I contribute to LLVM
[COSCUP 2021] A trip about how I contribute to LLVM[COSCUP 2021] A trip about how I contribute to LLVM
[COSCUP 2021] A trip about how I contribute to LLVM
Douglas Chen
 
Node.js debugging
Node.js debuggingNode.js debugging
Node.js debugging
Nicholas McClay
 
.Net Debugging Techniques
.Net Debugging Techniques.Net Debugging Techniques
.Net Debugging Techniques
Bala Subra
 
.NET Debugging Tips and Techniques
.NET Debugging Tips and Techniques.NET Debugging Tips and Techniques
.NET Debugging Tips and Techniques
Bala Subra
 
exploit-writing-tutorial-part-5-how-debugger-modules-plugins-can-speed-up-bas...
exploit-writing-tutorial-part-5-how-debugger-modules-plugins-can-speed-up-bas...exploit-writing-tutorial-part-5-how-debugger-modules-plugins-can-speed-up-bas...
exploit-writing-tutorial-part-5-how-debugger-modules-plugins-can-speed-up-bas...
tutorialsruby
 
exploit-writing-tutorial-part-5-how-debugger-modules-plugins-can-speed-up-bas...
exploit-writing-tutorial-part-5-how-debugger-modules-plugins-can-speed-up-bas...exploit-writing-tutorial-part-5-how-debugger-modules-plugins-can-speed-up-bas...
exploit-writing-tutorial-part-5-how-debugger-modules-plugins-can-speed-up-bas...
tutorialsruby
 
Intro django
Intro djangoIntro django
Intro django
Alexander Lyabah
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)
Soshi Nemoto
 
Valgrind
ValgrindValgrind
Valgrind
aidanshribman
 
lec4.docx
lec4.docxlec4.docx
lec4.docx
ismailaboshatra
 
Shellcoding in linux
Shellcoding in linuxShellcoding in linux
Shellcoding in linux
Ajin Abraham
 
Batch programming and Viruses
Batch programming and VirusesBatch programming and Viruses
Batch programming and Viruses
Akshay Saini
 
How to Design a Great API (using flask) [ploneconf2017]
How to Design a Great API (using flask) [ploneconf2017]How to Design a Great API (using flask) [ploneconf2017]
How to Design a Great API (using flask) [ploneconf2017]
Devon Bernard
 
Batch file programming
Batch file programmingBatch file programming
Batch file programming
swapnil kapate
 
Embedded Recipes 2019 - Testing firmware the devops way
Embedded Recipes 2019 - Testing firmware the devops wayEmbedded Recipes 2019 - Testing firmware the devops way
Embedded Recipes 2019 - Testing firmware the devops way
Anne Nicolas
 
OverviewIn this assignment you will write your own shell i.docx
OverviewIn this assignment you will write your own shell i.docxOverviewIn this assignment you will write your own shell i.docx
OverviewIn this assignment you will write your own shell i.docx
alfred4lewis58146
 
Code quality par Simone Civetta
Code quality par Simone CivettaCode quality par Simone Civetta
Code quality par Simone Civetta
CocoaHeads France
 
Containerize your Blackbox tests
Containerize your Blackbox testsContainerize your Blackbox tests
Containerize your Blackbox tests
Kevin Beeman
 
Lets make better scripts
Lets make better scriptsLets make better scripts
Lets make better scripts
Michael Boelen
 
[COSCUP 2021] A trip about how I contribute to LLVM
[COSCUP 2021] A trip about how I contribute to LLVM[COSCUP 2021] A trip about how I contribute to LLVM
[COSCUP 2021] A trip about how I contribute to LLVM
Douglas Chen
 
.Net Debugging Techniques
.Net Debugging Techniques.Net Debugging Techniques
.Net Debugging Techniques
Bala Subra
 
.NET Debugging Tips and Techniques
.NET Debugging Tips and Techniques.NET Debugging Tips and Techniques
.NET Debugging Tips and Techniques
Bala Subra
 
exploit-writing-tutorial-part-5-how-debugger-modules-plugins-can-speed-up-bas...
exploit-writing-tutorial-part-5-how-debugger-modules-plugins-can-speed-up-bas...exploit-writing-tutorial-part-5-how-debugger-modules-plugins-can-speed-up-bas...
exploit-writing-tutorial-part-5-how-debugger-modules-plugins-can-speed-up-bas...
tutorialsruby
 
exploit-writing-tutorial-part-5-how-debugger-modules-plugins-can-speed-up-bas...
exploit-writing-tutorial-part-5-how-debugger-modules-plugins-can-speed-up-bas...exploit-writing-tutorial-part-5-how-debugger-modules-plugins-can-speed-up-bas...
exploit-writing-tutorial-part-5-how-debugger-modules-plugins-can-speed-up-bas...
tutorialsruby
 
DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)DevOps(4) : Ansible(2) - (MOSG)
DevOps(4) : Ansible(2) - (MOSG)
Soshi Nemoto
 
Shellcoding in linux
Shellcoding in linuxShellcoding in linux
Shellcoding in linux
Ajin Abraham
 
Batch programming and Viruses
Batch programming and VirusesBatch programming and Viruses
Batch programming and Viruses
Akshay Saini
 
How to Design a Great API (using flask) [ploneconf2017]
How to Design a Great API (using flask) [ploneconf2017]How to Design a Great API (using flask) [ploneconf2017]
How to Design a Great API (using flask) [ploneconf2017]
Devon Bernard
 
Batch file programming
Batch file programmingBatch file programming
Batch file programming
swapnil kapate
 
Embedded Recipes 2019 - Testing firmware the devops way
Embedded Recipes 2019 - Testing firmware the devops wayEmbedded Recipes 2019 - Testing firmware the devops way
Embedded Recipes 2019 - Testing firmware the devops way
Anne Nicolas
 
OverviewIn this assignment you will write your own shell i.docx
OverviewIn this assignment you will write your own shell i.docxOverviewIn this assignment you will write your own shell i.docx
OverviewIn this assignment you will write your own shell i.docx
alfred4lewis58146
 
Code quality par Simone Civetta
Code quality par Simone CivettaCode quality par Simone Civetta
Code quality par Simone Civetta
CocoaHeads France
 
Containerize your Blackbox tests
Containerize your Blackbox testsContainerize your Blackbox tests
Containerize your Blackbox tests
Kevin Beeman
 
Lets make better scripts
Lets make better scriptsLets make better scripts
Lets make better scripts
Michael Boelen
 
Ad

More from Nagios (20)

Nagios XI Best Practices
Nagios XI Best PracticesNagios XI Best Practices
Nagios XI Best Practices
Nagios
 
Jesse Olson - Nagios Log Server Architecture Overview
Jesse Olson - Nagios Log Server Architecture OverviewJesse Olson - Nagios Log Server Architecture Overview
Jesse Olson - Nagios Log Server Architecture Overview
Nagios
 
Trevor McDonald - Nagios XI Under The Hood
Trevor McDonald  - Nagios XI Under The HoodTrevor McDonald  - Nagios XI Under The Hood
Trevor McDonald - Nagios XI Under The Hood
Nagios
 
Sean Falzon - Nagios - Resilient Notifications
Sean Falzon - Nagios - Resilient NotificationsSean Falzon - Nagios - Resilient Notifications
Sean Falzon - Nagios - Resilient Notifications
Nagios
 
Marcus Rochelle - Landis+Gyr - Monitoring with Nagios Enterprise Edition
Marcus Rochelle - Landis+Gyr - Monitoring with Nagios Enterprise EditionMarcus Rochelle - Landis+Gyr - Monitoring with Nagios Enterprise Edition
Marcus Rochelle - Landis+Gyr - Monitoring with Nagios Enterprise Edition
Nagios
 
Janice Singh - Writing Custom Nagios Plugins
Janice Singh - Writing Custom Nagios PluginsJanice Singh - Writing Custom Nagios Plugins
Janice Singh - Writing Custom Nagios Plugins
Nagios
 
Dave Williams - Nagios Log Server - Practical Experience
Dave Williams - Nagios Log Server - Practical ExperienceDave Williams - Nagios Log Server - Practical Experience
Dave Williams - Nagios Log Server - Practical Experience
Nagios
 
Mike Weber - Nagios and Group Deployment of Service Checks
Mike Weber - Nagios and Group Deployment of Service ChecksMike Weber - Nagios and Group Deployment of Service Checks
Mike Weber - Nagios and Group Deployment of Service Checks
Nagios
 
Mike Guthrie - Revamping Your 10 Year Old Nagios Installation
Mike Guthrie - Revamping Your 10 Year Old Nagios InstallationMike Guthrie - Revamping Your 10 Year Old Nagios Installation
Mike Guthrie - Revamping Your 10 Year Old Nagios Installation
Nagios
 
Bryan Heden - Agile Networks - Using Nagios XI as the platform for Monitoring...
Bryan Heden - Agile Networks - Using Nagios XI as the platform for Monitoring...Bryan Heden - Agile Networks - Using Nagios XI as the platform for Monitoring...
Bryan Heden - Agile Networks - Using Nagios XI as the platform for Monitoring...
Nagios
 
Matt Bruzek - Monitoring Your Public Cloud With Nagios
Matt Bruzek - Monitoring Your Public Cloud With NagiosMatt Bruzek - Monitoring Your Public Cloud With Nagios
Matt Bruzek - Monitoring Your Public Cloud With Nagios
Nagios
 
Lee Myers - What To Do When Nagios Notification Don't Meet Your Needs.
Lee Myers - What To Do When Nagios Notification Don't Meet Your Needs.Lee Myers - What To Do When Nagios Notification Don't Meet Your Needs.
Lee Myers - What To Do When Nagios Notification Don't Meet Your Needs.
Nagios
 
Eric Loyd - Fractal Nagios
Eric Loyd - Fractal NagiosEric Loyd - Fractal Nagios
Eric Loyd - Fractal Nagios
Nagios
 
Marcelo Perazolo, Lead Software Architect, IBM Corporation - Monitoring a Pow...
Marcelo Perazolo, Lead Software Architect, IBM Corporation - Monitoring a Pow...Marcelo Perazolo, Lead Software Architect, IBM Corporation - Monitoring a Pow...
Marcelo Perazolo, Lead Software Architect, IBM Corporation - Monitoring a Pow...
Nagios
 
Thomas Schmainda - Tracking Boeing Satellites With Nagios - Nagios World Conf...
Thomas Schmainda - Tracking Boeing Satellites With Nagios - Nagios World Conf...Thomas Schmainda - Tracking Boeing Satellites With Nagios - Nagios World Conf...
Thomas Schmainda - Tracking Boeing Satellites With Nagios - Nagios World Conf...
Nagios
 
Nagios World Conference 2015 - Scott Wilkerson Opening
Nagios World Conference 2015 - Scott Wilkerson OpeningNagios World Conference 2015 - Scott Wilkerson Opening
Nagios World Conference 2015 - Scott Wilkerson Opening
Nagios
 
Nrpe - Nagios Remote Plugin Executor. NRPE plugin for Nagios Core
Nrpe - Nagios Remote Plugin Executor. NRPE plugin for Nagios CoreNrpe - Nagios Remote Plugin Executor. NRPE plugin for Nagios Core
Nrpe - Nagios Remote Plugin Executor. NRPE plugin for Nagios Core
Nagios
 
Nagios Log Server - Features
Nagios Log Server - FeaturesNagios Log Server - Features
Nagios Log Server - Features
Nagios
 
Nagios Network Analyzer - Features
Nagios Network Analyzer - FeaturesNagios Network Analyzer - Features
Nagios Network Analyzer - Features
Nagios
 
Nagios Conference 2014 - Dorance Martinez Cortes - Customizing Nagios
Nagios Conference 2014 - Dorance Martinez Cortes - Customizing NagiosNagios Conference 2014 - Dorance Martinez Cortes - Customizing Nagios
Nagios Conference 2014 - Dorance Martinez Cortes - Customizing Nagios
Nagios
 
Nagios XI Best Practices
Nagios XI Best PracticesNagios XI Best Practices
Nagios XI Best Practices
Nagios
 
Jesse Olson - Nagios Log Server Architecture Overview
Jesse Olson - Nagios Log Server Architecture OverviewJesse Olson - Nagios Log Server Architecture Overview
Jesse Olson - Nagios Log Server Architecture Overview
Nagios
 
Trevor McDonald - Nagios XI Under The Hood
Trevor McDonald  - Nagios XI Under The HoodTrevor McDonald  - Nagios XI Under The Hood
Trevor McDonald - Nagios XI Under The Hood
Nagios
 
Sean Falzon - Nagios - Resilient Notifications
Sean Falzon - Nagios - Resilient NotificationsSean Falzon - Nagios - Resilient Notifications
Sean Falzon - Nagios - Resilient Notifications
Nagios
 
Marcus Rochelle - Landis+Gyr - Monitoring with Nagios Enterprise Edition
Marcus Rochelle - Landis+Gyr - Monitoring with Nagios Enterprise EditionMarcus Rochelle - Landis+Gyr - Monitoring with Nagios Enterprise Edition
Marcus Rochelle - Landis+Gyr - Monitoring with Nagios Enterprise Edition
Nagios
 
Janice Singh - Writing Custom Nagios Plugins
Janice Singh - Writing Custom Nagios PluginsJanice Singh - Writing Custom Nagios Plugins
Janice Singh - Writing Custom Nagios Plugins
Nagios
 
Dave Williams - Nagios Log Server - Practical Experience
Dave Williams - Nagios Log Server - Practical ExperienceDave Williams - Nagios Log Server - Practical Experience
Dave Williams - Nagios Log Server - Practical Experience
Nagios
 
Mike Weber - Nagios and Group Deployment of Service Checks
Mike Weber - Nagios and Group Deployment of Service ChecksMike Weber - Nagios and Group Deployment of Service Checks
Mike Weber - Nagios and Group Deployment of Service Checks
Nagios
 
Mike Guthrie - Revamping Your 10 Year Old Nagios Installation
Mike Guthrie - Revamping Your 10 Year Old Nagios InstallationMike Guthrie - Revamping Your 10 Year Old Nagios Installation
Mike Guthrie - Revamping Your 10 Year Old Nagios Installation
Nagios
 
Bryan Heden - Agile Networks - Using Nagios XI as the platform for Monitoring...
Bryan Heden - Agile Networks - Using Nagios XI as the platform for Monitoring...Bryan Heden - Agile Networks - Using Nagios XI as the platform for Monitoring...
Bryan Heden - Agile Networks - Using Nagios XI as the platform for Monitoring...
Nagios
 
Matt Bruzek - Monitoring Your Public Cloud With Nagios
Matt Bruzek - Monitoring Your Public Cloud With NagiosMatt Bruzek - Monitoring Your Public Cloud With Nagios
Matt Bruzek - Monitoring Your Public Cloud With Nagios
Nagios
 
Lee Myers - What To Do When Nagios Notification Don't Meet Your Needs.
Lee Myers - What To Do When Nagios Notification Don't Meet Your Needs.Lee Myers - What To Do When Nagios Notification Don't Meet Your Needs.
Lee Myers - What To Do When Nagios Notification Don't Meet Your Needs.
Nagios
 
Eric Loyd - Fractal Nagios
Eric Loyd - Fractal NagiosEric Loyd - Fractal Nagios
Eric Loyd - Fractal Nagios
Nagios
 
Marcelo Perazolo, Lead Software Architect, IBM Corporation - Monitoring a Pow...
Marcelo Perazolo, Lead Software Architect, IBM Corporation - Monitoring a Pow...Marcelo Perazolo, Lead Software Architect, IBM Corporation - Monitoring a Pow...
Marcelo Perazolo, Lead Software Architect, IBM Corporation - Monitoring a Pow...
Nagios
 
Thomas Schmainda - Tracking Boeing Satellites With Nagios - Nagios World Conf...
Thomas Schmainda - Tracking Boeing Satellites With Nagios - Nagios World Conf...Thomas Schmainda - Tracking Boeing Satellites With Nagios - Nagios World Conf...
Thomas Schmainda - Tracking Boeing Satellites With Nagios - Nagios World Conf...
Nagios
 
Nagios World Conference 2015 - Scott Wilkerson Opening
Nagios World Conference 2015 - Scott Wilkerson OpeningNagios World Conference 2015 - Scott Wilkerson Opening
Nagios World Conference 2015 - Scott Wilkerson Opening
Nagios
 
Nrpe - Nagios Remote Plugin Executor. NRPE plugin for Nagios Core
Nrpe - Nagios Remote Plugin Executor. NRPE plugin for Nagios CoreNrpe - Nagios Remote Plugin Executor. NRPE plugin for Nagios Core
Nrpe - Nagios Remote Plugin Executor. NRPE plugin for Nagios Core
Nagios
 
Nagios Log Server - Features
Nagios Log Server - FeaturesNagios Log Server - Features
Nagios Log Server - Features
Nagios
 
Nagios Network Analyzer - Features
Nagios Network Analyzer - FeaturesNagios Network Analyzer - Features
Nagios Network Analyzer - Features
Nagios
 
Nagios Conference 2014 - Dorance Martinez Cortes - Customizing Nagios
Nagios Conference 2014 - Dorance Martinez Cortes - Customizing NagiosNagios Conference 2014 - Dorance Martinez Cortes - Customizing Nagios
Nagios Conference 2014 - Dorance Martinez Cortes - Customizing Nagios
Nagios
 

Recently uploaded (20)

Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...
Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...
Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...
Safe Software
 
machines-for-woodworking-shops-en-compressed.pdf
machines-for-woodworking-shops-en-compressed.pdfmachines-for-woodworking-shops-en-compressed.pdf
machines-for-woodworking-shops-en-compressed.pdf
AmirStern2
 
Developing Product-Behavior Fit: UX Research in Product Development by Krysta...
Developing Product-Behavior Fit: UX Research in Product Development by Krysta...Developing Product-Behavior Fit: UX Research in Product Development by Krysta...
Developing Product-Behavior Fit: UX Research in Product Development by Krysta...
UXPA Boston
 
Mastering Testing in the Modern F&B Landscape
Mastering Testing in the Modern F&B LandscapeMastering Testing in the Modern F&B Landscape
Mastering Testing in the Modern F&B Landscape
marketing943205
 
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
Lorenzo Miniero
 
AI-proof your career by Olivier Vroom and David WIlliamson
AI-proof your career by Olivier Vroom and David WIlliamsonAI-proof your career by Olivier Vroom and David WIlliamson
AI-proof your career by Olivier Vroom and David WIlliamson
UXPA Boston
 
React Native for Business Solutions: Building Scalable Apps for Success
React Native for Business Solutions: Building Scalable Apps for SuccessReact Native for Business Solutions: Building Scalable Apps for Success
React Native for Business Solutions: Building Scalable Apps for Success
Amelia Swank
 
Top 5 Qualities to Look for in Salesforce Partners in 2025
Top 5 Qualities to Look for in Salesforce Partners in 2025Top 5 Qualities to Look for in Salesforce Partners in 2025
Top 5 Qualities to Look for in Salesforce Partners in 2025
Damco Salesforce Services
 
Building the Customer Identity Community, Together.pdf
Building the Customer Identity Community, Together.pdfBuilding the Customer Identity Community, Together.pdf
Building the Customer Identity Community, Together.pdf
Cheryl Hung
 
Google DeepMind’s New AI Coding Agent AlphaEvolve.pdf
Google DeepMind’s New AI Coding Agent AlphaEvolve.pdfGoogle DeepMind’s New AI Coding Agent AlphaEvolve.pdf
Google DeepMind’s New AI Coding Agent AlphaEvolve.pdf
derrickjswork
 
Cybersecurity Tools and Technologies - Microsoft Certificate
Cybersecurity Tools and Technologies - Microsoft CertificateCybersecurity Tools and Technologies - Microsoft Certificate
Cybersecurity Tools and Technologies - Microsoft Certificate
VICTOR MAESTRE RAMIREZ
 
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdfKit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Wonjun Hwang
 
In-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptx
In-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptxIn-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptx
In-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptx
aptyai
 
Refactoring meta-rauc-community: Cleaner Code, Better Maintenance, More Machines
Refactoring meta-rauc-community: Cleaner Code, Better Maintenance, More MachinesRefactoring meta-rauc-community: Cleaner Code, Better Maintenance, More Machines
Refactoring meta-rauc-community: Cleaner Code, Better Maintenance, More Machines
Leon Anavi
 
Secondary Storage for a microcontroller system
Secondary Storage for a microcontroller systemSecondary Storage for a microcontroller system
Secondary Storage for a microcontroller system
fizarcse
 
Computer Systems Quiz Presentation in Purple Bold Style (4).pdf
Computer Systems Quiz Presentation in Purple Bold Style (4).pdfComputer Systems Quiz Presentation in Purple Bold Style (4).pdf
Computer Systems Quiz Presentation in Purple Bold Style (4).pdf
fizarcse
 
MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...
MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...
MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...
ICT Frame Magazine Pvt. Ltd.
 
DNF 2.0 Implementations Challenges in Nepal
DNF 2.0 Implementations Challenges in NepalDNF 2.0 Implementations Challenges in Nepal
DNF 2.0 Implementations Challenges in Nepal
ICT Frame Magazine Pvt. Ltd.
 
Building Connected Agents: An Overview of Google's ADK and A2A Protocol
Building Connected Agents:  An Overview of Google's ADK and A2A ProtocolBuilding Connected Agents:  An Overview of Google's ADK and A2A Protocol
Building Connected Agents: An Overview of Google's ADK and A2A Protocol
Suresh Peiris
 
OpenAI Just Announced Codex: A cloud engineering agent that excels in handlin...
OpenAI Just Announced Codex: A cloud engineering agent that excels in handlin...OpenAI Just Announced Codex: A cloud engineering agent that excels in handlin...
OpenAI Just Announced Codex: A cloud engineering agent that excels in handlin...
SOFTTECHHUB
 
Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...
Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...
Integrating FME with Python: Tips, Demos, and Best Practices for Powerful Aut...
Safe Software
 
machines-for-woodworking-shops-en-compressed.pdf
machines-for-woodworking-shops-en-compressed.pdfmachines-for-woodworking-shops-en-compressed.pdf
machines-for-woodworking-shops-en-compressed.pdf
AmirStern2
 
Developing Product-Behavior Fit: UX Research in Product Development by Krysta...
Developing Product-Behavior Fit: UX Research in Product Development by Krysta...Developing Product-Behavior Fit: UX Research in Product Development by Krysta...
Developing Product-Behavior Fit: UX Research in Product Development by Krysta...
UXPA Boston
 
Mastering Testing in the Modern F&B Landscape
Mastering Testing in the Modern F&B LandscapeMastering Testing in the Modern F&B Landscape
Mastering Testing in the Modern F&B Landscape
marketing943205
 
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
Lorenzo Miniero
 
AI-proof your career by Olivier Vroom and David WIlliamson
AI-proof your career by Olivier Vroom and David WIlliamsonAI-proof your career by Olivier Vroom and David WIlliamson
AI-proof your career by Olivier Vroom and David WIlliamson
UXPA Boston
 
React Native for Business Solutions: Building Scalable Apps for Success
React Native for Business Solutions: Building Scalable Apps for SuccessReact Native for Business Solutions: Building Scalable Apps for Success
React Native for Business Solutions: Building Scalable Apps for Success
Amelia Swank
 
Top 5 Qualities to Look for in Salesforce Partners in 2025
Top 5 Qualities to Look for in Salesforce Partners in 2025Top 5 Qualities to Look for in Salesforce Partners in 2025
Top 5 Qualities to Look for in Salesforce Partners in 2025
Damco Salesforce Services
 
Building the Customer Identity Community, Together.pdf
Building the Customer Identity Community, Together.pdfBuilding the Customer Identity Community, Together.pdf
Building the Customer Identity Community, Together.pdf
Cheryl Hung
 
Google DeepMind’s New AI Coding Agent AlphaEvolve.pdf
Google DeepMind’s New AI Coding Agent AlphaEvolve.pdfGoogle DeepMind’s New AI Coding Agent AlphaEvolve.pdf
Google DeepMind’s New AI Coding Agent AlphaEvolve.pdf
derrickjswork
 
Cybersecurity Tools and Technologies - Microsoft Certificate
Cybersecurity Tools and Technologies - Microsoft CertificateCybersecurity Tools and Technologies - Microsoft Certificate
Cybersecurity Tools and Technologies - Microsoft Certificate
VICTOR MAESTRE RAMIREZ
 
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdfKit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Kit-Works Team Study_팀스터디_김한솔_nuqs_20250509.pdf
Wonjun Hwang
 
In-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptx
In-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptxIn-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptx
In-App Guidance_ Save Enterprises Millions in Training & IT Costs.pptx
aptyai
 
Refactoring meta-rauc-community: Cleaner Code, Better Maintenance, More Machines
Refactoring meta-rauc-community: Cleaner Code, Better Maintenance, More MachinesRefactoring meta-rauc-community: Cleaner Code, Better Maintenance, More Machines
Refactoring meta-rauc-community: Cleaner Code, Better Maintenance, More Machines
Leon Anavi
 
Secondary Storage for a microcontroller system
Secondary Storage for a microcontroller systemSecondary Storage for a microcontroller system
Secondary Storage for a microcontroller system
fizarcse
 
Computer Systems Quiz Presentation in Purple Bold Style (4).pdf
Computer Systems Quiz Presentation in Purple Bold Style (4).pdfComputer Systems Quiz Presentation in Purple Bold Style (4).pdf
Computer Systems Quiz Presentation in Purple Bold Style (4).pdf
fizarcse
 
MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...
MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...
MULTI-STAKEHOLDER CONSULTATION PROGRAM On Implementation of DNF 2.0 and Way F...
ICT Frame Magazine Pvt. Ltd.
 
Building Connected Agents: An Overview of Google's ADK and A2A Protocol
Building Connected Agents:  An Overview of Google's ADK and A2A ProtocolBuilding Connected Agents:  An Overview of Google's ADK and A2A Protocol
Building Connected Agents: An Overview of Google's ADK and A2A Protocol
Suresh Peiris
 
OpenAI Just Announced Codex: A cloud engineering agent that excels in handlin...
OpenAI Just Announced Codex: A cloud engineering agent that excels in handlin...OpenAI Just Announced Codex: A cloud engineering agent that excels in handlin...
OpenAI Just Announced Codex: A cloud engineering agent that excels in handlin...
SOFTTECHHUB
 

Nagios Conference 2011 - Michael Medin - Workshop: Scripting On The Windows Side

  • 2. These slides represent the work and opinions of the author and do not constitute official positions of any organization sponsoring the author’s work This material has not been peer reviewed and is presented here as-is with the permission of the author.The author assumes no liability for any content or opinion expressed in this presentation and or use of content herein.Disclaimer!It is not their fault!It is not my fault!It is your fault!
  • 3. External ScriptsInternal ScriptsArgumentsScripting: Batch filesWrapped scriptsScripting: VBAInternal ScriptsAgenda
  • 4. Windows monitoringNSClient++ (from a scripters perspecitve)
  • 5. External ScriptsThe normal kind of scriptsCan be written in:BatchVBA/VBScript (pretty popular on Windows)Powershell (a rather strange language)But also:Perl, python, bash, etc etc…Internal ScriptsCan interact with (other) internal commandsCan access settingsCan hold stateCan be written in:LuaPython (requires python on the machine)Two kinds of scripts
  • 6. Enable the check module[/modules]CheckExternalScripts= # Runs the scriptNRPEServer= # NRPE serverEach script requires a definition[/settings/External Scripts]check_es_test=scripts\test.batOptions disabled by default (for a reason)allow arguments = falseallow nasty characters = falseConfiguring External Scripts
  • 7. Enable the check module[/modules]LUAScript=PythonScript=Each script requires a definition[/settings/LUA/Scripts]<alias>=test.lua[/settings/python/Scripts]<alias>=test.pyScripts requires NRPE/NSCA (or NSCP)[/modules]NRPEServer=Configuring Internal Scripts
  • 8. Can be configured in many placesIs probably more confusing then it is worthThe server moduleMeans NO commands can have argumentsThe script moduleMeans NO external script can have argumentsAllow arguments
  • 10. Writing our first ScriptsThe first batch script
  • 11. Output:Use: echo <text>Don’t forget @echo off (or all commands will be echoed)Exit statuses:Use: exit <code>0 = OK1 = Warning2 = Critical3 = UnknownNSC.ini syntax:[/settings/External Scripts/scripts]my_script=scripts\script.batReference:http://www.ss64.com/nt/Don’t let preconceptions fool you: batch can actually do a lot!Writing a Script (Batch)
  • 12. @echo offecho CRITICAL: Everything is not going to be fineexit 2A basic script (batch)
  • 13. …\NSClient++\scripts>cmd /ctest.batCRITICAL: Everything is not going to be fine…\NSClient++\scripts>echo %ERRORLEVEL%2Running from Command Line
  • 14. D:\demo>nscp --testNSClient++ 0,4,0,98 2011-09-06 x64 booting...Boot.ini found in: D:/demo//boot.iniBoot order: ini://${shared-path}/nsclient.ini, old://${exe-path}/nsc.iniActivating: ini://${shared-path}/nsclient.iniCreating instance for: ini://${shared-path}:80/nsclient.iniReading INI settings from: D:/demo//nsclient.iniLoading: D:/demo//nsclient.ini from ini://${shared-path}/nsclient.iniBooted settings subsystem...On crash: restart: NSClientppArchiving crash dumps in: D:/demo//crash-dumpsbooting::loading pluginsFound: CheckExternalScripts asProcessing plugin: CheckExternalScripts.dll asaddPlugin(D:/demo//modules/CheckExternalScripts.dll as )Loading plugin: Check External Scripts asNSClient++ - 0,4,0,98 2011-09-06 Started!Enter command to inject or exit to terminate...Running from NSClient
  • 15. Enter command to inject or exit to terminate...my_scriptsInjecting: my_script...Arguments:Result my_script: WARNINGWARNING:Hello WorldRunning from NSClientCommandReturn StatusReturn Message
  • 17. Writing our first ScriptsKilling notepad once and or all!
  • 18. TASKKILL [/S dator [/U användarnamn [/P lösenord]]]] { [/FI filter] [/PID process-ID | /IM avbildning] } [/T][/F]Beskrivning: Det här verktyget används för att avsluta en eller flera aktiviteter utifrån process-ID (PID) eller avbildningsnamn.Parameterlista:… /FI filter Använder ett filter för att välja aktiviteter. Jokertecknet * kan användas, t.ex:imagenameeq note* /PID process-ID Anger process-ID för den process som ska avbrytas. Använd kommandot Tasklist för att hämta process-ID /IM avbildning Anger avbildning för den process som för den process som ska avslutas. Jokertecknet * användas för att ange alla aktiviteter eller avbildningar.Killing notepad once and for all!
  • 19. @echo offtaskkill /im notepad.exe 1>NUL 2>NULIF ERRORLEVEL 128 GOTO errIF ERRORLEVEL 0 GOTO okGOTO unknown:unknownecho UNKNOWN: unknown problem killing notepad...exit /B 3:errecho CRITICAL: Notepad was not killed...exit /B 1:okecho OK: Notepad was killed!exit /B 0KILL!!!
  • 22. NSC.ini syntax:[External Scripts]check_bat=scripts\check_test.batOr[Wrapped Scripts]check_test=check_test.batAdding a Script (.bat)
  • 23. NSC.ini syntax:[External Scripts]check_test=cscript.exe /T:30 /NoLogo scripts\check_test.vbsOr[Wrapped Scripts]check_test=check_test.vbsAdding a Script (.VBS)
  • 24. NSC.ini syntax:[External Scripts]check_test=cscript.exe /T:30 /NoLogo scripts\lib\wrapper.vbs scripts\check_test.vbsOr[Wrapped Scripts]check_test=check_test.vbsAdding a Script (.VBS) w/ libs
  • 25. NSC.ini syntax:[External Scripts]check_test=cmd /c echo scripts\check_test.ps1; exit($lastexitcode) | powershell.exe -command -Or[Wrapped Scripts]check_test=check_test.ps1Adding a Script (.PS1)
  • 26. […/wrappings]bat=scripts\%SCRIPT% %ARGS%vbs=cscript.exe //T:30 //NoLogo scripts\lib\wrapper.vbs %SCRIPT% %ARGS%ps1=cmd /c echo scripts\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command -[…/wrapped scripts]check_test_vbs=check_test.vbs /arg1:1 /variable:1check_test_ps1=check_test.ps1 arg1 arg2check_test_bat=check_test.bat $ARG1$ arg2check_battery=check_battery.vbscheck_printer=check_printer.vbs; So essentially it is a macro! (but a nice one)What is wrapped scripts?
  • 27. Writing your first ScriptsWriting a simple VB script
  • 28. Output:Use: Wscript.StdOut.WriteLine <text>Exit statuses:Use: Wscript.Quit(<code>)0 = OK1 = Warning2 = Critical3 = UnknownNSC.ini syntax:[External Scripts]check_vbs=cscript.exe //T:30 //NoLogo scripts\check_vbs.vbs //T:30 Is the timeout and might need to be changed.Reference:http://msdn.microsoft.com/en-us/library/t0aew7h6(VS.85).aspxWriting a Script (VBS)
  • 30. Set <variable name>=CreateObject(“<COM Object>")There is A LOT of objects you can createA nice way to interact with other applicationsFor instance:Set objWord = CreateObject("Word.Application")objWord.Visible = TrueSet objDoc = objWord.Documents.Add()Set objSelection = objWord.SelectionobjSelection.Font.Name = “Comic Sans MS"objSelection.Font.Size = “28"objSelection.TypeText“Hello World"objSelection.TypeParagraph()objSelection.Font.Size = "14"objSelection.TypeText "" & Date()objSelection.TypeParagraph()Object oriented programming (ish)
  • 32. strFile=”c:\windows”Dim oFSOSet oFSO=CreateObject("Scripting.FileSystemObject")If oFSO.FileExists(strFile) Thenwscript.echo”Yaay!"wscript.quit(0)elsewscript.echo“Whhh… what the f***!"wscript.quit(2)end ifAre we running windows?
  • 35. Can be used to extend NSClient++Are very powerfulA good way to:Alter things you do not likeCreate advanced thingsAre written in Lua or PythonPossibly unsafeRuns inside NSClient++Internal Scripts
  • 36. Internal scripts are fundamentally differentOne script is NOT equals to one functionA script (at startup) can:Register query (commands) handlersRegister submission (passive checks) handlersRegister exec handlersRegister configurationAccess configurationHandlers can:Execute queries (commands)Submit submissions (passive checks)Etc etc…Anatomy of an internal script
  • 37. definit(plugin_id, plugin_alias, script_alias):conf = Settings.get()reg = Registry.get(plugin_id)reg.simple_cmdline('help', get_help)reg.simple_function(‘command', cmd, ‘A command…')conf.set_int('hello', 'python', 42) log(Answer: %d'%conf.get_int('hello','python',-1))def shutdown(): log(“Shutting down…”)A basic script
  • 38. defget_help(arguments): return (status.OK, ‘Im not helpful ')def test(arguments): core = Core.get()count = len(arguments)(retcode, retmessage, retperf) =core.simple_query(‘CHECK_NSCP’, [])return (status.OK, ‘Life is good… %d'%count)A basic script
  • 40. Michael Medinmichael@medin.namehttp://www.linkedin.com/in/mickemInformation about NSClient++http://nsclient.orgFacebook: facebook.com/nsclientSlides, and exampleshttp://nsclient.org/nscp/conferances/2011/nwcna/Thank You!

Editor's Notes

  • #2: Hello my name is Michael Medin.I am from Stockholm, Sweden.I will give this in English just because I think everyone else does...If there are any questions or such just chime in.Feel free to ask questions in Swedish if you wish.
  • #3: Standard Disclaimer - My views (not anyone else&apos;s) - Not peer reviewed so I could be lying to you. - If you 2 billion dollar servers crash: life sucksLets simplify this a bit…
  • #14: cmd /c is because we need to capture the “exit code” normally exit will exit all running shellsWe get the message but no error codeUse echo %ERRORLEVEL% to display the exit code
  • #15: We run the scriptGet the error code (Critical) and the Message (...)But we get no performance data
  • #16: We run the scriptGet the error code (Critical) and the Message (...)But we get no performance data
  • #17: 2 minutes
  • #18: 2 minutes
  • #21: 2 minutes