Benutzer-Werkzeuge

Webseiten-Werkzeuge


sep_sesam

Dies ist eine alte Version des Dokuments!


SEP Sesam

Nagios

Sesam Updatepfade

Linux3.0 → 3.4 → 3.6 → 4.x
windows3.0 → 3.2 → 3.4 → 3.6 → 4.x

Sesam auf Synology NAS

Hat man ein Synology-NAS-System mit einem Atom oder anderen Intel Prozessor so kann man dort des Sesam Client installieren.

Sesam Client auf einem Synology NAS

Sesam Tips

Problem: Warnings im Sesam Backup. Die Lösung ist passende Excludes zu setzten:

\./var/opt/sesam/var/work$,\./var/opt/sesam/var/log$,\./var/opt/sesam/var/tmp$,\./var/opt/sesam/var/glbv$

Problem: Queues sind nicht vorhanden, Meldung: A queue with that name does not exist

sm_config_drives

Client-Seup Leider wird von den Sesam-Setup-Programmen der Server nicht berechtigt auf den Client zuzugreifen und wenn man SSH nutzen möchte wird der Server-Key nicht übertragen. Der folgende Befehl schreibt alle nötige in die sm_ctrld.auth und überträgt den SSH-Publc-Key des Servers in die „authorized_keys“ des Clients.

/opt/sesam/bin/sesam/sm_setup set_client <server-hostname>

Problem: Datastore enthält mehr Safesets als in der Datenbank verzeichnet sind.

# prüfen (3 = Laufwerk)
sm_data_store check_db -d 3
# überflüssige löschen (3 = Laufwerk)
sm_data_store check_db -d 3 -o remove_ds

GUI-Client authorisieren

sm_setup allow_gui -u 'benutzername' -c 'adminpc'

oder ohne Einschränkung

sm_setup allow_gui -u '*' -c '*' -m admin

Mail-Scripte

09/2011: Datenbankabfrage angepasst: kunde → customer für Sesam >= 4
02/2012: notify und alarm unterscheidbar gemacht.
02/2012: notify erweitert, so, dass GET_VOLUME Mails nicht unkontrolliert versandt werden sondern nur alle „DELAY“ Minuten

Abweichende Einstellungen im Sesam

Unter Konfiguration → Support → e-Mail-Einstellungen mache ich Einträge mit den Account Namen:

  • sm_notify
  • sm_alarm
  • sm_disaster

und trage immer auch den Kunden ein. Damit kann man dann für alle drei Scripte getrennte Einstellungen machen und weiss von welchem Kunden bzw. Servere die Mail kommt da das Subject dann so aussieht: „Kunde / Sesam: …“. Die angepassten Sctipte sehen dann wie folgt aus:

sm_notify

#!/bin/sh
#$Id: sm_notify,v 1.10 2009/10/21 06:52:21 sesam Exp $
#******************************************************************************
#
# File      : sm_notify
# Copyright : (c) SEP AG  D83629 Weyarn
# Project   : SESAM Backup Utility
# Date      : 2007-01-18
#
#******************************************************************************
#
# Description : Template for the SESAM notify interface.
#               It is called from SESAM after finishing a backup, media change
#               media init or SESAM day change.
#
# Parameters  : $1 = Calling module (BACKUP, GET_VOLUME, INIT,
#                                    ALL_JOBS_DONE, NEWDAY)
#               $2 = message text
#
#
#     This is a user programable shell script with 2 parameters.
#     Please insert your specific code-lines after this comment.
#     Take care of not inserting any command waiting for an answer from
#     the user ( OK-buttons etc. ) - this may cause a complete blocking of
#     backups during the night.
#
#*******************************************************************************

# Example 

read_ini()
{
  source `grep -i '^sm_ini=' /etc/sesam2000.ini|cut -d"=" -f2` 2>/dev/null
}

send_mail()
{
   ## Set mail subject
   mail_subject="$customer / Sesam NOTIFY: $1"
   mail_text="$2"
   sm_smtp -A "sm_notify" -s "$mail_subject" -m "$mail_text" 
}

send_mail_file()
{
   ## Set mail subject
   mail_subject="$customer / Sesam NOTIFY: $1 $2"
   mail_text="$3"
   ## Send Sesam status file as mail body
   sm_smtp -A "sm_notify" -s "$mail_subject" -M "$mail_text" 
}


send_status_mail()
{
   ## Set mail subject
   mail_subject="$customer / Sesam NOTIFY: backup status: $1"
   ## Send Sesam status as mail text and protocol file as mail attachment
   sm_smtp -A "sm_notify" -s "$mail_subject" -M "gv_dayfile:" -a "gv_prot:" 
}

unload_tape()
{
   ## Unload tape from a stand alone drive. First parameter is sesam drive num 

   ## Send Sesam status as mail text and protocol file as mail attachment
   sm_drive dismount $1 unload 
}

#--------------- MAIN ----------------------

read_ini

source "${gv_rw_ini}/sesam2000.profile" >/dev/null 2>&1

echo "$0" "$*" >> "${gv_rw_lgc}/sm_notify.lgc"

customer=`sm_db "SELECT customer FROM accounts WHERE account_name = 'sm_notify'" | head -n 1 | cut -d "=" -f 2 | cut -d "|" -f 1`
GETV_PATH="/var/run"
GETV_FILE="sm_notify_get_volume"
GETV="$GETV_PATH/$GETV_FILE"
DELAY=120 # Minuten

case $1 in
      ALL_JOBS_DONE)
         send_status_mail "$2";
         # unload_tape 2;
         ;;
      INIT)
         send_mail "$1" "$2"
         ;;
      GET_VOLUME)
         OLD=`cat $GETV`
         if [ "$OLD" != "$1 $2" ]; then
                send_mail "$1" "$2"
                echo "$1 $2" > $GETV
         else
                find $GETV_PATH -name "$GETV_FILE" -cmin +$DELAY 2>/dev/null | grep "$GETV_FILE" >/dev/null 2>&1
                if [ $? -eq 0 ]; then
                        send_mail "$1" "$2"
                        echo "$1 $2" > $GETV
                fi
         fi
         ;;
      BACKUP)
         send_mail "$1" "$2"
         ;;
      RESTORE)
         send_mail_file "$1" "$2" "$3"
         ;;
      BACKUP_GROUP:)
         ;;
      COPY)
         ;;
      *)
      ;;
esac
exit

sm_alarm

#!/bin/sh
# $Id: sm_alarm,v 1.6 2007/10/05 09:04:51 sesam Exp $
#******************************************************************************
#
# File      : sm_alarm
# Copyright : (c) SEP AG  D83629 Weyarn
# Date      : 2007
#
#******************************************************************************
#
# Description : This is the alarm interface of SESAM backup utility.
#               It is called from nearly all SESAM modules, whenever a
#               fatal error occurs.
#
# Parameters  : $1 = Name of module which signals the alarm
#               $2 = Text of error message
#
# This is a user programmable shell script with 2 parameters.
# Please insert your specific code lines after this comment.
# Take care of not inserting commands which wait for an answer from
# the user ( OK-buttons etc. ) - this may cause a total blocking of
# backups during the night.
#
#
#********************************************************************************
# Beschreibung: Dies ist die Alarmschnittstelle der SESAM Sicherungssoftware.
#               Sie wird von fast allen Modulen im Falle eines Fehlers
#               aufgerufen.
#
# Parameter   : $1 = Name des signalisierenden Moduls
#               $2 = Text der Meldung
#
# Dies ist ein benutzerprogrammierbares Shell Skript mit 2 Parametern.
# Fuegen Sie bitte Ihre eigenen Kommandozeilen nach diesem Kommentar ein,
# wobei Kommandos, die eine Antwort erwarten ( OK-Buttons etc. ) vermieden
# werden sollten, da sie Sicherungen waehrend der Nacht blockieren koennten.
#
#********************************************************************************
#
# Example
#
read_ini()
{
   source `grep -i '^sm_ini=' /etc/sesam2000.ini|cut -d"=" -f2` 2>/dev/null
}
#
send_mail()
{
   ## Set mail subject
   mail_subject="$customer / Sesam ALARM: $1 $2"
   ## Send Sesam status file as mail body
   sm_smtp -A "sm_alarm" -s "$mail_subject" -M "gv_dayfile:" -a "gv_prot:"
}
#
send_backup_mail()
{
   ## Set mail subject
   mail_subject="$customer / Sesam ALARM: $1 $2"
   ## Send Sesam not file as mail body
   f=$( echo $2|cut -d ':' -f 1)
   echo $f
   sm_smtp -A "sm_alarm" -s "$mail_subject" -M "$( ls -tr ${gv_rw_lis}/$f*not|tail -1 )" ""
}

#--------------- MAIN ----------------------
read_ini
source "${gv_rw_ini}/sesam2000.profile" >/dev/null 2>&1
echo "$0" "$*" >> "${gv_rw_lgc}/sm_alarm.lgc"
customer=`sm_db "SELECT customer FROM accounts WHERE account_name = 'sm_alarm'" | head -n 1 | cut -d "=" -f 2 | cut -d "|" -f 1`

GETV_PATH="/var/run"
GETV_FILE="sm_alarm_get_volume"
GETV="$GETV_PATH/$GETV_FILE"
DELAY=120 # Minuten

case $1 in
   INIT)
     send_mail "$1" "$2"
     ;;
   GET_VOLUME)
     OLD=`cat $GETV`
     if [ "$OLD" != "$1 $2" ]; then
     	send_mail "$1" "$2"
      	echo "$1 $2" > $GETV
     else
      	find $GETV_PATH -name "$GETV_FILE" -cmin +$DELAY 2>/dev/null | grep "$GETV_FILE" >/dev/null 2>&1
     	if [ $? -eq 0 ]; then
            	send_mail "$1" "$2"
             	echo "$1 $2" > $GETV
       	fi
     fi
     ;;
   BACKUP)
     send_backup_mail "$1" "$2";
     ;;
   RESTORE)
     send_mail "$1" "$2" "$3";
     ;;
   *)
   send_mail "$1" "$2";
   ;;
esac
exit

sm_disaster

#!/bin/sh
#  $Id: sm_disaster,v 1.3 2008/08/12 11:02:13 seniorix Exp $
# ******************************************************************************
#  
#   Module    : sm_disaster
#   Copyright : (c) 2002 SEP AG G-83629 Weyarn
#   Project   : SESAM Backup Utility
#   Date      : 21.06.2008
# 
# ******************************************************************************
#
#  >>> This is a user programmable procedure <<<
#
#  >>> Dieses ist eine vom Benutzer programmierbare Prozedur <<<
#
# ******************************************************************************
# 
# Description : 
#    This procedure is called from a SESAM backup if job name contains string
#    "DISASTER" or "SESAM", e.g. "SESAM_BACKUP".
#
#    These backups should be designed to save files, which are needed to recover
#    the SESAM server itself - called disaster recovery.
#    These are the .\sesam\... directory and the LIS-directory, if it is not 
#    under .\sesam\..  .
#    Furtheron the files of the database.
#
#    SESAM sends the media label and the barcode of the used media and 
#    a valid restore command to this procedure.
#    Starting this command, the file of the currently running backup will be
#    copied back to their original places.
#
#    It is urgently recommended to sent it to several different locations to
#    keep them available in case of full crash of the SESAM server itself.
#
#    For example write them to files on other computers within your net, 
#    mail them etc. .
#                     
#      The values are as follows:
#
#         $1 = {label} {backup source} {barcode}
#         $2 = {sbc restore command}
#
#    There is already an example configured below. This works if in Sesam GUI
#    in menu line "Configratione/ Support / E-Mail-Settings" the account "sesam"
#    had been added.
#
#    It is easy to do user specified adaptations !!!
#
# ******************************************************************************
#
# Beschreibung 
#    Wird vom SESAM waehrend einer Sicherung gerufen, deren Name "DISASTER"
#    oder "SESAM" beinhaltet z.B. "SESAM_BACKUP".
#
#    Diese Sicherungen sollten Verzeichnisse kopieren, die fuer die Wieder-
#    herstellung des SESAM Servers selbst noetig sind, dem sogenannten 
#    Disaster Recovery.
#
#    Dieses sind das .\sesam\... Verzeichnis, sowie LIS-Verzeichnis, falls
#    sie nicht unter .\sesam liegen.
#    Desweiteren die Dateien der SESAM Datenbank.
#
#    SESAM sendet den Medienlabel und ggf. den Barcode des benutzten Mediums
#    und ein vollstaendiges Restaurierungskommando an diese Prozedur.
#    Startet man diese Prozedur von der Komandozeile, so werden alle Dateien 
#    der gelaufenen Sicherung wieder an ihre urspruenglichen Plaetze zurueckkopiert.
#               
#    Es wird dringendst empfohlen diese Werte in Dateien, Mails etc. auf mehrere
#    andere Rechner in ihrem Netz zu verlagern, um sie im Falle eines 
#    Systemausfalls des SESAM Servers verfuegbar zu haben.
#
#       Die Werte sind die folgenden:
#
#         $1 = {label} {backup source} {barcode}
#         $2 = {sbc restore command}
# 
#    Unten ist bereits ein Beispiel eingerichtet, bei dem im Vorfeld in der 
#    Sesam GUI im Menue unter "Konfiguration/ Support/ e-Mail-Einstellungen"
#    der Account "sesam" anzulegeni ist.
#
#    User-spezische Anpassungen sind damit leicht durchfuehrbar !!!
#
# ******************************************************************************
# 
#  Example / Beispiel
#
read_ini()
{
  source `grep -i '^sm_ini=' /etc/sesam2000.ini|cut -d"=" -f2` 2>/dev/null
}
read_ini
source ${gv_rw_ini}/sesam2000.profile > /dev/null 2>&1
customer=`sm_db "SELECT customer FROM accounts WHERE account_name = 'sm_disaster'" | head -n 1 | cut -d "=" -f 2 | cut -d "|" -f 1`
echo "SEP sesam Desaster Information to restore SEP sesam system after data loss" > ${gv_rw_work}/disaster.tmp
echo "Media Source and if exisiting Barcode" >> ${gv_rw_work}/disaster.tmp
echo $1 >> ${gv_rw_work}/disaster.tmp
echo "Restore command to restore on command line" >> ${gv_rw_work}/disaster.tmp
echo $2 >> ${gv_rw_work}/disaster.tmp
# 
# remote copy disaster.tmp to other node via Linux mail:
# echo "Disaster values: $1 $2" | mail remoteNode!remoteUser 
# OR via SMTP interface with configured email account "sesam" in Sesam GUI
sm_smtp -A "sm_disaster" -s "$customer / SEP Sesam INFO: SEP sesam Notfall-Informationen" -M "${gv_rw_work}/disaster.tmp"

Anpassungen für INIT-Scripte (Debian)

An den Anfang eines jeden Scripts gehört das hier:

if [ ! -f /etc/sesam2000.ini ]; then
    echo "ERROR: /etc/sesam2000.ini missing !"
    exit 1
fi

Um sicher zu stellen dass das Script nur ausgeführt wrid, wenn die Ini auch existiert.

Es sieht such aus als wäre das Init-Script von einem Suse/Red Har Script abgeleitet. Dort gibt es nämlich eine Init-Funktionssammlung die eine Funktione „init_failed“ beinhaltet. Das gibt es aber unter Debian nicht. Mutmassung: Damit das Sctip so änlich aussieht hat SEP aus dem Funktionsaufruf einfach eine Variable gemacht und die im Vorfeld auf „3“ gesetzt. Im Original sieht das so aus:

... | rc_failed

Und im Debian-Initecritp:

... | exit $rc_failed

