This might help out anyone tring to monitor "SQL 2013 Always-On"..
Setup Nagios to call local command: sqlps -Command "&{C:\Scripts\AvailableGroupStatus.ps1}"
Replace "SERVERNAME" with your SQL ServerName
Replace "SQLINSTANCE" with your SQL InstanceName
Replace "AVAILGROUPNAME" with your SQL AvailableGroup Name to check
-------
AvailableGroupStatus.ps1
-------
cd SQLSERVER:\SQL\"SERVERNAME"\"SQLINSTANCE"\AvailabilityGroups
$Results = Test-SqlAvailabilityGroup "AVAILGROUPNAME" | Select HealthState
if($Results.HealthState -eq "Healthy"){
$Output = "OK: AvailabilityGroup Databases are Healthy"
}else{
$Output = $Results.HealthState + " - Error"
$statFlag = 1
}
Write-Host $Output
if($statFlag -eq 1){
exit 2
}else{
exit 0
}
exit
If you have any questions.. Just YELL..
Nagios & SQL 2013 Monitoring
-
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: Nagios & SQL 2013 Monitoring
Thank you for the contribution jhagedorn!
Re: Nagios & SQL 2013 Monitoring
It is not FULLY documented.. But if you have setup remote powershell scripts, it should be ok.. There are other PSSQL commands.. http://technet.microsoft.com/en-us/libr ... 78391.aspx
-
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Nagios & SQL 2013 Monitoring
HAHA M$ fully documenting things? Nice script though!!
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Re: Nagios & SQL 2013 Monitoring
Im going to modify this to pass 3 parameters HostName/Instance/AvailabityGroup... Ill update it, when I get it working.. LOL Unless someone was to do my task..
-
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Nagios & SQL 2013 Monitoring
Have at it man! Params at the beginning of the script should handle most of that looking at your current code.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.