Skip to content

Commit

Permalink
Silent Windows Uninstaller (#577)
Browse files Browse the repository at this point in the history
* Change default directory to Program Files and add silent uninstall.

* Update changelog.

* Update directory for defaults in doc.

* Change ordering of "changes"
  • Loading branch information
mattdurham authored May 3, 2021
1 parent 98c65b1 commit 9038739
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ service config.
- [FEATURE] Disallow reading files from within scraping service configs by
default. (@rfratto)

- [ENHANCEMENT] Add silent uninstall to Windows Uninstaller. (@mattdurham)

- [BUGFIX] Ensure defaults are applied to undefined sections in config file.
This fixes a problem where integrations didn't work if `prometheus:` wasn't
configured. (@rfratto)

- [BUGFIX] Use 64 bit Program Files when installing on Windows. (@mattdurham)

- [BUGFIX] Re-read `prometheus.global` settings when calling /-/reload.
(@rfratto)
Expand Down
8 changes: 4 additions & 4 deletions docs/windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

## Overview

The installer will install Grafana Agent into the default directory `C:\Program Files (x86)\Grafana Agent`. The [windows_exporter integration](https://github.com/prometheus-community/windows_exporter) can be enabled with all default windows_exporter options.
The installer will install Grafana Agent into the default directory `C:\Program Files\Grafana Agent`. The [windows_exporter integration](https://github.com/prometheus-community/windows_exporter) can be enabled with all default windows_exporter options.

## Installation

After installation, ensure that you can reach `http://localhost:12345/-/healthy` and `http://localhost:12345/agent/api/v1/targets`.

After installation, you can adjust `C:\Program Files (x86)\Grafana Agent\agent-config.yaml` to meet your specific needs. After changing the configuration file, the Grafana Agent service must be restarted to load changes to the configuration.
After installation, you can adjust `C:\Program Files\Grafana Agent\agent-config.yaml` to meet your specific needs. After changing the configuration file, the Grafana Agent service must be restarted to load changes to the configuration.

Existing configuration files will be kept when re-installing or upgrading the Grafana Agent.

Expand All @@ -18,7 +18,7 @@ Silent installation can be achieved via `grafana-agent-installer.exe /S /Enabl

## Security

A configuration file for the Agent is provided by default at `C:\Program Files (x86)\Grafana Agent`. Depending on your configuration, you may wish to modify the default permissions of the file or move it to another directory.
A configuration file for the Agent is provided by default at `C:\Program Files\Grafana Agent`. Depending on your configuration, you may wish to modify the default permissions of the file or move it to another directory.

When changing the location of the configuration file, you must update the Grafana Agent service to load the new path. Run the following in an elevated prompt, replacing `<new_path>` with the full path holding `agent-config.yaml`:

Expand All @@ -28,7 +28,7 @@ sc config "Grafana Agent" binpath= "<installed_directory>\agent-windows-amd64.ex

## Uninstall

If the Grafana Agent is installed using the installer, it can be uninstalled via Windows' Remove Programs or `C:\Program Files (x86)\Grafana Agent\uninstaller.exe`. Uninstalling the Agent will stop the service and remove it from disk. This will include any configuration files in the installation directory.
If the Grafana Agent is installed using the installer, it can be uninstalled via Windows' Remove Programs or `C:\Program Files\Grafana Agent\uninstaller.exe`. Uninstalling the Agent will stop the service and remove it from disk. This will include any configuration files in the installation directory. Grafana Agent can be silently uninstalled by executing `uninstall.exe /S` while running as Administrator.

## Logs

Expand Down
17 changes: 10 additions & 7 deletions packaging/windows/install_script.nsis
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Unicode true

RequestExecutionLevel admin #Require admin rights on NT6+ (When UAC is turned on)

InstallDir "$PROGRAMFILES\${APPNAME}"
InstallDir "$PROGRAMFILES64\${APPNAME}"

# This will be in the installer/uninstaller's title bar
Name "${APPNAME} ${VERSION}"
Expand Down Expand Up @@ -156,12 +156,15 @@ FunctionEnd
# Uninstaller
Function un.onInit
SetShellVarContext all

#Verify the uninstaller - last chance to back out
MessageBox MB_OKCANCEL "Permanantly remove ${APPNAME}? This will remove the WAL and the agent config." IDOK next
Abort
next:
!insertmacro VerifyUserIsAdmin
IfSilent ThisIsSilent WarnUser
ThisIsSilent:
Return
WarnUser:
#Verify the uninstaller - last chance to back out
MessageBox MB_OKCANCEL "Permanantly remove ${APPNAME}? This will remove the WAL and the agent config." IDOK next
Abort
next:
!insertmacro VerifyUserIsAdmin
FunctionEnd

Section "uninstall"
Expand Down

0 comments on commit 9038739

Please sign in to comment.