Savannah WatchDog Documentation

Description


The Savannah WatchDog are a set of scripts, built in PHP, which CONTROL some bugs/patches STATES and PERFORM an ACTION.

Those scripts can change a Savannah parameter and:

  • set an automatic message in the Savannah field "Comment" associated at bug/patch involved.
  • create an automatic e-mail warning to send to the people associated at the bug/patch.

The bugs/patches states (or the conditions) verified by the WatchDog, will be analyzed in the relevant section of this documentation.

The purpose of this document is to analyze the functioning and the logic of those script. In this way, it will be possible to change or to improve the script, to provide a more complete automated service.

The WatchDog system uses the Savannah CLI to execute the operation on the Savannah DB.

The scripts use this e-mail to send messages: watchDog[AT]savannah_DOT_cern_DOT_ch

Server currently in Production *lxbra1902*

SCRIPTS TABLE

Script Name Script State Time Scheduled Short Script Description Action
bugInRfRsince4weeksClose.php Active Every Tuesday at 11:00a.m. Close the bugs that are "OPEN" and in state "READY FOR REVIEW" and inactive since at least 4 weeks Using Savannah CLI closes the bugs and puts comments on the DB
checkCertifiedPatches.php Inactive (deprecated) None Control if all the bugs, associated at one patch in state "CERTIFIED" (or more than certified), are in state "FIXED" or "READY FOR REVIEW" Send an e-mail warning at the people associated at the bugs involved

How to install / setup


The Savannah WatchDog system are PHP scripts that gather data information from a local mysql copy of the savannah DB, created in a computer host. The information gathered can be used from the WatchDog scripts to send email warning or to modify parameters in the real Savannah DB (in this last case the system uses Savannah CLI). The local mysql DB is updated, from a dump of the Savannah DB, each hour (the updating can be scheduled).

The procedure to configure properly a computer host to run those scripts is the following:

Step 1 *Packages Needed:*

yum install mysql php cvs php-pear php-mysql php-gd

Step 2 Download CVS and Set Folders
#cd $HOME

#export CVSROOT=:ext:<username>@glite.cvs.cern.ch:/cvs/jra1mw/

#export CVS_RSH=ssh

#mkdir /home/cvs/

#cd /home/cvs/

#cvs checkout org.glite.savannah.viewer

#mkdir /cronjob/

#cp org.glite.savannah.viewer/cron-utils/cert/* /cronjob/

#cp org.glite.savannah.viewer/watchdog/* /cronjob/

#mkdir /cronjob/.logPass/

#mkdir /cronjob/Log/

Step 3 PHP Configuration
Edit php.ini and change the following values:

  • max_execution_time = 360
  • max_input_time = 360
  • memory_limit = 200M

Step 4 Setup MySQL DB
Create MySQL DB:
#service mysqld start

#mysqladmin -u root password "password"
#Setup a root password
#mysql -u root -p

#mysql>CREATE DATABASE savannah;

#mysql>GRANT ALL PRIVILEGES ON savannah.* TO 'savannah-writer'@'localhost' IDENTIFIED BY 'check the password for this in the file /cronjob/upload-savannah-db.sh';

#mysql>GRANT SELECT ON savannah.* TO 'savannah'@'localhost' IDENTIFIED BY 'check the password for this in the !WatchDog php file that is in the /cronjob folder';

#mysql>quit
Fill the DB manually for the first time by running:
#./cronjob/upload-savannah-db.sh
#Set the execute permission if needed

In this way you can test if everything is properly configured.

Step 5 Install Savannah CLI
Installation procedure for Savannah CLI:
#cd /cronjob/

#chmod +x install_deps.sh

#chmod +x savannah

#./install_deps.sh
The installation of Savannah CLI should be completed without errors.

Check if already exists the environment variable PYTHONPATH:

#env | grep PYTHONPATH
If the variable does not exists then set manually:
#export PYTHONPATH=${PYTHONPATH}:${HOME}/savannah-cli-libs/lib/
Anyway set the variable for your user in the .bashrc file:
#if you are root user
vi /root/.bashrc
#add at the end the line: export PYTHONPATH=${PYTHONPATH}:${HOME}/savannah-cli-libs/lib/

Step 6 Setup Cron Job
The cron jobs are used to schedule the start of a script.

The main cronjob configuration file is in: /etc/crontab

It's necessary setup the following script:

  • uplodad-savannah-db.sh #Used to update the local Savannah DB

The line to be added in the crontab file:

  • 01 * * * * root /cronjob/upload-savannah-db.sh

The script is scheduled the first minute of each hour. Remember to set the correct execute permission for the file.

Step 7 Set WatchDog as Cron Job
It's possible set a WatchDog script as cron job, adding one of the following lines at crontab file:

  • 05 09 * * * root /cronjob/checkCertifiedPatches.php
  • 05 08 * * * root /cronjob/bugInRfRsince4weekClose.php -s -w 4 -e

If you scheduled as a cronjob, remember that those scripts are designed to run one ONLY time at day.

Remember to add at crontab file the following environment variables:

  • HOME=/root (or your HOME)
  • TERM=xterm

WARNING: do not set a watchdog cronjob more often than the cronjob to update the local DB. If you do it, you could have an incorrect watchdog execution.

Step 8 Create Authorization File
The WatchDog script, that uses the Savannah CLI, needs of proper Login and Password of an user to authenticate itself and to execute the operations on the real Savannah DB. Those information are stored in two file:

  • savAuthL.tx
  • savAuthP.tx

Those file must be created in /cronjob/.logPass/

#cd /cronjob/.logPass
#vi savAuthL.tx #Set the login
#vi savAuthP.tx #Set the password

A special user, named Savannah WatchDog, was created to execute WatchDog operations. If you need private information, please contact: lorenzo_DOT_sbolgi[AT]cern_DOT_ch

Info Start Stop DB
To start/stop MySQL daemon:

  • /etc/init.d/mysqld
  • service mysqld start #start the service
  • service mysqld stop #stop the service

Bugs/Patches States


The WatchDog scripts work using the following states:

Patch States
Value Description
100 None
113 With Provider
114 Ready for Integration
109 In configuration
111 Configured
102 Ready for certification
103 In certification
108 Certified
112 PPS pre-deployment
104 PPS pre-production
105 In production
107 Rejected
106 Obsolete
Bug States
Value Description
100 None
1 Fixed
2 Invalid
3 Wont fix
5 Remind
6 Unreproducible
7 Duplicate
121 Closed
114 Accepted
116 Ready for Review
117 Ready for Test
118 Ready for Integration
120 In progress
122 Integration Candidate
123 Integrated
Bug "status_id"
Value Description
1 Open
3 Closed

WatchDog Logic Controls


Here below there is the list of each WatchDog script with explained its logic.

Script Name bugInRfRsince4weeksClose.php
IF
  • Bug is not Closed # status_id <> 3
  • AND
  • BugState is in Ready for Review # is 116
THEN
  • the bug has an incorrect state

Script Name checkCertifiedPatches.php
IF
  • PatchState > "certified" # is 108 or 112 or 104 or 105
  • AND
  • the patch is not closed # CloseDate is 0
  • AND
  • the bug associated at the patch < "ready for review" # is not 1 or 106
THEN
  • the patch has an incorrect state

WatchDog Performs Actions


Here below there is the list of each WatchDog script with explained its performs actions.

Script Name bugInRfRsince4weeksClose.php
IF
  • A bug has an in incorrect state
THEN
  • uses Savannah CLI to put a comment into the field "Comment", associated at the bug, on the real Savannah DB
  • uses Savannah CLI to close the bug, on the real Savannah DB

Script Name checkCertifiedPatches.php
IF
  • A patch has an in incorrect state
THEN
  • find the people who the patch is assigned
  • send an e-mail warning at the people of the previous list

Output Message for users


Here below there is the list of each WatchDog script with explained its default message for the users.

Script Name bugInRfRsince4weeksClose.php
The generic message, puts in the Savannah field "Comment" of the bug, is like the following:

***

This bug has been automatically closed as it has been inactive in the

'Ready for Review' state for too long. If the issue is still relevant,

please reopen the bug with a comment explaining the situation.

***

Script Name checkCertifiedPatches.php
The generic e-mail message, sent by the script, is like the following:

E-mail Subject: Savannah bug #BUGNUMBER in incorrect state for patch #PATCHNUMBER

E-mail Body:

Dear USER,

you have certified patch PATCHNUMBER, however the bug BUGNUMBER attached to this patch is in state 'BUGSTATE' and therefore not in the correct state.

If this bug is fixed, please correct the state of the bug to either 'Ready for Review' or 'Fixed' - if the bug is not fixed, please delete the link between the patch and the bug and put the state of the bug back to 'Accepted'.

Savannah links:

-----------------------------------------------------

Patch PATCHNUMBER: SAVANNAHLINKTOPATCH

Bug BUGNUMBER: SAVANNAHLINKTOBUG

For more information on the patch certification process, please see the gLite developer guide (chapter 12) which can be found at https://edms.cern.ch/file/790125/0.4/EGEE-developer-guide-v0.10.pdf .

Savannah Watchdog

This is an autogenerated message - please do not reply to it. If you think you incorrectly received this mail, please contact the gLite integration team at project-eu-egee-middleware-integration[AT]cern.ch

Log file


Here below there is the list of each WatchDog script with explained its log file.

Script Name bugInRfRsince4weeksClose.php
The script creates a log file in the folder:

  • #/cronjob/Log/

the filename is created in this way:

  • logWatchDog-'Month'-'Year'.log

[Example]: #/cronjob/Log/logWatchDog-Apr-2009.log

Script Name checkCertifiedPatches.php
Nothing log file

Details


Script Name bugInRfRsince4weeksClose.php
This WatchDog script is a command line. Below you can see its help:

*------------------------------------------------------------------------------------------------------

* WatchDogScript - Command Line Option

*------------------------------------------------------------------------------------------------------

* watchDog.php -option

* watchDog.php -s -w [number of weeks]

* watchDog.php -e -w [number of weeks]

* OPTION | ACTION DESCRIPTION

*------------------------------------------------------------------------------------------------------

* -h --help : the command line help

* -s --shows : print the bugs that the script will close using the "-e" option [Shows the bugs managed with the default weeks set]

* -w --weeks : set the time elapsed since a bug has been modified (in weeks) [Can be used with "-s" and "-e" options] Default time if -w is not set: 4 weeks

* -e --execute : execute the WatchDog Script

*------------------------------------------------------------------------------------------------------

WARNING: When this watchdog is scheduled as a cronjob produces a system e-mail in the default file /var/spool/mail/root (if your user is root) because the Savannah CLI prints some output messages into the shell. In the mail there are the messages printed.

Link


  • CVS link:

  • Documentation:

-- LorenzoSbolgi - 07 Apr 2009

Edit | Attach | Watch | Print version | History: r17 < r16 < r15 < r14 < r13 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r17 - 2009-05-13 - LorenzoSbolgi
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    EGEE All webs login

This site is powered by the TWiki collaboration platform Powered by Perl This site is powered by the TWiki collaboration platformCopyright & by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Ask a support question or Send feedback