NSClient++ Help (#1) - Problem executing exe-files. bat-files seem to work. [SOLVED] (#531) - Message List
Hello people,
I provided some external scripts to my nsclient++-Daemon on Windows XP in a W2k3-Domain.
The scripts are called shutdown.bat or restart.bat. Everything seems to be fine so far.
Now I added scripts like start_screensaver.exe or block_mouse_and_keyboard.exe. These exe-files are made by autoit. Please don't wonder about the name of my scripts. It's an educational-test-sandbox-enviroment.
Now the problem is, that the exe-files are not executed. Even when I trigger the exe files by an batch-file over cmd, the batch works, but the exe does not react.
Here is the logfile:
2010-03-03 09:20:33: debug:modules\NSCAAgent\NSCAThread.cpp:215: Nothing to report, thus not reporting anything... 2010-03-03 09:20:55: debug:NSClient++.cpp:1109: Injected Result: WARNING 'Command (c:\Programme\nsclient++\scripts\block_mouse_and_keyboard.exe ) didn't terminate within the timeout period (60s)!' 2010-03-03 09:20:55: debug:NSClient++.cpp:1110: Injected Performance Result: '
What may be the problem?
Is it a windows-rights problem? Do I have to try using GPO? Or runas?
Is my syntax not ok?:
nsc.ini:
block_mouse_and_keyboard=scripts\block_mouse_and_keyboard.exe
piccus
-
Message #1646
What does the exe do ? NSClient says that the executable did not stop within 60 seconds, which is normal behaviour as it prevents checks from continuously running thus filling up memory...
mike2k03/04/10 15:25:58 (5 months ago) -
Message #1647
Uhmm, as mike2k says, "block mouse and keyboard" sounds like you want to start and run a program... NSclient++ is not a "remote execution program".
The idea is more to run a short script/program to check something.
But you can if you like do a "background task" ala "start <program>" in your script, but sounds like you have the wrong tool.
// Michael Medin
mickem03/04/10 16:17:49 (5 months ago)-
Message #1653
but sounds like you have the wrong tool.
No, no no! Nagios and nsclient is exactly what I want :-)
Well, let me explain. I decide using Nagios not for monitoring servers but classrooms. Everything is fine and I can shutdown, get username, close internet-connection, see all hosts in classroom on statusmap and so on by pushing Button in the browser. I did some php-coding and some nagios-code modificationn and can say for now, that this will become a big thing, really!
However, I did lots of testing today an finally found out, that in Windows-Taskmanager the triggered processes are all listed!!! I can see three times my triggered process in taskmgr!!!
But why do I not see any effect on Desktop?
piccus
piccus03/04/10 21:44:09 (5 months ago)-
Message #1655
but sounds like you have the wrong tool.
No, no no! Nagios and nsclient is exactly what I want :-) Well, let me explain. I decide using Nagios not for monitoring servers but classrooms.
Sounds like a splendid idea...
Everything is fine and I can shutdown, get username, close internet-connection, see all hosts in classroom on statusmap and so on by pushing Button in the browser.
... and here you are again,... this is not monitoring... monitoring != spying (unless you live in the USA and run schools apparently ;) this is remote control and/or remote execution
I did some php-coding and some nagios-code modificationn and can say for now, that this will become a big thing, really! However, I did lots of testing today an finally found out, that in Windows-Taskmanager the triggered processes are all listed!!! I can see three times my triggered process in taskmgr!!! But why do I not see any effect on Desktop?
Well, the reasons are many:
- NSClient++ will run the programs "off the desktop" (since we don't want to annoy the users with windows popping up)
- NSClient++ will attempt to "kill" process which runs for more then x-seconds (default is 30 IIRC)
- NSClient++ (as all NRPE clients) does not have the (security) infrastructure to do something like this properly.
That being said you *can* do it if you want but I honestly think a another solution might fit you better.
What you need to do is extend the scripts you have so they play well with windows. That means they have to adhere to how windows work in regards to sessions and such. I am not 100% sure of the best way to do this via scripts (since I usually program C++ for such things) but the start/runas command might be a good place to start looking. You will most likely need to do at least two tings:
- run in the background (start ought to do this)
- create the command in a new session (start ought to do this)
and possibly:
- impersonate a proper user (runas ought to do this)
Maybe someday I shall write a module to better facilitate this, but that is a long time away...if ever...
If you do get something that works please share it with the rest here or under external scripts on the wiki.
// Michael Medin
mickem03/05/10 08:47:01 (5 months ago)-
Message #1658
muchas gracias!
I did some further investigation and found out, that finally a dump single checkbox-click in MS-Service-Property-settings was missing to let blockinput take effect on the desktop.
For one second I thought my project was dying. But now blockinput is working 100% controlled by nagios/nsclient. Now I go on with vnc ...
Greetz to all nsclient-developers! piccus
piccus03/07/10 13:54:17 (5 months ago)
-
-







