From 1e93de2cac8e67a9ff103a5a95456e4f8400cb56 Mon Sep 17 00:00:00 2001 From: Gardar Thorsteinsson Date: Wed, 30 Jan 2019 11:33:39 +0000 Subject: [PATCH] Added adagios.ini for versioning check, removed Adagios versioning info from registry --- Deploy-Application.ps1 | 25 +++++++++++-------------- SupportFiles/adagios.ini | 5 +++++ SupportFiles/nsclient.ini | 1 + 3 files changed, 17 insertions(+), 14 deletions(-) create mode 100644 SupportFiles/adagios.ini diff --git a/Deploy-Application.ps1 b/Deploy-Application.ps1 index 40c2cef..26ed356 100644 --- a/Deploy-Application.ps1 +++ b/Deploy-Application.ps1 @@ -62,14 +62,14 @@ Try { [string]$appArch = '' [string]$appLang = 'EN' [string]$appRevision = '01' - [string]$appScriptVersion = '1.0.5' + [string]$appScriptVersion = '1.0.0.1' [string]$appScriptDate = '23/01/2019' [string]$appScriptAuthor = 'Gardar Thorsteinsson' ##*=============================================== ## Variables: Install Titles (Only set here to override defaults set by the toolkit) [string]$installName = 'NSClient++ Deployment' [string]$installTitle = '' - [version]$AdagiosRelease = [version]'1.0.5' + [version]$AdagiosAgentVersion = [version]'1.0.0.1' ## Variables: System architecture detection #If([IntPtr]::Size -eq 8) #{ @@ -189,17 +189,14 @@ Try { [string]$installPhase = 'Post-Installation' ## - if((Get-RegistryKey "HKLM:\SOFTWARE\OpinKerfi\Adagios" -Value CurrentVersion) -lt $AdagiosRelease) { - Write-Log -Source $deployAppScriptFriendlyName -Message "Adagios OKconfig templates are < [string]$AdagiosRelease, installing" - Stop-ServiceAndDependencies -Name 'nscp' - Copy-File -Path "$dirSupportFiles\*.*" -Destination "$envProgramFiles\NSClient++\" - Copy-File -Path "$dirSupportFiles\Scripts" -Destination "$envProgramFiles\NSClient++" -Recurse - - # Update registry key for Adagios agent version (OKconfig version) - Set-RegistryKey -Key 'HKEY_LOCAL_MACHINE\SOFTWARE\OpinKerfi\Adagios' -Name 'CurrentVersion' -Value $AdagiosRelease -Type String -ContinueOnError:$True - Start-ServiceAndDependencies -Name 'nscp' - - } + + # nscp settings --path /adagios --key "adagios_agent_version" --show + # nscp settings --path /adagios --key "adagios_agent_version" --set "1.0.0.1" + Stop-ServiceAndDependencies -Name 'nscp' + Copy-File -Path "$dirSupportFiles\*.*" -Destination "$envProgramFiles\NSClient++\" + Copy-File -Path "$dirSupportFiles\Scripts" -Destination "$envProgramFiles\NSClient++" -Recurse + + Start-ServiceAndDependencies -Name 'nscp' ## Display a message at the end of the install If (-not $useDefaultMsi) { Show-InstallationPrompt -Message 'Installation completed successfully. Remember to add the ip address of your Nagios server to the "allowed hosts" variable located in the file $envProgramFiles\NSClient++\allowed_hosts.ini. At last, restart the NSClient++ service.' -ButtonRightText 'OK' -Icon Information -NoWait } @@ -266,4 +263,4 @@ Catch { Write-Log -Message $mainErrorMessage -Severity 3 -Source $deployAppScriptFriendlyName Show-DialogBox -Text $mainErrorMessage -Icon 'Stop' Exit-Script -ExitCode $mainExitCode -} \ No newline at end of file +} diff --git a/SupportFiles/adagios.ini b/SupportFiles/adagios.ini new file mode 100644 index 0000000..9087061 --- /dev/null +++ b/SupportFiles/adagios.ini @@ -0,0 +1,5 @@ +; Adagios agent configuration +; nscp.exe settings --path /adagios --key "adagios_agent_version" --show +; nscp.exe settings --path /adagios --key "adagios_agent_version" --set "1.0.0.1" +[/adagios] +adagios_agent_version = 1.0.0.1 diff --git a/SupportFiles/nsclient.ini b/SupportFiles/nsclient.ini index 879c2c8..1ac1b87 100644 --- a/SupportFiles/nsclient.ini +++ b/SupportFiles/nsclient.ini @@ -225,6 +225,7 @@ vbs = cscript.exe //T:30 //NoLogo scripts\\lib\\wrapper.vbs %SCRIPT% %ARGS% [/includes] allowedhosts=ini://${shared-path}/allowed_hosts.ini wmi=ini://${shared-path}/wmi.ini +adagios=ini://${shared-path}/adagios.ini ; Section for system checks and system settings [/settings/system/windows]