configure DB failover log in Nagios XI

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
pbachu2
Posts: 27
Joined: Mon Jun 24, 2019 11:33 pm

configure DB failover log in Nagios XI

Post by pbachu2 »

Hi All,

Can anyone suggest if we can monitor the DB failover log in Nagios XI.

Regards,
Priyanka Bachu
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: configure DB failover log in Nagios XI

Post by mbellerue »

Is this a Microsoft SQL Server failover database? Is there a query or command that you run right now to find the failover status?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
pbachu2
Posts: 27
Joined: Mon Jun 24, 2019 11:33 pm

Re: configure DB failover log in Nagios XI

Post by pbachu2 »

Hi,

We are keeping stored procedure and declaring it in service in the host.cfg

Stored procedure : SP - exec [instance_stats].[dbo].[AGDetect]
Service command :
check_command check_mssql_health!TWRUAT.EXT!sql --name "`cat /etc/nagios/database-queries/dc1uat101-DB-AvailableGroups.sql`" --name2 'AvailableGroups' --critical "SECONDARY"
check_command check_mssql_health!TWRUAT.EXT!sql --name "`cat /etc/nagios/database-queries/dc1uat101-DB-AvailableGroups.sql`" --name2 'AvailableGroups' --units 'Results' --critical 'SECONDARY'


Requirement from user :
Below are the details of storeproc and servers.

SP - exec [instance_stats].[dbo].[AGDetect]
Server- DC1UAT101

Below is the snip for output of above storeproc. Configure alert on DC1UAT101, If value is PRIMARY, Set alert to Green / OK. If any value other than this, it should be CRITICAL.
You do not have the required permissions to view the files attached to this post.
User avatar
mbellerue
Posts: 1403
Joined: Fri Jul 12, 2019 11:10 am

Re: configure DB failover log in Nagios XI

Post by mbellerue »

Okay, this looks great. You've got a single field that tells you whether the server is PRIMARY or SECONDARY. I've got a similar table and entry on my MS SQL system. Here's what it looks like when I run a check from the command line.

Code: Select all

/usr/local/nagios/libexec/check_mssql -H 192.168.145.90 --username "sa" --password "Temp1234" --database testnagios --port 1433 --query "select mytext from testtable" --decode --result "PRIMARY"

array(1) {
  [0]=>
  array(1) {
    ["mytext"]=>
    string(7) "PRIMARY"
  }
}
OK: Query results matched "PRIMARY", Query duration=0.000449 seconds.|query_duration=0.000449s;; 'mytext'=PRIMARY;
So in the above command, if the result from the query showed anything other than PRIMARY, it would go critical. Also, since you already have a stored procedure, you might try the stored procedure flag, rather than the --query flag.

-s, --storedproc Optional stored procedure to execute on MSSQL server.

Try that command out and see if it suits your needs.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked