Skip to content

Commit

Permalink
Merge pull request #6 from opinkerfi/okconfig_versioning
Browse files Browse the repository at this point in the history
Added adagios.ini for versioning check, removed Adagios versioning in…
  • Loading branch information
gardart authored Jan 30, 2019
2 parents 1a03b51 + 1e93de2 commit 1823a83
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
25 changes: 11 additions & 14 deletions Deploy-Application.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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<[email protected]>'
##*===============================================
## 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)
#{
Expand Down Expand Up @@ -189,17 +189,14 @@ Try {
[string]$installPhase = 'Post-Installation'

## <Perform Post-Installation tasks here>
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 }
Expand Down Expand Up @@ -266,4 +263,4 @@ Catch {
Write-Log -Message $mainErrorMessage -Severity 3 -Source $deployAppScriptFriendlyName
Show-DialogBox -Text $mainErrorMessage -Icon 'Stop'
Exit-Script -ExitCode $mainExitCode
}
}
5 changes: 5 additions & 0 deletions SupportFiles/adagios.ini
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions SupportFiles/nsclient.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 1823a83

Please sign in to comment.