NSclient Installtion from CMD

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
vinish098
Posts: 136
Joined: Fri Oct 21, 2016 6:30 am

NSclient Installtion from CMD

Post by vinish098 »

I am trying to automate the installation of nsclient by using below command:

NSCLIENT-0.4.4.23
msiexec /i C:\Users\abcd\Downloads\NSCP-0.4.4.23-x64.msi CONF_CAN_CHANGE=1 ALLOWED_HOSTS=10.0.0.45 NSCLIENT_PWD=redhat CONF_NSCLIENT=1 /quiet

This command working perfectly except the password is not getting updated in "nsclient.ini" file

I tried to provide password in these formats also:- "redhat" 'redhat' `redhat` but its not updating in the file. Can you please help here.

NSCLIENT-0.5.1.44
msiexec /i C:\Users\abcd\Downloads\NSCP-0.5.1.44-x64.msi CONF_CAN_CHANGE=enabled ALLOWED_HOSTS=10.0.0.45 NSCLIENT_PWD="redhat" CONF_NSCLIENT=enabled /quiet

After running this command, If I manually enable few options in nsclient.ini file given below, its working perfectly otherwise not working.
CheckDisk = enabled
CheckSystem = enabled
NSClientServer = enabled

Please give a solution to enable these options as well in a single command.

Thanks in advance.
dwasswa

Re: NSclient Installtion from CMD

Post by dwasswa »

dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: NSclient Installtion from CMD

Post by dwhitfield »

Thanks @Derick Wasswa!

I'd also like to point out that we do not maintain NSClient, so you may get better answers at http://nsclient.org. I am not suggesting we are unwilling to help. We just do not have the deep knowledge of the code like they do.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: NSclient Installtion from CMD

Post by mcapra »

Alternatively, rather than trying to fit all the configuration into a single command-line script, you might look into something like Chef, Puppet, or Ansible. Rather than being at the mercy of what NSClient++ offers as part of it's installer, you could delegate configuration file creation/modification to a process built on any one of those platforms. You could also script out stuff like downloading and setting up specific custom plugins for NSClient++, which I am almost certain cannot be done with the installer alone.
Former Nagios employee
https://www.mcapra.com/
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: NSclient Installtion from CMD

Post by dwhitfield »

mcapra wrote: you might look into something like Chef, Puppet, or Ansible.
This is a great suggestion. I know chef has spent a lot of time with Windows. We have just begun to use ansible here. I suppose if I have a suggestion, it is to look at one of those two.
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: NSclient Installtion from CMD

Post by gormank »

I know its tedious, but after installing, I used to stop the service, copy a standard ini file over the new one, and restart the service.

net stop nscp
sc failure nscp reset= 86400 actions= restart/120000/restart/120000/none/120000
xcopy c:\Temp\nsclient.ini "c:\Program Files\NSClient++\nsclient.ini" /q /y
net start nscp

The sc command changed the service settings so it would restart a few times before giving up.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: NSclient Installtion from CMD

Post by dwhitfield »

Thanks @gormank!
spurrellian
Posts: 43
Joined: Tue Jan 06, 2015 6:26 am
Location: Bath, UK

Re: NSclient Installtion from CMD

Post by spurrellian »

gormank wrote:I know its tedious, but after installing, I used to stop the service, copy a standard ini file over the new one, and restart the service.

net stop nscp
sc failure nscp reset= 86400 actions= restart/120000/restart/120000/none/120000
xcopy c:\Temp\nsclient.ini "c:\Program Files\NSClient++\nsclient.ini" /q /y
net start nscp

The sc command changed the service settings so it would restart a few times before giving up.
This is exactly how I do it, also run checks for OS Architecture and copy plugins accross

Code: Select all

:::: Check OS Architecture ::::
:CheckOS
IF EXIST "%PROGRAMFILES(X86)%" (GOTO 64BIT) ELSE (GOTO 32BIT)


:::: Install 64 Bit ::::
:64BIT
msiexec /i "%~dp0NSCP-0.4.3.143-x64.msi" /qb /norestart ADDDEFAULT=ALL REMOVE=Documentation REMOVE=WEBPlugins

copy "%~dp0nsclient.ini" "C:\Program Files\NSClient++\nsclient.ini" /y

GOTO PLUGIN

:::: Install 32 Bit ::::
:32BIT
msiexec /i "%~dp0NSCP-0.4.3.143-Win32.msi" /qb /norestart ADDDEFAULT=ALL REMOVE=Documentation REMOVE=WEBPlugins
copy "%~dp0nsclient.ini" "C:\Program Files\NSClient++\nsclient.ini" /y

GOTO PLUGIN


:::: Copy Nagios Plugins into Correct Directory ::::

:PLUGIN
IF EXIST "C:\WXScript\Scripts" (GOTO Wessex) ELSE (GOTO NonWessex)

:Wessex
md "C:\WXScript\Scripts\Scripts"
copy "%~dp0restart_auto_services.vbs" "C:\WXScript\Scripts\scripts\restart_auto_services.vbs"/y
copy "%~dp0nm-check-certificate-expiration.ps1" "C:\WXScript\Scripts\scripts\nm-check-certificate-expiration.ps1" /y
copy "%~dp0check_ms_win_updates.ps1" "C:\WXScript\Scripts\scripts\check_ms_win_updates.ps1" /y
copy "%~dp0restart_auto_services.vbs" "C:\Program Files\NSClient++\scripts\restart_auto_services.vbs"/y
copy "%~dp0nm-check-certificate-expiration.ps1" "C:\Program Files\NSClient++\scripts\nm-check-certificate-expiration.ps1" /y
copy "%~dp0check_ms_win_updates.ps1" "C:\Program Files\NSClient++\scripts\check_ms_win_updates.ps1" /y

net stop nscp
net start nscp

GOTO END

:NonWessex
copy "%~dp0restart_auto_services.vbs" "C:\Program Files\NSClient++\scripts\restart_auto_services.vbs"/y
copy "%~dp0nm-check-certificate-expiration.ps1" "C:\Program Files\NSClient++\scripts\nm-check-certificate-expiration.ps1" /y
copy "%~dp0check_ms_win_updates.ps1" "C:\Program Files\NSClient++\scripts\check_ms_win_updates.ps1" /y

net stop nscp
net start nscp

GOTO END

:END
Paul S - Using Nagios XI, Network Analyzer, Log Server
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: NSclient Installtion from CMD

Post by scottwilkerson »

Thanks @spurrellian!
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
vinish098
Posts: 136
Joined: Fri Oct 21, 2016 6:30 am

Re: NSclient Installtion from CMD

Post by vinish098 »

Thanks all for the great suggestions.

I have around 700 windows servers in my environment.

Instead of login to each server and perform NSClient installation, Do we have any other option in order to save time and efforts from where we can push the installation from our Nagios server.
Locked