Re: Check Windows Files
Posted: Mon Oct 17, 2016 11:31 am
Where do i will placed that script and what would be its command definition ?
Support for Nagios products and services
https://support.nagios.com/forum/
Code: Select all
python check_in_logfiles.py '<pattern file>' '<log file>'
Code: Select all
C:\Program Files\NSClient++\scripts\check_files_winCode: Select all
# If you want to fill this file with all avalible options run the following command:
# nscp settings --generate --add-defaults --load-all
# If you want to activate a module and bring in all its options use:
# nscp settings --activate-module <MODULE NAME> --add-defaults
# For details run: nscp settings --help
; Undocumented section
[/settings/default]
; Undocumented key
; password = ********************
; Undocumented key
allowed hosts = NAGIOS SERVER IP
check_files_win = check_files_win
; Undocumented section
[/settings/NRPE/server]
; Undocumented key
ssl options = no-sslv2,no-sslv3
; Undocumented key
; verify mode = peer-cert
verify mode = none
; Undocumented key
insecure = true
allow arguments = true
allow nasty characters = true
; Undocumented section
[/modules]
; Undocumented key
CheckExternalScripts = 1
check_files_win = C:\Program Files\NSClient++\scripts\check_files_win
; Undocumented key
CheckHelpers = 1
; Undocumented key
CheckEventLog = 1
; Undocumented key
CheckNSCP = 1
; Undocumented key
CheckDisk = 1
; Undocumented key
CheckSystem = 1
; Undocumented key
NSClientServer = 1
; Undocumented key
NRPEServer = 1Code: Select all
2016-10-18 10:43:24: error:c:\source\nscp\include\nscapi\nscapi_core_helper.cpp:95: Failed to execute command: check_files_win
2016-10-18 10:50:30: error:c:\source\nscp\service\NSClient++.cpp:894: Unknown command(s): check_files_win available commands: commands {, alias_cpu, alias_cpu_ex, alias_disk, alias_disk_loose, alias_event_log, alias_file_age, alias_file_size, alias_mem, alias_process, alias_process_count, alias_process_hung, alias_process_stopped, alias_sched_all, alias_sched_long, alias_sched_task, alias_service, alias_service_ex, alias_up, alias_volumes, alias_volumes_loose, check_always_critical, check_always_ok, check_always_warning, check_counter, check_cpu, check_critical, check_drivesize, check_eventlog, check_files, check_memory, check_multi, check_negate, check_nscp, check_ok, check_os_version, check_pagefile, check_pdh, check_process, check_service, check_timeout, check_uptime, check_version, check_warning, checkalwayscritical, checkalwaysok, checkalwayswarning, checkcounter, checkcpu, checkcritical, checkdrivesize, checkeventlog, checkfiles, checkmem, checkmultiple, checkok, checkprocstate, checkservicestate, checkuptime, checkversion, checkwarning, filter_perf, negate, render_perf, timeout, xform_perf}, plugins {, 0, 1, 2, 3, 4, 5}
2016-10-18 10:50:30: error:c:\source\nscp\include\nscapi\nscapi_core_wrapper.cpp:159: Failed to execute command
2016-10-18 10:50:30: error:c:\source\nscp\include\nscapi\nscapi_core_helper.cpp:95: Failed to execute command: check_files_win
2016-10-18 10:50:45: error:c:\source\nscp\service\NSClient++.cpp:894: Unknown command(s): check_files_win.py available commands: commands {, alias_cpu, alias_cpu_ex, alias_disk, alias_disk_loose, alias_event_log, alias_file_age, alias_file_size, alias_mem, alias_process, alias_process_count, alias_process_hung, alias_process_stopped, alias_sched_all, alias_sched_long, alias_sched_task, alias_service, alias_service_ex, alias_up, alias_volumes, alias_volumes_loose, check_always_critical, check_always_ok, check_always_warning, check_counter, check_cpu, check_critical, check_drivesize, check_eventlog, check_files, check_memory, check_multi, check_negate, check_nscp, check_ok, check_os_version, check_pagefile, check_pdh, check_process, check_service, check_timeout, check_uptime, check_version, check_warning, checkalwayscritical, checkalwaysok, checkalwayswarning, checkcounter, checkcpu, checkcritical, checkdrivesize, checkeventlog, checkfiles, checkmem, checkmultiple, checkok, checkprocstate, checkservicestate, checkuptime, checkversion, checkwarning, filter_perf, negate, render_perf, timeout, xform_perf}, plugins {, 0, 1, 2, 3, 4, 5}
2016-10-18 10:50:45: error:c:\source\nscp\include\nscapi\nscapi_core_wrapper.cpp:159: Failed to execute command
2016-10-18 10:50:45: error:c:\source\nscp\include\nscapi\nscapi_core_helper.cpp:95: Failed to execute command: check_files_win.pyCode: Select all
/usr/local/nagios/libexec/check_nrpe -H windows client server ip
Output:
I (0.4.4.23 2016-04-05) seem to be doing fine...
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H windows client server ip -t 30 -c check_files_win -a "C:\\abc.txt" "C:\\xyz.txt"
Output:
Unknown command(s): check_files_winCode: Select all
python C:\Program Files\NSClient++\scripts\check_files_win "C:\\abc.txt" "C:\\xyz.txt"
Code: Select all
; A list of scripts available to run from the CheckExternalScripts module. Syntax is: <command>=<script> <arguments>
[/settings/external scripts/scripts]
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H WindowsIP -t 30 -c check_files_win -a "C:\\xyz.txt" "C:\\abc.txt"
Output after some time:
CHECK_NRPE: Socket timeout after 30 seconds.Code: Select all
[/settings/external scripts/scripts]
check_files_win = C:\Program Files\NSClient++\scripts\check_files_win.pyCode: Select all
check_files_win = C:\Program Files\NSClient++\scripts\check_files_win.py $ARG1$ $ARG2$
Code: Select all
check_files_win = C:\Program Files\NSClient++\scripts\check_files_win.py $ARG1$ $ARG2$Code: Select all
Arguments not allowed see nsclient.log for details.Code: Select all
allow arguments = true
allow nasty characters = trueCode: Select all
[/settings/external scripts/scripts]
check_files_win = C:\Python27\python.exe C:\Program Files\NSClient++\scripts\check_files_win.py C:\xyz.txt C:\abc.txtCode: Select all
/usr/local/nagios/libexec/check_nrpe -H WinIP -t 40 -c check_files_win
Output:
C:\Python27\python.exe: can't open file 'C:\Program': [Errno 2] No such file or directoryCode: Select all
C:\Python27\python.exeCode: Select all
/usr/local/nagios/libexec/check_nrpe -H WinIP -t 40 -c check_files_win
Output:
Failed to execute check_files_win seems more like a script maybe you need a script executable first: failed to lookup error code: 193 (reason: 87)