Nagios & SQL 2013 Monitoring

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
jhagedorn
Posts: 3
Joined: Wed Oct 16, 2013 11:03 am

Nagios & SQL 2013 Monitoring

Post by jhagedorn »

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.. :)
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Nagios & SQL 2013 Monitoring

Post by slansing »

Thank you for the contribution jhagedorn! :)
jhagedorn
Posts: 3
Joined: Wed Oct 16, 2013 11:03 am

Re: Nagios & SQL 2013 Monitoring

Post by jhagedorn »

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
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Nagios & SQL 2013 Monitoring

Post by sreinhardt »

HAHA M$ fully documenting things? :D 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.
jhagedorn
Posts: 3
Joined: Wed Oct 16, 2013 11:03 am

Re: Nagios & SQL 2013 Monitoring

Post by jhagedorn »

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.. :)
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Nagios & SQL 2013 Monitoring

Post by sreinhardt »

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.
Locked