mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-21 07:10:15 -05:00
Merge pull request #468 from Icinga:feature/adds_pid_to_show_icinga
Feature: Adds PID to Show-Icinga Adds pid information to Show-Icinga and improves Icinga for Windows certificate output.
This commit is contained in:
commit
7b1436dbef
2 changed files with 28 additions and 4 deletions
|
|
@ -37,6 +37,8 @@ function Show-Icinga()
|
||||||
$JEAContext = Get-IcingaJEAContext;
|
$JEAContext = Get-IcingaJEAContext;
|
||||||
$JEASessionFile = Get-IcingaJEASessionFile;
|
$JEASessionFile = Get-IcingaJEASessionFile;
|
||||||
$IcingaForWindowsCert = Get-IcingaForWindowsCertificate;
|
$IcingaForWindowsCert = Get-IcingaForWindowsCertificate;
|
||||||
|
$ServicePid = Get-IcingaForWindowsServicePid;
|
||||||
|
$JEAServicePid = Get-IcingaJEAServicePid;
|
||||||
|
|
||||||
if ([string]::IsNullOrEmpty($DefinedServiceUser)) {
|
if ([string]::IsNullOrEmpty($DefinedServiceUser)) {
|
||||||
$DefinedServiceUser = '';
|
$DefinedServiceUser = '';
|
||||||
|
|
@ -47,8 +49,11 @@ function Show-Icinga()
|
||||||
if ([string]::IsNullOrEmpty($JEASessionFile)) {
|
if ([string]::IsNullOrEmpty($JEASessionFile)) {
|
||||||
$JEASessionFile = '';
|
$JEASessionFile = '';
|
||||||
}
|
}
|
||||||
if ($null -eq $IcingaForWindowsCert -Or [string]::IsNullOrEmpty($IcingaForWindowsCert)) {
|
if ([string]::IsNullOrEmpty($ServicePid)) {
|
||||||
$IcingaForWindowsCert = 'Not installed';
|
$ServicePid = '';
|
||||||
|
}
|
||||||
|
if ([string]::IsNullOrEmpty($JEAServicePid)) {
|
||||||
|
$JEAServicePid = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$Output += '';
|
$Output += '';
|
||||||
|
|
@ -57,6 +62,8 @@ function Show-Icinga()
|
||||||
$Output += ([string]::Format('PowerShell Root => {0}', (Get-IcingaForWindowsRootPath)));
|
$Output += ([string]::Format('PowerShell Root => {0}', (Get-IcingaForWindowsRootPath)));
|
||||||
$Output += ([string]::Format('Icinga for Windows Service Path => {0}', $IcingaForWindowsService.Directory));
|
$Output += ([string]::Format('Icinga for Windows Service Path => {0}', $IcingaForWindowsService.Directory));
|
||||||
$Output += ([string]::Format('Icinga for Windows Service User => {0}', $IcingaForWindowsService.User));
|
$Output += ([string]::Format('Icinga for Windows Service User => {0}', $IcingaForWindowsService.User));
|
||||||
|
$Output += ([string]::Format('Icinga for Windows Service Pid => {0}', $ServicePid));
|
||||||
|
$Output += ([string]::Format('Icinga for Windows JEA Pid => {0}', $JEAServicePid));
|
||||||
$Output += ([string]::Format('Icinga Agent Path => {0}', $IcingaAgentService.RootDir));
|
$Output += ([string]::Format('Icinga Agent Path => {0}', $IcingaAgentService.RootDir));
|
||||||
$Output += ([string]::Format('Icinga Agent User => {0}', $IcingaAgentService.User));
|
$Output += ([string]::Format('Icinga Agent User => {0}', $IcingaAgentService.User));
|
||||||
$Output += ([string]::Format('Defined Default User => {0}', $DefinedServiceUser));
|
$Output += ([string]::Format('Defined Default User => {0}', $DefinedServiceUser));
|
||||||
|
|
@ -69,9 +76,15 @@ function Show-Icinga()
|
||||||
$Output += ([string]::Format('Api Check Forwarder => {0}', (Get-IcingaFrameworkApiChecks)));
|
$Output += ([string]::Format('Api Check Forwarder => {0}', (Get-IcingaFrameworkApiChecks)));
|
||||||
$Output += ([string]::Format('Debug Mode => {0}', (Get-IcingaFrameworkDebugMode)));
|
$Output += ([string]::Format('Debug Mode => {0}', (Get-IcingaFrameworkDebugMode)));
|
||||||
$Output += '';
|
$Output += '';
|
||||||
$Output += 'Icinga for Windows Certificate';
|
$Output += 'Icinga for Windows Certificate:';
|
||||||
$Output += '';
|
$Output += '';
|
||||||
$Output += $IcingaForWindowsCert;
|
if ($null -eq $IcingaForWindowsCert -Or [string]::IsNullOrEmpty($IcingaForWindowsCert)) {
|
||||||
|
$Output += 'Not installed';
|
||||||
|
} else {
|
||||||
|
$Output += ([string]::Format('Issuer => {0}', ($IcingaForWindowsCert.Issuer)));
|
||||||
|
$Output += ([string]::Format('Subject => {0}', ($IcingaForWindowsCert.Subject)));
|
||||||
|
}
|
||||||
|
|
||||||
$Output += '';
|
$Output += '';
|
||||||
|
|
||||||
$Output += (Show-IcingaRegisteredBackgroundDaemons);
|
$Output += (Show-IcingaRegisteredBackgroundDaemons);
|
||||||
|
|
|
||||||
11
lib/daemon/Get-IcingaForWindowsServicePid.psm1
Normal file
11
lib/daemon/Get-IcingaForWindowsServicePid.psm1
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
function Get-IcingaForWindowsServicePid()
|
||||||
|
{
|
||||||
|
[string]$PidFile = (Join-Path -Path (Get-IcingaCacheDir) -ChildPath 'service.pid');
|
||||||
|
[string]$IfWPid = Read-IcingaFileSecure -File $PidFile;
|
||||||
|
|
||||||
|
if ([string]::IsNullOrEmpty($IfWPid) -eq $FALSE) {
|
||||||
|
$IfWPid = $IfWPid.Replace("`r`n", '').Replace("`n", '').Replace(' ', '');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $IfWPid;
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue