Merge pull request #7463 from Icinga/feature/docs-powershell

Docs: Prefer the Powershell commands on Windows
This commit is contained in:
Michael Friedrich 2019-08-30 14:21:19 +02:00 committed by GitHub
commit 22243c10e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 56 additions and 22 deletions

View File

@ -916,20 +916,26 @@ the following line:
> Packages >= 2.9 provide an option in the setup wizard to disable this. > Packages >= 2.9 provide an option in the setup wizard to disable this.
> Defaults to disabled. > Defaults to disabled.
Validate the configuration on Windows open an administrator terminal Validate the configuration on Windows open an administrative Powershell
and run the following command: and run the following command:
``` ```
C:\WINDOWS\system32>cd "C:\Program Files\ICINGA2\sbin" C:\> cd C:\Program Files\ICINGA2\sbin
C:\Program Files\ICINGA2\sbin>icinga2.exe daemon -C
C:\Program Files\ICINGA2\sbin> .\icinga2.exe daemon -C
``` ```
**Note**: You have to run this command in a shell with `administrator` privileges. **Note**: You have to run this command in a shell with `administrator` privileges.
Now you need to restart the Icinga 2 service. Run `services.msc` from the start menu Now you need to restart the Icinga 2 service. Run `services.msc` from the start menu and restart the `icinga2` service.
and restart the `icinga2` service. Alternatively, you can use the `net {start,stop}` CLI commands. Alternatively open an administrative Powershell and run the following commands:
```
C:\> Restart-Service icinga2
C:\> Get-Service icinga2
```
![Icinga 2 Windows Service Start/Stop](images/distributed-monitoring/icinga2_windows_cmd_admin_net_start_stop.png)
Now that you've successfully installed a Windows agent, please proceed to Now that you've successfully installed a Windows agent, please proceed to
the [detailed configuration modes](06-distributed-monitoring.md#distributed-monitoring-configuration-modes). the [detailed configuration modes](06-distributed-monitoring.md#distributed-monitoring-configuration-modes).
@ -2679,7 +2685,7 @@ By default ICMP requests are disabled in the Windows firewall. You can
change that by [adding a new rule](https://support.microsoft.com/en-us/kb/947709). change that by [adding a new rule](https://support.microsoft.com/en-us/kb/947709).
``` ```
C:\WINDOWS\system32>netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=allow C:\> netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=allow
``` ```
#### Icinga 2 <a id="distributed-monitoring-windows-firewall-icinga2"></a> #### Icinga 2 <a id="distributed-monitoring-windows-firewall-icinga2"></a>
@ -2688,7 +2694,7 @@ If your master/satellite nodes should actively connect to the Windows agent
you'll also need to ensure that port `5665` is enabled. you'll also need to ensure that port `5665` is enabled.
``` ```
C:\WINDOWS\system32>netsh advfirewall firewall add rule name="Open port 5665 (Icinga 2)" dir=in action=allow protocol=TCP localport=5665 C:\> netsh advfirewall firewall add rule name="Open port 5665 (Icinga 2)" dir=in action=allow protocol=TCP localport=5665
``` ```
#### NSClient++ API <a id="distributed-monitoring-windows-firewall-nsclient-api"></a> #### NSClient++ API <a id="distributed-monitoring-windows-firewall-nsclient-api"></a>
@ -2697,7 +2703,7 @@ If the [check_nscp_api](06-distributed-monitoring.md#distributed-monitoring-wind
plugin is used to query NSClient++, you need to ensure that its port is enabled. plugin is used to query NSClient++, you need to ensure that its port is enabled.
``` ```
C:\WINDOWS\system32>netsh advfirewall firewall add rule name="Open port 8443 (NSClient++ API)" dir=in action=allow protocol=TCP localport=8443 C:\> netsh advfirewall firewall add rule name="Open port 8443 (NSClient++ API)" dir=in action=allow protocol=TCP localport=8443
``` ```
For security reasons, it is advised to enable the NSClient++ HTTP API for local For security reasons, it is advised to enable the NSClient++ HTTP API for local
@ -2709,14 +2715,6 @@ are not recommended with using the legacy HTTP API.
The Icinga 2 package on Windows already provides several plugins. The Icinga 2 package on Windows already provides several plugins.
Detailed [documentation](10-icinga-template-library.md#windows-plugins) is available for all check command definitions. Detailed [documentation](10-icinga-template-library.md#windows-plugins) is available for all check command definitions.
Add the following `include` statement on all your nodes (master, satellite, agent):
```
vim /etc/icinga2/icinga2.conf
include <windows-plugins>
```
Based on the [master with agents](06-distributed-monitoring.md#distributed-monitoring-master-agents) Based on the [master with agents](06-distributed-monitoring.md#distributed-monitoring-master-agents)
scenario we'll now add a local disk check. scenario we'll now add a local disk check.

View File

@ -108,6 +108,16 @@ You can also start `perfmon` and analyze specific performance counters.
Keep notes which could be important for your monitoring, and add service Keep notes which could be important for your monitoring, and add service
checks later on. checks later on.
> **Tip**
>
> Use an administrative Powershell to gain more insights.
```
cd C:\ProgramData\icinga2\var\log\icinga2
Get-Content .\icinga2.log -tail 10 -wait
```
## Enable Debug Output <a id="troubleshooting-enable-debug-output"></a> ## Enable Debug Output <a id="troubleshooting-enable-debug-output"></a>
### Enable Debug Output on Linux/Unix <a id="troubleshooting-enable-debug-output-linux"></a> ### Enable Debug Output on Linux/Unix <a id="troubleshooting-enable-debug-output-linux"></a>
@ -121,6 +131,13 @@ Enable the `debuglog` feature:
The debug log file can be found in `/var/log/icinga2/debug.log`. The debug log file can be found in `/var/log/icinga2/debug.log`.
You can tail the log files with an administrative shell:
```
cd /var/log/icinga2
tail -f debug.log
```
Alternatively you may run Icinga 2 in the foreground with debugging enabled. Specify the console Alternatively you may run Icinga 2 in the foreground with debugging enabled. Specify the console
log severity as an additional parameter argument to `-x`. log severity as an additional parameter argument to `-x`.
@ -133,18 +150,29 @@ and `debug`.
### Enable Debug Output on Windows <a id="troubleshooting-enable-debug-output-windows"></a> ### Enable Debug Output on Windows <a id="troubleshooting-enable-debug-output-windows"></a>
Open a command prompt with administrative privileges and enable the debug log feature. Open a Powershell with administrative privileges and enable the debug log feature.
``` ```
C:> icinga2.exe feature enable debuglog C:\> cd C:\Program Files\ICINGA2\sbin
C:\Program Files\ICINGA2\sbin> .\icinga2.exe feature enable debuglog
``` ```
Ensure that the Icinga 2 service already writes the main log into `C:\ProgramData\icinga2\var\log\icinga2`. Ensure that the Icinga 2 service already writes the main log into `C:\ProgramData\icinga2\var\log\icinga2`.
Restart the Icinga 2 service and open the newly created `debug.log` file. Restart the Icinga 2 service in an administrative Powershell and open the newly created `debug.log` file.
``` ```
C:> net stop icinga2 C:\> Restart-Service icinga2
C:> net start icinga2
C:\> Get-Service icinga2
```
You can tail the log files with an administrative Powershell:
```
C:\> cd C:\ProgramData\icinga2\var\log\icinga2
C:\ProgramData\icinga2\var\log\icinga2> Get-Content .\debug.log -tail 10 -wait
``` ```
## Configuration Troubleshooting <a id="troubleshooting-configuration"></a> ## Configuration Troubleshooting <a id="troubleshooting-configuration"></a>
@ -188,6 +216,14 @@ Object 'localhost!ssh' of type 'Service':
[...] [...]
``` ```
On Windows, use an administrative Powershell:
```
C:\> cd C:\Program Files\ICINGA2\sbin
C:\Program Files\ICINGA2\sbin> .\icinga2.exe object list
```
You can also filter by name and type: You can also filter by name and type:
``` ```

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB