Difference between revisions of "User:Pat"

From stoney cloud
Jump to: navigation, search
(State of the art)
(ASCII generator)
 
(16 intermediate revisions by one other user not shown)
Line 10: Line 10:
 
/____/\__/\____/_/ /_/\___/\__, /      \___/_/\____/\__,_/\__,_/   
 
/____/\__/\____/_/ /_/\___/\__, /      \___/_/\____/\__,_/\__,_/   
 
                           /____/                                   
 
                           /____/                                   
 +
</pre>
 +
 +
<pre>
 +
          __                                      __                  __
 +
  _____ / /_ ____  ____  ___  __  __  _____ / /____  __  __ ____/ /
 +
  / ___// __// __ \ / __ \ / _ \ / / / /  / ___// // __ \ / / / // __  /
 +
(__  )/ /_ / /_/ // / / //  __// /_/ /  / /__ / // /_/ // /_/ // /_/ / 
 +
/____/ \__/ \____//_/ /_/ \___/ \__, /  \___//_/ \____/ \__,_/ \__,_/ 
 +
                              /____/                                   
 +
 
</pre>
 
</pre>
  
Line 15: Line 25:
 
== State of the art ==
 
== State of the art ==
 
* prov-backup-rsnapshot
 
* prov-backup-rsnapshot
** The prov-backup-rsnapshot deamon is finished. There is only one thing left to do which is to create the bash script which creates the chroot environment, see [[prov-backup-rsnapshot#ToDos]]
+
** The prov-backup-rsnatheot deamon is finished. There is only one thing left to do which is to create the bash script which creates the chroot environment, see [[prov-backup-rsnapshot#ToDos]]
* The daemon can be installed and tested according to [[Backup_(Server_Setup)#prov-backup-rsnapshot]] (don't forget [[Backup_(Server_Setup)#prov-backup-rsnapshot]])
+
** The daemon can be installed and tested according to [[Backup_(Server_Setup)#prov-backup-rsnapshot]] (don't forget [[Backup_(Server_Setup)#prov-backup-rsnapshot]])
 
* rsnapshot
 
* rsnapshot
 
** The script which executes the daily, weekly and monthly rsnapshots is finished. It requires a parameter (--interval) with the appropriate name and then executes for all users (which have set the corresponding value in the LDAP) the appropriate command. You can also pass "hourly" or "yearly" with the --interval parameter.
 
** The script which executes the daily, weekly and monthly rsnapshots is finished. It requires a parameter (--interval) with the appropriate name and then executes for all users (which have set the corresponding value in the LDAP) the appropriate command. You can also pass "hourly" or "yearly" with the --interval parameter.
Line 29: Line 39:
 
*** Add the the following line to the replace variables in the sendmail subroutine of the scheduleWarning.pl script (around line 1429):
 
*** Add the the following line to the replace variables in the sendmail subroutine of the scheduleWarning.pl script (around line 1429):
 
*** <pre>externalID => $external_ID,</pre>
 
*** <pre>externalID => $external_ID,</pre>
 +
** Add the subject to all the mail tempaltes. Add the following line at the very top of the template:
 +
*** <pre>Subject: <YOUR-MAIL-SUBJECT></pre>
 
** The script can be installed according to [[Backup_(Server_Setup)#schedule_warning]]  (don't forget [[Backup_(Server_Setup)#prov-backup-rsnapshot]])
 
** The script can be installed according to [[Backup_(Server_Setup)#schedule_warning]]  (don't forget [[Backup_(Server_Setup)#prov-backup-rsnapshot]])
 
* Backup helper scripts
 
* Backup helper scripts
** The writeAccontSize ... TBD this evening
+
** The writeAccontSize.pl is adapted to the new LDAP directory. It reads and writes quota values and thresholds from/to the LDAP and gets the path to the mail templates from the LDAP
** A script (and cronjob) which executes two commands each night is still missing and needs to be implemented. It must do an LDAP search and get all active backup account (search unde
+
** Add the mail subject to the mail templates for the quota warning mails:
 +
*** Add the following line at the very top of the template
 +
*** <pre>Subject: <YOUR-MAIL-SUBJECT></pre>
 +
** A script (and cronjob) which executes two commands each night is still missing and needs to be implemented. It must do an LDAP search and get all active backup account (search under <code>ou=accounts,ou=backup,ou=services,dc=foss-cloud,dc=org</code> for <code>objectClass=sstBackup</code> and <code>sstIsActive=TRUE</code>). Read the necessary attributes from these accounts and execute the following commands:
 +
*** <code>/<path/to>/writeAccountSize.pl -C /<path/to>/writeAccountSize.conf -D <home directory> -U <UID></code>
 +
*** <code>/<path/to>/scheduleWarning.pl -U <UID></code>
 +
* prov-backup-kvm
 +
** On the new infrastructure:
 +
** As soon as the vips work again, make the prov-backup-kvm connect to ldapm.stepping-stone.ch:
 +
*** <code>vi /etc/Provisionig/Backup/KVM.conf</code>
 +
*** <pre>SERVER = ldaps://ldapm.stepping-stone.ch</pre>
 +
 
 +
== Scripts ==
 +
=== prov-backup-rsnapshot ===
 +
See [[prov-backup-rsnapshot]]
 +
 
 +
=== rsnapshot ===
 +
This script executes the very basic rsnapshot command for each user which wants to have a snapshot for the given interval. This script takes as input parameter <code>--interval</code> where you can specify the following intervals:
 +
* hourly
 +
* daily
 +
* weekly
 +
* monthly
 +
* yearly
 +
 
 +
It is basically just a wrapper around the rsnapshot command for the given interval. It does an LDAP lookup and collects all users which want to have a rsnapshot made for the given interval. For all the collected users, the rsnapshot command for the given interval is executed.
 +
 
 +
A crojob for the daily, weekly and monthly rnspashots is created on the [[Backup_(Server_Setup)|Test-Backup-Server]]
 +
 
 +
'''Important:''' As stated above, on the Test-Backup-Server the command are just printed to STDOUT instead of really being exceuted. 4
 +
 
 +
==== Configuration ====
 +
<pre>
 +
[General]
 +
MaxParallelProcesses = # How many rsnapshot processes you want to have in parallel
 +
# The basic rsnapshot command, the %uid% and %interval% will be replaced by the script
 +
Rsnapshot_command = /usr/bin/nice -n 19 /usr/bin/rsnapshot  -c /etc/rsnapshot/rsnapshot.conf.%uid% %interval%
 +
 
 +
[LDAP]
 +
Host = # URI of the LDAP server
 +
Port = # Port of the LDAP server
 +
User = # Username to bind to the LDAP server
 +
Password = # Password for the given user
 +
CA_Path = # Directory containing the CA for the given LDAP server
 +
Accounts_Base = # Base dn to the backup accouts
 +
</pre>
 +
 
 +
=== scheduleWarning.pl ===
 +
The scheduleWarning.pl is executed once a day for every (active) backup account in the LDAP directory. It compares the the scheduled backups with the backups which were really written and send the user a mail, if something is not as it should be. Every reseller can define its proper text (template) and store it on the filesystem. The path to the template is stored in the LDAP directory (see [[]]). The scheduleWarning.pl script reads these values and then open the appropriate template. In this template the following placeholders are replaced:
 +
* {$salutation} => Salutation: "Sehr geehrter Herr" / "Dear Mrs."
 +
* {$surname} => Surname of the backup account owner
 +
* {$scheduled_date} => The scheduled date of the backup that did not succeed
 +
* {$scheduled_time} => The scheduled time of the backup that did not succeed
 +
* {$gecos} => The gecos of the backup that did not succeed
 +
* {$computer} => The computer name from which the backup did not succeed
 +
* {$last_success} => The date and time of the last successful backup
 +
* {$uid} => The backups UID
 +
All placeholders are language depended.
 +
==== Configuration ====
 +
<pre>
 +
[XML]
 +
# In this section you should not change anything. This is the path of the schemas and XML files located on the server
 +
SCHEDULE_FILE = %homeDirectory%/incoming/%computerName%/.sepiola_backup/scheduler.xml
 +
SCHEDULE_XSD = %configpath%/../etc/schema/scheduler_schema.xsd
 +
BACKUP_ENDED_FILE = %homeDirectory%/incoming/%computerName%/.sepiola_backup/backupEnded.xml
 +
BACKUP_ENDED_XSD =  %configpath%/../etc/schema/backupended_schema.xsd
 +
BACKUP_STARTED_FILE = %homeDirectory%/incoming/%computerName%/.sepiola_backup/backupStarted.xml
 +
BACKUP_STARTED_XSD =  %configpath%/../etc/schema/backupstarted_schema.xsd
 +
 
 +
 
 +
[TEMPLATE]
 +
# You can modify thesea variables as you wish, they
 +
# will be used for the saluataion in the mail that will
 +
# be sent to the user. The salutations are language and
 +
# gender dependant (m = male / f = female)
 +
Salutation_Default_de-CH = Liebe Kundin / Lieber Kunde
 +
Salutation_m_de-CH = Sehr geehrter Herr
 +
Salutation_f_de-CH = Sehr geehrte Frau
 +
Salutation_Default_en-GB = Dear customer
 +
Salutation_m_en-GB = Dear Mr.
 +
Salutation_f_en-GB = Dear Mrs.
 +
 
 +
[LDAP]
 +
 
 +
SERVER = # The URI of your LDAP server
 +
PORT = # The port on which your LDAP server listens
 +
DEBUG = # If you want debug messages for LDAP connection
 +
 
 +
ADMIN_DN = # The admin-bind DN to you LDAP server
 +
ADMIN_PASSWORD = # The appropriate very secret password
 +
 
 +
BACKUP_BASE = # The base dn of the backup accounts
 +
PEOPLE_BASE = # The base dn of the people accounts
 +
RESELLER_BASE = # The base dn of the reseller-configuration accounts
 +
SCOPE = sub
 +
 
 +
[MAIL]
 +
mailTo = # To whom the mail is sent if nothing is found in the LDAP
 +
host = # The mail host over which the mails are sent
 +
port = # The port of the mail host
 +
username = # The username to authenticate on the mail host
 +
password = # The password to authenticate on the mail host
 +
from = # From which the mail comes from if nothing is found in the LDAP
 +
</pre>
 +
 
 +
=== writeAccountSize.pl ===
 +
This is just an adaption of the [https://int.stepping-stone.ch/wiki/writeAccountSize.pl writeAccountSize.pl script]. The following modifications were done:
 +
* Write quota values also to the LDAP directory
 +
* Using new the Net::SMTPS lib to send the mails
 +
* Generate the mail text according to the templates specified by the reseller in the LDAP
 +
* Using a library to fill in the templates
 +
 
 +
'''Important:''' On the Test-Backup-Server the script returns a dummy quota, because it the quota command does not work yet. But if you install it from scratch it will get the correct quota. To change the behaviour on the LDAP server, uncomment the "getQuotaSize" method starting at line 512.

Latest revision as of 11:54, 19 December 2013

Good to know

ASCII generator

http://www.network-science.de/ascii/ Font: slant

         __                                    __                __
   _____/ /_____  ____  ___  __  __      _____/ /___  __  ______/ /
  / ___/ __/ __ \/ __ \/ _ \/ / / /_____/ ___/ / __ \/ / / / __  / 
 (__  ) /_/ /_/ / / / /  __/ /_/ /_____/ /__/ / /_/ / /_/ / /_/ /  
/____/\__/\____/_/ /_/\___/\__, /      \___/_/\____/\__,_/\__,_/   
                          /____/                                   
          __                                      __                   __
   _____ / /_ ____   ____   ___   __  __   _____ / /____   __  __ ____/ /
  / ___// __// __ \ / __ \ / _ \ / / / /  / ___// // __ \ / / / // __  / 
 (__  )/ /_ / /_/ // / / //  __// /_/ /  / /__ / // /_/ // /_/ // /_/ /  
/____/ \__/ \____//_/ /_/ \___/ \__, /   \___//_/ \____/ \__,_/ \__,_/   
                               /____/                                    

Stoney Cloud

State of the art

  • prov-backup-rsnapshot
  • rsnapshot
    • The script which executes the daily, weekly and monthly rsnapshots is finished. It requires a parameter (--interval) with the appropriate name and then executes for all users (which have set the corresponding value in the LDAP) the appropriate command. You can also pass "hourly" or "yearly" with the --interval parameter.
    • The cronjobs are set up for daily, weekly and monthly rsnapshots
    • On the test server, the command is only printed, because rsnapshot is not yet installed. If you install the script according to Backup_(Server_Setup)#rsnapshot, the script will execute the commands (don't forget Backup_(Server_Setup)#prov-backup-rsnapshot).
  • Backup surveillance
    • The schedule-warning script also works for the new environment with the new LDAP and Templates.
    • The externalID for the deep.ch reseller is not yet implemented. To do it you must:
      • Include the placeholder in the template in the form of {$externalID}
      • Get the ID in the sendmail subroutine of the scheduleWarning.pl script
      • Add the the following line to the replace variables in the sendmail subroutine of the scheduleWarning.pl script (around line 1429):
      • externalID => $external_ID,
    • Add the subject to all the mail tempaltes. Add the following line at the very top of the template:
      • Subject: <YOUR-MAIL-SUBJECT>
    • The script can be installed according to Backup_(Server_Setup)#schedule_warning (don't forget Backup_(Server_Setup)#prov-backup-rsnapshot)
  • Backup helper scripts
    • The writeAccontSize.pl is adapted to the new LDAP directory. It reads and writes quota values and thresholds from/to the LDAP and gets the path to the mail templates from the LDAP
    • Add the mail subject to the mail templates for the quota warning mails:
      • Add the following line at the very top of the template
      • Subject: <YOUR-MAIL-SUBJECT>
    • A script (and cronjob) which executes two commands each night is still missing and needs to be implemented. It must do an LDAP search and get all active backup account (search under ou=accounts,ou=backup,ou=services,dc=foss-cloud,dc=org for objectClass=sstBackup and sstIsActive=TRUE). Read the necessary attributes from these accounts and execute the following commands:
      • /<path/to>/writeAccountSize.pl -C /<path/to>/writeAccountSize.conf -D <home directory> -U <UID>
      • /<path/to>/scheduleWarning.pl -U <UID>
  • prov-backup-kvm
    • On the new infrastructure:
    • As soon as the vips work again, make the prov-backup-kvm connect to ldapm.stepping-stone.ch:
      • vi /etc/Provisionig/Backup/KVM.conf
      • SERVER = ldaps://ldapm.stepping-stone.ch

Scripts

prov-backup-rsnapshot

See prov-backup-rsnapshot

rsnapshot

This script executes the very basic rsnapshot command for each user which wants to have a snapshot for the given interval. This script takes as input parameter --interval where you can specify the following intervals:

  • hourly
  • daily
  • weekly
  • monthly
  • yearly

It is basically just a wrapper around the rsnapshot command for the given interval. It does an LDAP lookup and collects all users which want to have a rsnapshot made for the given interval. For all the collected users, the rsnapshot command for the given interval is executed.

A crojob for the daily, weekly and monthly rnspashots is created on the Test-Backup-Server

Important: As stated above, on the Test-Backup-Server the command are just printed to STDOUT instead of really being exceuted. 4

Configuration

[General]
MaxParallelProcesses = # How many rsnapshot processes you want to have in parallel 
# The basic rsnapshot command, the %uid% and %interval% will be replaced by the script
Rsnapshot_command = /usr/bin/nice -n 19 /usr/bin/rsnapshot  -c /etc/rsnapshot/rsnapshot.conf.%uid% %interval%

[LDAP]
Host = # URI of the LDAP server
Port = # Port of the LDAP server
User = # Username to bind to the LDAP server
Password = # Password for the given user
CA_Path = # Directory containing the CA for the given LDAP server
Accounts_Base = # Base dn to the backup accouts

scheduleWarning.pl

The scheduleWarning.pl is executed once a day for every (active) backup account in the LDAP directory. It compares the the scheduled backups with the backups which were really written and send the user a mail, if something is not as it should be. Every reseller can define its proper text (template) and store it on the filesystem. The path to the template is stored in the LDAP directory (see [[]]). The scheduleWarning.pl script reads these values and then open the appropriate template. In this template the following placeholders are replaced:

  • {$salutation} => Salutation: "Sehr geehrter Herr" / "Dear Mrs."
  • {$surname} => Surname of the backup account owner
  • {$scheduled_date} => The scheduled date of the backup that did not succeed
  • {$scheduled_time} => The scheduled time of the backup that did not succeed
  • {$gecos} => The gecos of the backup that did not succeed
  • {$computer} => The computer name from which the backup did not succeed
  • {$last_success} => The date and time of the last successful backup
  • {$uid} => The backups UID

All placeholders are language depended.

Configuration

[XML]
# In this section you should not change anything. This is the path of the schemas and XML files located on the server
SCHEDULE_FILE = %homeDirectory%/incoming/%computerName%/.sepiola_backup/scheduler.xml
SCHEDULE_XSD = %configpath%/../etc/schema/scheduler_schema.xsd
BACKUP_ENDED_FILE = %homeDirectory%/incoming/%computerName%/.sepiola_backup/backupEnded.xml
BACKUP_ENDED_XSD =  %configpath%/../etc/schema/backupended_schema.xsd
BACKUP_STARTED_FILE = %homeDirectory%/incoming/%computerName%/.sepiola_backup/backupStarted.xml
BACKUP_STARTED_XSD =   %configpath%/../etc/schema/backupstarted_schema.xsd


[TEMPLATE]
# You can modify thesea variables as you wish, they
# will be used for the saluataion in the mail that will
# be sent to the user. The salutations are language and 
# gender dependant (m = male / f = female)
Salutation_Default_de-CH = Liebe Kundin / Lieber Kunde
Salutation_m_de-CH = Sehr geehrter Herr
Salutation_f_de-CH = Sehr geehrte Frau
Salutation_Default_en-GB = Dear customer
Salutation_m_en-GB = Dear Mr.
Salutation_f_en-GB = Dear Mrs.

[LDAP]

SERVER = # The URI of your LDAP server
PORT = # The port on which your LDAP server listens
DEBUG = # If you want debug messages for LDAP connection

ADMIN_DN = # The admin-bind DN to you LDAP server
ADMIN_PASSWORD = # The appropriate very secret password

BACKUP_BASE = # The base dn of the backup accounts
PEOPLE_BASE = # The base dn of the people accounts
RESELLER_BASE = # The base dn of the reseller-configuration accounts
SCOPE = sub

[MAIL]
mailTo = # To whom the mail is sent if nothing is found in the LDAP
host = # The mail host over which the mails are sent
port = # The port of the mail host
username = # The username to authenticate on the mail host
password = # The password to authenticate on the mail host
from = # From which the mail comes from if nothing is found in the LDAP

writeAccountSize.pl

This is just an adaption of the writeAccountSize.pl script. The following modifications were done:

  • Write quota values also to the LDAP directory
  • Using new the Net::SMTPS lib to send the mails
  • Generate the mail text according to the templates specified by the reseller in the LDAP
  • Using a library to fill in the templates

Important: On the Test-Backup-Server the script returns a dummy quota, because it the quota command does not work yet. But if you install it from scratch it will get the correct quota. To change the behaviour on the LDAP server, uncomment the "getQuotaSize" method starting at line 512.