Das hat zur Folge, das man nie weiss wenn man das Init-Script benutzt ob der Auftruf nun erfolgreich war oder nicht.

Um das zu zu korrigieren füge ich dem Script die Funktion „rc_failed“ in abgewandelter From hinzu:

function rc_failed ()
{
  echo " FAILED"
  exit $rc_failed    
}

und ändere alle Zeilen die so ausehen:

${GV_RO_BIN}/sm_startup >/dev/null 2>&1 || exit $rc_failed

in das hier:

${GV_RO_BIN}/sm_startup >/dev/null 2>&1 || rc_failed

Nach noch ein paar anderen Schönheitsoperationen sieht das dann so aus:

#!/bin/sh
# $Id: sm_startstop.linux,v 1.8 2012/05/24 12:16:09 sesam Exp $
# Copyright (c) 2002 
#
# Authors: Rainer Seyerlein <rs@sep.de>, 2002
#          
#
#
# /etc/init.d/sesam
#
### BEGIN INIT INFO
# Provides:  		sesam
# Required-Start:		$local_fs $remote_fs $network 
# X-UnitedLinux-Should-Start:	$named $time postgresql ypclient dhcp radiusd
# Required-Stop:		$local_fs $remote_fs $network
# X-UnitedLinux-Should-Stop:	
# Default-Start:		3 5
# Default-Stop:			0 1 2 6
# Short-Description:		SEPsesam 	
# Description:			Start SEPsesam backup client
### END INIT INFO


#
# load the configuration
#
read_ini()
{
   SM_INI=`grep -i '^sm_ini=' /etc/sesam2000.ini|cut -d"=" -f2`
   echo `grep -i "$1=" "$SM_INI"|cut -d"=" -f2`
}

if test -r /etc/sesam2000.ini
then
  GV_RO=`read_ini gv_ro`
else
  GV_RO=/opt/sesam/
fi
. ${GV_RO}/skel/templates/sm_rc_common

test -s /etc/rc.status && \
    . /etc/rc.status

rc_failed()
{
  echo " FAILED"
  exit 3
}


### Linux
case "$1" in
    start)
           echo -n "Starting sesam:"
           check_version
           ret=$?
           case $ret in
               0)
                  ${GV_RO_BIN}/${sm_start} start >/dev/null 2>&1 || rc_failed 
                  ;;
               1)
                  echo ""
                  echo "Found new sesam version. Starting update ... "
                  if [ "$insttype" = "server" ];then
                     ${GV_RO_BIN}/sm_startup >/dev/null 2>&1 || rc_failed 
                  else
                     update_client_version  >/dev/null 2>&1  
                     ${GV_RO_BIN}/${sm_start} start >/dev/null 2>&1 || rc_failed  
                  fi
                  ;;
               2)
                  echo ""
                  echo "Sesam not configured yet. Starting setup ... "
                  setup
                  ;;
           esac
	   ;;
    stop)
            echo -n "Shutting down sesam:"
            if [ "$insttype" = "server" ]
               then
                 ${GV_RO_BIN}/sm_shutdown >/dev/null 2>&1 || rc_failed 
               else
                 ${GV_RO_BIN}/${sm_start} stop >/dev/null 2>&1 || rc_failed 
               fi
	    ;;
    status)
       echo -n "Checking for sesam: "
       ${GV_RO_BIN}/${sm_start} status >/dev/null 2>&1 
       exit $?
        ;;
    reload)
       $0 stop  &&  $0 start  ||  rc_failed
       ;;
    restart)
       $0 stop  &&  $0 start  ||  rc_failed
       ;;
    *)
       echo "Usage: $0 {start|stop|status|restart|reload}"
       exit 1
       ;;
esac

echo " OK"
exit 0

# Inform the caller not only verbosely and set an exit status.

Kerio LVM-Backup

sbc_pre

#!/bin/bash
#  $Id: sbc_pre,v 1.4 2003/09/22 11:18:16 psl Exp $
#=============================================================================
#
#           SESAM PRE procedure for UNIX clients
#
#=============================================================================
#
# Description: This procedure is called from SESAM before backup is started;
#              it gives the user a possibility to do some special things before 
#              backup ( prepare databases, send messages etc. ).
#
#              It is called with 10 parameters from the current SESAM backup:
#
#        	 $1 = Backup source 
#                $2 = Tape server interface
#                $3 = SESAM task name
#                $4 = Number of SESAM drive
#                $5 = Type of backup C_opy, F_ull, D_ifferential, I_ncremental
#                $6 = Execution counter ( = number of LIS-file )
#                $7 = Saveset ID
#                $8 = Label of used media
#                $9 = Name of mediapool
#                10 = Schedule
#
#               Returning status:
#                if this procedure ran OK
#                then echo "STATUS:OK"
#                else echo "STATUS:ERROR text"
#
# >>> This is a user programmable procedure <<<
#
#=============================================================================

#=== Print call arguments =====================================
source=$1 
tape_server=$2
task=$3
drive_number=$4
backup_type=$5
exe_cnt=$6
saveset=$7
label=$8
pool=$9
shift
schedule=$9

echo source       = $source
echo tape_server  = $tape_server
echo task         = $task
echo drive_number = $drive_number
echo backup_type  = $backup_type
echo exe_cnt      = $exe_cnt
echo saveset      = $saveset
echo label        = $label
echo pool         = $pool
echo schedule     = $schedule

#=== Please insert your specific actions here=====================================

#echo STATUS:ERROR {message}

case "$task" in
	kerio)
		/etc/init.d/kerio-connect stop
		/sbin/lvcreate -L4G -s -n kerio_store_bakup /dev/vg0/keriostore
		/etc/init.d/kerio-connect start
		/bin/mount /dev/vg0/kerio_store_bakup /opt/kerio/backup -onouuid,ro
		;;
esac

echo STATUS:OK

sbc_post

#!/bin/sh
#  $Id: sbc_post,v 1.4 2003/09/22 11:37:44 psl Exp $
#===============================================================================
#
#           SESAM POST procedure for UNIX clients
#
#===============================================================================
#
# Description: This procedure is called from SESAM after backup is finished;
#              it gives the user a possibility to do some special things after 
#              backup ( restart databases, send messages etc. ).
#
#              It is called with 12 parameters from the current SESAM backup:
#
#                $1 = Backup source 
#                $2 = Tape server interface
#                $3 = SESAM task name
#                $4 = Number of SESAM drive
#                $5 = Type of backup C_opy, F_ull, D_ifferential, I_ncremental
#                $6 = Status of backup ( 1 = ok, 0 = error )
#                $7 = Message text from backup
#                $8 = Execution counter ( = number of LIS-file )
#                $9 = Saveset ID
#                10 = Label of used media
#                11 = Name of mediapool
#                12 = Schedule
#
#               Returning status:
#                if this procedure ran OK
#                then echo "STATUS:OK"
#                else echo "STATUS:ERROR text"
#
# >>> This is a user programmable procedure <<<
#
#
#=====================================================================================


#=== Print call arguments =====================================

source=$1 
tape_server=$2
task=$3
drive_number=$4
backup_type=$5
backup_status=$6
backup_message=$7
exe_cnt=$8
saveset=$9
shift
label=$9
shift
pool=$9
shift
schedule=$9

echo source         = $source
echo tape_server    = $tape_server
echo task           = $task
echo drive_number   = $drive_number
echo backup_type    = $backup_type
echo exe_cnt        = $exe_cnt
echo saveset        = $saveset
echo label          = $label
echo pool           = $pool
echo schedule       = $schedule
echo backup_status  = $backup_status
echo backup_message = $backup_message


#=== Please insert your specific actions here =====================================

#echo STATUS:ERROR {message}
case "$task" in
	kerio)
		/bin/umount /opt/kerio/backup
		/sbin/lvremove -f /dev/vg0/kerio_store_bakup
		;;
esac


echo STATUS:OK

sep_sesam.1518768809.txt.gz · Zuletzt geändert: 2018/02/16 09:13 von matthias