Download - NSClient++ Workshop: 06 Scripting
![Page 1: NSClient++ Workshop: 06 Scripting](https://reader030.vdocument.in/reader030/viewer/2022013111/55a2cc9b1a28ab422e8b45e2/html5/thumbnails/1.jpg)
monitoring
Scripting
![Page 2: NSClient++ Workshop: 06 Scripting](https://reader030.vdocument.in/reader030/viewer/2022013111/55a2cc9b1a28ab422e8b45e2/html5/thumbnails/2.jpg)
![Page 3: NSClient++ Workshop: 06 Scripting](https://reader030.vdocument.in/reader030/viewer/2022013111/55a2cc9b1a28ab422e8b45e2/html5/thumbnails/3.jpg)
![Page 4: NSClient++ Workshop: 06 Scripting](https://reader030.vdocument.in/reader030/viewer/2022013111/55a2cc9b1a28ab422e8b45e2/html5/thumbnails/4.jpg)
![Page 5: NSClient++ Workshop: 06 Scripting](https://reader030.vdocument.in/reader030/viewer/2022013111/55a2cc9b1a28ab422e8b45e2/html5/thumbnails/5.jpg)
![Page 6: NSClient++ Workshop: 06 Scripting](https://reader030.vdocument.in/reader030/viewer/2022013111/55a2cc9b1a28ab422e8b45e2/html5/thumbnails/6.jpg)
![Page 7: NSClient++ Workshop: 06 Scripting](https://reader030.vdocument.in/reader030/viewer/2022013111/55a2cc9b1a28ab422e8b45e2/html5/thumbnails/7.jpg)
![Page 8: NSClient++ Workshop: 06 Scripting](https://reader030.vdocument.in/reader030/viewer/2022013111/55a2cc9b1a28ab422e8b45e2/html5/thumbnails/8.jpg)
![Page 9: NSClient++ Workshop: 06 Scripting](https://reader030.vdocument.in/reader030/viewer/2022013111/55a2cc9b1a28ab422e8b45e2/html5/thumbnails/9.jpg)
Adding scripts
![Page 10: NSClient++ Workshop: 06 Scripting](https://reader030.vdocument.in/reader030/viewer/2022013111/55a2cc9b1a28ab422e8b45e2/html5/thumbnails/10.jpg)
6:1 Using batch scripts
![Page 11: NSClient++ Workshop: 06 Scripting](https://reader030.vdocument.in/reader030/viewer/2022013111/55a2cc9b1a28ab422e8b45e2/html5/thumbnails/11.jpg)
scripts\check_ok.bat
Add check_ok.bat as ext_myok1 (using command line)
Add check_ok.bat as ext_myok2 (using notepad)
![Page 12: NSClient++ Workshop: 06 Scripting](https://reader030.vdocument.in/reader030/viewer/2022013111/55a2cc9b1a28ab422e8b45e2/html5/thumbnails/12.jpg)
Add check_ok.bat as ext_myok1 (using command line)
Add check_ok.bat as ext_myok2 (using notepad)
scripts\check_ok.bat
nscp ext-scr help
# Modify the config from above
![Page 13: NSClient++ Workshop: 06 Scripting](https://reader030.vdocument.in/reader030/viewer/2022013111/55a2cc9b1a28ab422e8b45e2/html5/thumbnails/13.jpg)
Add check_ok.bat as ext_myok1 (using command line)
Add check_ok.bat as ext_myok2 (using notepad)
scripts\check_ok.bat
nscp ext-scr add --help
# Modify the config from above
[/settings/external scripts/scripts]
![Page 14: NSClient++ Workshop: 06 Scripting](https://reader030.vdocument.in/reader030/viewer/2022013111/55a2cc9b1a28ab422e8b45e2/html5/thumbnails/14.jpg)
Add check_ok.bat as ext_myok1 (using command line)
Add check_ok.bat as ext_myok2 (using notepad)
scripts\check_ok.bat
nscp ext-scr help
nscp ext-scr add --script scripts\check_ok.bat
--alias=ext_myok1
[/settings/external scripts/scripts]
ext_myok2 = scripts\check_ok.bat
![Page 15: NSClient++ Workshop: 06 Scripting](https://reader030.vdocument.in/reader030/viewer/2022013111/55a2cc9b1a28ab422e8b45e2/html5/thumbnails/15.jpg)
Wrapped scripts
![Page 16: NSClient++ Workshop: 06 Scripting](https://reader030.vdocument.in/reader030/viewer/2022013111/55a2cc9b1a28ab422e8b45e2/html5/thumbnails/16.jpg)
6:2 Using powershell scripts
![Page 17: NSClient++ Workshop: 06 Scripting](https://reader030.vdocument.in/reader030/viewer/2022013111/55a2cc9b1a28ab422e8b45e2/html5/thumbnails/17.jpg)
scripts\check_test.ps1
nscp ??? help
Add check_test.ps1 as ext_ps1 (as a wrapped script)
Add arguments for external scripts via NRPE
![Page 18: NSClient++ Workshop: 06 Scripting](https://reader030.vdocument.in/reader030/viewer/2022013111/55a2cc9b1a28ab422e8b45e2/html5/thumbnails/18.jpg)
Add check_test.ps1 as ext_ps1 (as a wrapped script)
Add arguments for external scripts via NRPE
scripts\check_ok.bat
nscp ext-scr help
nscp nrpe help
![Page 19: NSClient++ Workshop: 06 Scripting](https://reader030.vdocument.in/reader030/viewer/2022013111/55a2cc9b1a28ab422e8b45e2/html5/thumbnails/19.jpg)
Add check_test.ps1 as ext_ps1 (as a wrapped script)
Add for external scripts via NRPE
scripts\check_ok.bat
nscp ext-scr add --wrapped …
nscp ext-scr install --help
![Page 20: NSClient++ Workshop: 06 Scripting](https://reader030.vdocument.in/reader030/viewer/2022013111/55a2cc9b1a28ab422e8b45e2/html5/thumbnails/20.jpg)
Add check_test.ps1 as ext_ps1 (as a wrapped script)
Add for external scripts via NRPE
scripts\check_ok.bat
nscp ext-scr add --wrapped
--script check_test.ps1 --alias=ext_ps1
nscp ext-scr install --arguments safe
nscp nrpe install --arguments safe
![Page 21: NSClient++ Workshop: 06 Scripting](https://reader030.vdocument.in/reader030/viewer/2022013111/55a2cc9b1a28ab422e8b45e2/html5/thumbnails/21.jpg)
Writing Scripts
![Page 22: NSClient++ Workshop: 06 Scripting](https://reader030.vdocument.in/reader030/viewer/2022013111/55a2cc9b1a28ab422e8b45e2/html5/thumbnails/22.jpg)
6:3 Writing Scripts
![Page 23: NSClient++ Workshop: 06 Scripting](https://reader030.vdocument.in/reader030/viewer/2022013111/55a2cc9b1a28ab422e8b45e2/html5/thumbnails/23.jpg)
Create a batch script which returns ok
Change script to return memory usage as well as always ok
![Page 24: NSClient++ Workshop: 06 Scripting](https://reader030.vdocument.in/reader030/viewer/2022013111/55a2cc9b1a28ab422e8b45e2/html5/thumbnails/24.jpg)
Create a batch script which returns ok
Change script to return memory usage as well as always ok
Remember nscp client
![Page 25: NSClient++ Workshop: 06 Scripting](https://reader030.vdocument.in/reader030/viewer/2022013111/55a2cc9b1a28ab422e8b45e2/html5/thumbnails/25.jpg)
Create a batch script which returns ok
Change script to return memory usage as well as always ok
@echo off
c:\nsclient\nscp client --module CheckSystem --query check_memory
exit 0
![Page 26: NSClient++ Workshop: 06 Scripting](https://reader030.vdocument.in/reader030/viewer/2022013111/55a2cc9b1a28ab422e8b45e2/html5/thumbnails/26.jpg)
Advanced scriptings
![Page 27: NSClient++ Workshop: 06 Scripting](https://reader030.vdocument.in/reader030/viewer/2022013111/55a2cc9b1a28ab422e8b45e2/html5/thumbnails/27.jpg)
6:3 Advanced scripting
![Page 28: NSClient++ Workshop: 06 Scripting](https://reader030.vdocument.in/reader030/viewer/2022013111/55a2cc9b1a28ab422e8b45e2/html5/thumbnails/28.jpg)
C:\nsclient\scripts\python\check_cpu_ex.py
Install the check_cpu_ex python script
Modify it to display the top 3 producers
![Page 29: NSClient++ Workshop: 06 Scripting](https://reader030.vdocument.in/reader030/viewer/2022013111/55a2cc9b1a28ab422e8b45e2/html5/thumbnails/29.jpg)
nscp py --script check_cpu_ex install
…'limit=3’…
Install the check_cpu_ex python script
Modify it to display the top 3 producers