Loading...
 

Using SVN

OSS SVN

Introduction


Over time there has been a lot of great scripts written by people that have got lost in home directories or obscurity. Which is a real shame. So work has been put into creating some templates (omni.template.sh, conf/template-server.conf) and putting all of our scripts in Sub-Version control

These scripts should always be looked at from the point of view of, if we’re creating a monitoring script, the we should also build in some tool function to the same scripts (and vice versa). They should all include a -h (or --help) option to give a brief description.

It currently seems logical, that every script should have an associated set of operations guides (Operators Guide, Admin Guide and Monitoring Guide). This is because each script will probably be associated to a whole component/application - i.e. omni.terracotta.sh or omni.warp.sh.

Operators Guide = a page to link triggers to with actions for FR to take

Admin Guide = a technical description on how to administer the component/application and what certain technical results from OSS scripts may mean.

Monitoring Guide = a page describing what the scripts and trigger expressions are actually doing

There is also a confluence tools page which should maybe also be used to describe the scripts and their tool functions.

SVN


As there will be multiple people editing and creating OSS scripts a need to control the updates is now needed. This way we only have to go to one place and we know where all of the scripts are. I.e. if we are monitoring the image servers, we should build a new function within the monitoring script should we wish to add tool. SVN is seen as the best function for this. Especially as it is the company choice for revision control. Currently we have created our own trunk on Zabbix.uk3 but this will probably move into a branch on the Omnifone system at some point. Using SVN is described below.

Beneath the SVN tree for zabbix, there are two branches. One for Zabbix server and one for Zabbix agent

Creating a new agent script

  1. login into Zabbix.uk3 as yourself
  2. setup your environment
    1. if you don’t have one already, create your own SVN sub-directory and cd into it ($ mkdir svn; cd svn)
    2. if it isn’t already set, ensure your command line editor is vi ($ export EDITOR=vi)
  3. checkout the scripts directory for editing ($ svn co svn://localhost/zabbix/agent/scripts)
  4. cd into the scripts directory and copy the template to your new file name (I.e. $ cd scripts; cp omni.template.sh omni.newComponent.sh)
  5. edit your new script as you see fit
  6. add your new script into the branch ($ svn add omni.newComponent.sh)
  7. check back in (commit) the branch ($ cd ..; svn ci scripts)
    1. this will fire up a vi editor where you are encouraged to document your changes.
    2. write and save and watch the magic happen

Editing an existing script

  1. login into Zabbix.uk3 as yourself
  2. setup your environment

    1. if you don’t have one already, create your own SVN sub-directory and cd into it ($ mkdir svn; cd svn)
    2. if it isn’t already set, ensure your command line editor is vi ($ export EDITOR=vi)
  1. checkout the script for editing ($ svn co svn://localhost/zabbix/agent/scripts/omni.myscript.sh)
  2. edit your script as you see fit
  3. check back in (commit) the script ($ svn ci omni.myscript.sh)
    1. this will fire up a vi editor where you are encouraged to document your changes.
    2. write and save and watch the magic happen

Create a new sub-directory within a branch

  1. login into Zabbix.uk3 as yourself
  2. setup your environment
    1. if you don’t have one already, create your own SVN sub-directory and cd into it ($ mkdir svn; cd svn)
    2. if it isn’t already set, ensure your command line editor is vi ($ export EDITOR=vi)
  3. create the directory with the SVN branch ($ svn mkdir svn://localhost/zabbix/agent/scripts/conf)
  4. if you need to add files into this directory follow steps 3 - 7 in Creating a new agent script

Other Commands


Other commands are available like ls, cat, rm and cp. Details can be seen by using help ($ svn help or $ svn help ls). For example, to run ls with username and password:

$ svn ls verbose username <username> --password <password> svn://path/to/directory