<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://petersap.nl/SybaseWiki/index.php?action=history&amp;feed=atom&amp;title=Nagios_plugin_for_BackupServer</id>
		<title>Nagios plugin for BackupServer - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://petersap.nl/SybaseWiki/index.php?action=history&amp;feed=atom&amp;title=Nagios_plugin_for_BackupServer"/>
		<link rel="alternate" type="text/html" href="http://petersap.nl/SybaseWiki/index.php?title=Nagios_plugin_for_BackupServer&amp;action=history"/>
		<updated>2026-04-04T21:14:29Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.24.2</generator>

	<entry>
		<id>http://petersap.nl/SybaseWiki/index.php?title=Nagios_plugin_for_BackupServer&amp;diff=1732&amp;oldid=prev</id>
		<title>Psap at 08:25, 27 December 2007</title>
		<link rel="alternate" type="text/html" href="http://petersap.nl/SybaseWiki/index.php?title=Nagios_plugin_for_BackupServer&amp;diff=1732&amp;oldid=prev"/>
				<updated>2007-12-27T08:25:00Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;When you are using Nagios (http://www.nagios.org) as a monitoring tool, it's real easy to implement your own checks for Sybase servers. Here's a sample check to see if your Sybase BackupServer is up and connectable.&lt;br /&gt;
&lt;br /&gt;
===Create Nagios check script===&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 # Plugin for Nagios to check if a BackupServer is up&lt;br /&gt;
 # Author Peter Sap (www.petersap.nl)&lt;br /&gt;
 # All disclamers apply.&lt;br /&gt;
 &lt;br /&gt;
 if [ $# -ne 1 ]&lt;br /&gt;
 then&lt;br /&gt;
   echo &amp;quot;Usage $0: &amp;lt;Backup server&amp;gt;&amp;quot;&lt;br /&gt;
   exit 1&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
 SERVER=$1&lt;br /&gt;
 &lt;br /&gt;
 STATE_OK=0&lt;br /&gt;
 STATE_WARNING=1&lt;br /&gt;
 STATE_CRITICAL=2&lt;br /&gt;
 STATE_UNKNOWN=3&lt;br /&gt;
 STATE_DEPENDENT=4&lt;br /&gt;
 &lt;br /&gt;
 export  SYBASE=&amp;lt;location of OpenClient software&amp;gt;&lt;br /&gt;
 export  SYBASE_OCS=OCS-15_0&lt;br /&gt;
 &lt;br /&gt;
 $SYBASE/$SYBASE_OCS/bin/isql -Unagios -Pnagios -S${SERVER} -b&amp;lt;&amp;lt;EOF &amp;gt; /tmp/$$&lt;br /&gt;
 sp_who&lt;br /&gt;
 go&lt;br /&gt;
 EOF&lt;br /&gt;
 &lt;br /&gt;
 if [ `head -n 1 /tmp/$$|grep &amp;quot;CT-LIBRARY&amp;quot;|wc -l` -gt 0 ]&lt;br /&gt;
 then&lt;br /&gt;
   rm -f /tmp/$$&lt;br /&gt;
   echo &amp;quot;Could not connect to ${SERVER}.&amp;quot;&lt;br /&gt;
   exit ${STATE_CRITICAL}&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
 MSG=&amp;quot;`head -n 1 /tmp/$$`&amp;quot;&lt;br /&gt;
 if [ `echo ${MSG}|grep &amp;quot;No language handler installed&amp;quot;|wc -l` -ne 1 ]&lt;br /&gt;
 then&lt;br /&gt;
   rm -f /tmp/$$&lt;br /&gt;
   echo &amp;quot;State of backupserver unknown, ${MSG}&amp;quot;&lt;br /&gt;
   exit ${STATE_CRITICAL}&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
 rm -f /tmp/$$&lt;br /&gt;
 &lt;br /&gt;
 echo &amp;quot;Server ${SERVER} up&amp;quot;&lt;br /&gt;
 exit ${STATE_OK}&lt;br /&gt;
&lt;br /&gt;
Store this script in the Nagios libexec directory with the name &amp;quot;check_sybase_backup_up&amp;quot; . Do a &amp;quot;chmod +x&amp;quot; to make it executable.&lt;br /&gt;
&lt;br /&gt;
==Setup Sybase environment==&lt;br /&gt;
Before you go further, check if you have Sybase OpenClient software installed on the server where Nagios is running.&lt;br /&gt;
&lt;br /&gt;
Add the servers you want to monitor to the $SYBASE/interfaces file. Sample:&lt;br /&gt;
 SYB_BACKUP&lt;br /&gt;
    query tcp ether prd-syb-ase1 4001&lt;br /&gt;
The interfaces file must be stored on the machine where Nagios is running.&lt;br /&gt;
&lt;br /&gt;
==Edit Nagios files==&lt;br /&gt;
Define the &amp;quot;check_sybase_backup_up&amp;quot; script in the definition file for commands, e.g. checkcommands.cfg&lt;br /&gt;
 # 'check_sybase_backup_up' command definition&lt;br /&gt;
 define  command{&lt;br /&gt;
         command_name    check_sybase_backup_up&lt;br /&gt;
         command_line    $USER1$/check_sybase_backup_up $ARG1$&lt;br /&gt;
         }&lt;br /&gt;
&lt;br /&gt;
Now you can use the command as a service check. Add this sample to the definition file for your checks, to check the SYB_BACKUP server.&lt;br /&gt;
&lt;br /&gt;
 define service{&lt;br /&gt;
        use                     generic-service&lt;br /&gt;
        host_name               prd-syb-ase1&lt;br /&gt;
        service_description     SYB_BACKUP&lt;br /&gt;
        is_volatile             0&lt;br /&gt;
        check_period            24x7&lt;br /&gt;
        max_check_attempts      4&lt;br /&gt;
        normal_check_interval   5&lt;br /&gt;
        retry_check_interval    1&lt;br /&gt;
        contact_groups          admins&lt;br /&gt;
        notification_options    w,u,c,r&lt;br /&gt;
        notification_interval   960&lt;br /&gt;
        notification_period     24x7&lt;br /&gt;
        check_command           check_sybase_backup_up!SYB_BACKUP&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
Restart Nagios.&lt;br /&gt;
&lt;br /&gt;
[[category:ASE]]&lt;/div&gt;</summary>
		<author><name>Psap</name></author>	</entry>

	</feed>