opinkerfi / adagios

Adagios - Web Based Nagios Configuration
GNU Affero General Public License v3.0
330 stars 75 forks source link

Unable to Push NSclient via winexe in OKCONFIG #212

Closed Rionoskae closed 11 years ago

Rionoskae commented 11 years ago

This is really the last Kink that needs to be worked out before Adagios is fully functional for us....

I'm entering in the proper information for the host...but the page just hangs forever....

Are there logs I can check?

I tried to do a search for the winexe command in the Adagios -Github code base for the command that is being sent out via Winexe...but could not locate it via search on the website

Rionoskae commented 11 years ago

Ran netstat -a on our Windows server to make sure that 445 is listening... untitled

Rionoskae commented 11 years ago

And this is the format I'm using for the Agent install....

untitled2

palli commented 11 years ago

I believe this issue is fixed in latest combo of adagios/pynag.

Upgrade pynag to 0.6.1 and see if it fixes your issue.

Marking it as closed now, but dont hesitate to reopen if problem persists.

Rionoskae commented 11 years ago

Thanks for the update Palli, Trying to do a clean install of Adagios and having problems with the folllowing command...

yum --enablerepo=ok-testing install -y nagios git adagios

Command is not working for me - It does not find the Adagios .rpm .....Can't test whether this is resolved or not...

tomas-edwardsson commented 11 years ago

Please post the output of the command since there is nothing to debug from what you have posted.

Rionoskae commented 11 years ago

screenshot

Rionoskae commented 11 years ago

Looks like the link is bad:

Old: http://opensource.is/repo/testing/rhel6/x86_64/adagios-1.2.3-1.git.70.248989c.el6.noarch.rpm

New: http://opensource.is/repo/testing/rhel6/x86_64/adagios-1.2.4-1.git.2.16fa0f6.el6.noarch.rpm

Rionoskae commented 11 years ago

Resolved for my own use:

wget http://opensource.is/repo/testing/rhel6/x86_64/adagios-1.2.4-1.git.2.16fa0f6.el6.noarch.rpm yum localinstall adagios*

But the Above issue is still a problem for new users following the install directions on Adagios.org

Rionoskae commented 11 years ago

yum --enablerepo=ok-testing install -y okconfig Also turns up a bad link....

Resolved for my own use: wget http://opensource.is/repo/testing/rhel6/x86_64/okconfig-1.1.1-1.git.50.c67ae87.el6.noarch.rpm yum localinstall okconfig*

tomas-edwardsson commented 11 years ago

Looks like your machines might be behind a proxy that might be caching repository data. The files are fine and just tested.

Rionoskae commented 11 years ago

hmm interesting.... My bad - Thanks for looking into it in any case.

palli commented 11 years ago

Next time run the following to clean yum cache on your machine:

yum clean all --enablerepo=ok-testing

On Sep 3, 2013 9:58 PM, "Tomas Edwardsson" notifications@github.com wrote:

Looks like your machines might be behind a proxy that might be caching repository data. The files are fine and just tested.

— Reply to this email directly or view it on GitHubhttps://github.com/opinkerfi/adagios/issues/212#issuecomment-23750335 .

Rionoskae commented 11 years ago

Thanks for the advice Palli :)

Rionoskae commented 11 years ago

So...I Have the new versions of Adagios & Pynag. Disabled Firewall on remote system for testing ( to make sure port 445 was not being blocked ) and attempted to push Agent via winexe...

It is still timing out for me... Any other ideas gentlemen?

palli commented 11 years ago

Try it from the commandline (via okconfig install command)

On Wed, Sep 4, 2013 at 2:23 PM, Rionoskae notifications@github.com wrote:

So...I Have the new versions of Adagios & Pynag. Disabled Firewall on remote system for testing ( to make sure port 445 was not being blocked ) and attempted to push Agent via winexe...

It is still timing out for me... Any other ideas gentlemen?

— Reply to this email directly or view it on GitHubhttps://github.com/opinkerfi/adagios/issues/212#issuecomment-23793031 .

Rionoskae commented 11 years ago

Ok great - this is what it returns...

Install script on whd002252 failed with exit_status 1 Errors: The system cannot find the file specified. Error: Directory /usr/share/okconfig/client/windows//nsclient not found

Rionoskae commented 11 years ago

For what it's worth....the actual file location of the script is...

/usr/share/okconfig/client/windows/install_nsclient.sh

Rionoskae commented 11 years ago

Tried editing nsclient_installfiles locations in /etc/okconfig.conf with no luck....

Then found this link https://github.com/opinkerfi/okconfig/wiki/Deploying-nsclient-on-windows-servers

But i'm having difficulty sorting out just exactly what i'm suppose to be doing to get this working still....

palli commented 11 years ago

Follow that guide. Don't mess with okconfig.conf

Rionoskae commented 11 years ago

Will do - trying it out now.

Rionoskae commented 11 years ago

