# Microsoft Skype for Business Server - Management Store Replication Status Check # # Info: # This NSCP (former known as NSClient++) plugin will check the Management Store Replication Status on the SfB Frontend Server where it is running on. # # This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # Revision History: # Version 1.0: 2016-05-21 Bastian W. [Bastian@gmx-ist-cool.de] # * initial version # # # Info: # This powershell plugin for the NSClient++ can be used to monitor the management store replication from a Microsoft Lync 2013 Server # # # FAQ: # How To solve "cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help about_signing" for more details." # See: http://technet.microsoft.com/en-us/library/ee176949.aspx [a possible solution would be 'Set-ExecutionPolicy RemoteSigned'] # # Installation: # # 1.) # Create a folder on C:\ called "NagiosMonitoring" if it didn´t exist, and put this script into that folder. # # Note: If you use another Foldername, you need to change this script completly! # # 2.) # Now start a Powershell and run the following comands (to test if the script is working for you) # "C:" # "cd NagiosMonitoring" # ".\NagiosMonitoring_SfB_ManagementStoreReplicationStatus.ps1" # # 3.) # Add this script to the NSClient++ configuration (file: NSC.ini) # # [External Scripts] # SfBManagementStoreReplicationStatusCheck=cmd /c echo C:\NagiosMonitoring\NagiosMonitoring_SfB_ManagementStoreReplicationStatus.ps1 | PowerShell.exe -Command - # # # 4.) # uncommend CheckExternalScripts.dll in the NSClient++ configuration (file: NSC.ini) # # 5.) # restart the NSClient++ Service # # 6.) # Add the script to your nagios environment # ========================================================================================================================= # # ------------- Do not change anything behind that line ! ---------------------------- # # # Buildinfo: # $status = 0; $desc = ""; $Result =""; # Get-CsManagementStoreReplicationStatus -CentralManagementStoreStatus # http://support.microsoft.com/en-us/kb/2759117 # https://technet.microsoft.com/en-us/library/gg398292.aspx # Get-CsManagementStoreReplicationStatus # $sServerFQND = [System.Net.Dns]::GetHostEntry([string]$env:computername).HostName # Get-CsManagementStoreReplicationStatus -ReplicaFqdn $sServerFQND # Test: Get-CsManagementStoreReplicationStatus | Select-Object $sServerFQND = [System.Net.Dns]::GetHostEntry([string]$env:computername).HostName # Get the FQND here, we require that for the Get-CsManagementStoreReplicationStatus ForEach ($Result in Get-CsManagementStoreReplicationStatus -ReplicaFqdn $sServerFQND | Select-Object UpToDate) { if($Result.UpToDate -like "True") { $status = 0; $desc="Management store replication status up to date" } elseif($Result.UpToDate -like "False") { $status=2; $desc="Management store replication status NOT up to date" } else { # Somethings up.. $status=2; $desc="Unknown Failure" } } if ($status -eq "2") { Write-Host "CRITICAL: "$desc } elseif ($status -eq "0") { Write-Host "OK: "$desc } exit $status;