Problem with MsSql
Tom DE BLENDE
Tom.DeBlende at dhl.com
Fri Jun 6 08:29:08 CEST 2003
I have written a small script back when I had to test replication.
Here it is (quite ugly and not adjusted for publication). You will
have to change stuff inside the script, but it will get you started
(username, password, SOURCESERVER, TARGETSERVER, ReplicatedDatabase).
The script requires a working freetds and sqsh.
I might rewrite it later on, but really don't have the time now (too
busy at work and Belgian national party at Rolland Garros this Saturday).
<code>
#!/bin/sh
hostname=$1
tempfile=/tmp/sqlrepl-$hostname.tmp
exit="-1"
if [ "$hostname" == "" ]; then
echo -e "\nYou did not supply enough arguments. \nUsage:
./check_sql_repl.sh <host> \n \nCheck_sql_repl.sh checks whether the
online database replication is still running. \nIt was written by Tom
De Blende in 2002. \n" && exit "-1"
fi
/usr/local/bin/sqsh -S $hostname -U username -P password -C sp_who2 >
$tempfile
tmp=`/bin/cat $tempfile`
if [ -z "$tmp" ]; then
stdio="Could not make connection to SQL server." && /bin/rm
-f $tempfile && echo $stdio && exit 1;
fi
lines=`/bin/cat $tempfile | grep
"SOURCESERVER-ReplicatedDatabase-TARGETSERVER-1" | wc -l`;
if [ "$lines" -eq "1" ]; then
exit="0" && stdio="Online replication of ReplicatedDatabase
database is up and running.";
elif [ "$lines" -eq "0" ]; then
exit="2" && stdio="Online replication of the
ReplicatedDatabase database stopped!";
else
exit="-1" && stdio="Unable to check for online replication.";
fi
/bin/rm -f $tempfile
echo $stdio
exit $exit
</code>
Mattw wrote:
> Steve I'm looking for something with MS SQL as well. I'm trying to be able to monitor my SQL replication between two locations. I'm reading up on doing this but if you gather any info or if anyone has any info on this let me know. I'm pretty much doing what you have done so far (learning as I go on it.)
> So any guidance would be great for a fairly newbie.
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Etnus, makers of TotalView, The best
> thread debugger on the planet. Designed with thread debugging features
> you've never dreamed of, try TotalView 6 free at www.etnus.com.
> _______________________________________________
> Nagios-users mailing list
> Nagios-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users
> ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
> ::: Messages without supporting info will risk being sent to /dev/null
-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list