Followed the guide, however last step was slightly different than detailed in your write-up.

It was vim /usr/share/okconfig/client/windows/nsclient/src/datafiles/allowed_hosts.ini

I'm not sure if this new path effects anything else - but windows agent push still times out for me....

I will try a server reboot and try again.

Rionoskae commented 11 years ago

Update: I've noticed that Adagios has been able to copy over the nsclient install files to the remote server - but only when I run the okconfig install command from the command line. Using the exact same parameters.

Ran the command via command-line with the --verbose option and get the following:

Install script on 172.17.16.35 failed with exit_status 1 Errors: Domain=[WHD] OS=[Windows 7 Enterprise 7601 Service Pack 1] Server=[Windows 7 Enterprise 6.1] 'c:\temp\nsclient\install.bat' is not recognized as an internal or external command, operable program or batch file. install of 172.17.16.35 failed

Script output: Starting install of 172.17.16.35 ... Preparing client for copy ... Copying files to remote server... Files have been copied to 172.17.16.35 Executing install script...

Rionoskae commented 11 years ago

Update 2:

I Think I have narrowed the issue down to how UAC is configured on our machines. I've noticed that even though my account is setup as a local admin - I get access denied when running the install.bat file as myself.

Now if I Choose "Run as administrator" for Command Prompt - Then run the install.bat file, Everything works perfectly.....

So 2 issues at this point: 1.) Adagios okconfig Web UI times-out and DOES NOT copy over any nsclient++ files ( doing so via command line copies files over ) 2.) install.bat file does not run successfully due to Windows UAC.

I will keep looking into this issue, but please let me know if a resolution is found.

Rionoskae commented 11 years ago

Update 3: I've found a way to write the script so that it auto-elevates to admin mode and executes the .bat file as it is intended to. This allows Users who run Win7 ( UAC enabled ) and Win xp users alike to run the install.bat file. However it still returns the same error when you try to run okconfig install via the command-line. (see update 1 for error code)

The above error code happens on Win7 & WinXP machines alike ( so UAC isn't a factor) - What's the deal?

:::::::::::::::::::::::::::::::::::::::::
:: Automatically check & get admin rights
:::::::::::::::::::::::::::::::::::::::::
@echo off
CLS 
ECHO.
ECHO =============================
ECHO Running Admin shell
ECHO =============================

:checkPrivileges 
NET FILE 1>NUL 2>NUL
if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges ) 

:getPrivileges 
if '%1'=='ELEV' (shift & goto gotPrivileges)  
ECHO. 
ECHO **************************************
ECHO Invoking UAC for Privilege Escalation 
ECHO **************************************

setlocal DisableDelayedExpansion
set "batchPath=%~0"
setlocal EnableDelayedExpansion
ECHO Set UAC = CreateObject^("Shell.Application"^) > "%temp%\OEgetPrivileges.vbs" 
ECHO UAC.ShellExecute "!batchPath!", "ELEV", "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs" 
"%temp%\OEgetPrivileges.vbs" 
exit /B 

:gotPrivileges 
::::::::::::::::::::::::::::
:START
::::::::::::::::::::::::::::
setlocal & pushd .

REM Run shell as admin (example) - put here code as you like

@echo on

net stop NSClientpp 

xcopy "%ProgramFiles%\NSclient++\*.ini" "%ProgramFiles%\NSclient++\backup\"  /i /h /y 

xcopy %0\..\%PROCESSOR_ARCHITECTURE%\*.*  "%ProgramFiles%\NSclient++\" /e /i /h /y
xcopy %0\..\datafiles\*.*  "%ProgramFiles%\NSclient++\" /e /i /h /y

"%ProgramFiles%\NSclient++\nsclient++.exe" -uninstall
"%ProgramFiles%\NSclient++\nsclient++.exe" -install

Net Start NSClientpp

Source: http://stackoverflow.com/questions/7044985/how-can-i-auto-elevate-my-batch-file-so-that-it-requests-from-uac-admin-rights

Rionoskae commented 11 years ago

Ok - I got it :)... FINALLY!

The path is wrong for the install.bat file that gets copied over. Now I just have to figure out where that path is defined....

Currently it is:

c:\temp\nsclient\install.bat

It should be:

c:\temp\nsclient\src\install.bat
Rionoskae commented 11 years ago

K Here is the fix. ( I think only the /windows/install_nsclient.sh needs to be edited )

vim /usr/share/okconfig/client/windows/nsclient/install_nsclient.sh
vim /usr/share/okconfig/client/windows/install_nsclient.sh

Then... edit_install_nsclient_sh

Rionoskae commented 11 years ago

Well resolved running from command line in any case.... web UI still hangs up ;(

Going to try a server restart....maybe I just need to restart services...

Please Re-open this Ticket, as it is not resolved!

Rionoskae commented 11 years ago

Server restart did not fix issue with WebUI Windows Install Agent "Time-out" issue.

Rionoskae commented 11 years ago

Anybody?