2.1. Installation

SANET relies on many other software applications and libraries. Here we list such dependecies. If you need help about how to install them in your system, we suggest to refer to your own system’s documentation, or instead to our Installation and test requirements document which shows the procedures we use to install these packages (and may not be the best way to install them in your own system).

2.1.2. Installation procedure

  1. Download sanet-xxx.tar.gz source tarball from SANET download page and extract it. If you want to stay on the bleeding edge, you can run sanet out of an SVN working copy, from https://sanet.svn.sourceforge.net/svnroot/sanet/trunk

  2. In your profile export the environment variable SANET_HOME pointing to the directory into which you extracted SANET:

    helicopter:~# export SANET_HOME=`pwd`/sanet
    
  3. Copy settings_dist.py to settings.py and edit it according to your needs (for full documentation see Configuration)

    You MUST uncomment database connection settings and change them to suit your needs. Please note that postgresql_psycopg2 postgresql_psycopg2 is the only supported database. In this documentation we always assume that you are using the default database name and owner.

    # DATABASE_ENGINE = 'postgresql_psycopg2'  # 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'ado_mssql'.
    # DATABASE_NAME = 'sanet'             # Or path to database file if using sqlite3.
    # DATABASE_USER = 'sanet'             # Not used with sqlite3.
    # DATABASE_PASSWORD = ''         # Not used with sqlite3.
    # DATABASE_HOST = ''             # Not used with sqlite3.
    # DATABASE_PORT = ''             # Not used with sqlite3.
    

    You can also choose the maximum number of targets, measures or events displayed in each page, by uncommenting and changing the respective MAX_*_PER_PAGE value

    # MAX_TARGETS_PER_PAGE = 30
    # MAX_MEASURES_PER_PAGE = 30
    # MAX_EVENTS_PER_PAGE = 30
    
  1. Create your own user and database (PostgreSQL suggested)

    helicopter:~# psql -U postgres
    Welcome to psql 8.3.1, the PostgreSQL interactive terminal.
    
    Type:  \copyright for distribution terms
               \h for help with SQL commands
               \? for help with psql commands
               \g or terminate with semicolon to execute query
               \q to quit
    
    postgres=# create role sanet login password '';
    CREATE ROLE
    postgres=# create database sanet owner sanet encoding 'utf8';
    CREATE DATABASE
    postgres=# grant all privileges on database sanet to sanet;
    GRANT
    postgres=# \q
  2. Initialize database and SANET library:

    helicopter:~# python $SANET_HOME/manage.py syncdb
    helicopter:~# python $SANET_HOME/manage.py sanetdata
    helicopter:~# python $SANET_HOME/manage.py cli -l < $SANET_HOME/etc/library-it
    
  3. Run SANET !

    You must be root to start the Poller process (you must be able to open RAW sockets to ping), or if you’re using a GNU/Linux system, at least you must have the CAP_NET_RAW capability active.

    helicopter:~# $SANET_HOME/etc/rc.sanet start
    

    To start the Web User Interface (you don’t need special privileges) execute:

    helicopter:~$ $SANET_HOME/etc/rc.sanet web
    

2.1.3. Test your installation

  • Testing database connection:

    helicopter:/usr/local/sanet# etc/rc.sanet dbshell
    

    You should be taken to your database command line interface. See rc.sanet dbshell does not work otherwise.

  • Testing that model has been installed correctly:

    helicopter:/usr/local/sanet# etc/rc.sanet manage shell
    
    >>> from state.models import *
    >>> from map.models import *
    

    No output is given if it’s all ok. If some error is raised it means that Requirements are not satisfied.

2.1.4. Deployment

Only apache webserver deployment is currently supported.

2.1.4.1. Requirements

  • Apache 2.x with mod_python 3.x.

2.1.4.1.1. Recommends

  • Apache 2.x modules: mod_ssl, mod_deflate

2.1.4.2. Deployment procedure

  1. Execute:

    # python manage.py deploy <webserver>
    
  2. Configure your webserver accordingly to the configuration proposed.

  3. Make $SANET_HOME/static/measures writable by your http daemon.

    helicopter:~# ps aux | grep apache2
    www-data   488  0.0  0.6  37724  6300 ?        S    01:39   0:00 /usr/sbin/apache2 -k start
    www-data   492  0.0  0.6  37708  6340 ?        S    01:39   0:00 /usr/sbin/apache2 -k start
    www-data   493  0.0  0.6  37732  6400 ?        S    01:39   0:00 /usr/sbin/apache2 -k start
    root     10167  0.0  0.9  37264  9720 ?        Ss   Jun02   0:01 /usr/sbin/apache2 -k start
    www-data 10172  0.0  0.6  37836  6452 ?        S    Jun02   0:00 /usr/sbin/apache2 -k start
    www-data 10173  0.0  0.6  37732  6392 ?        S    Jun02   0:00 /usr/sbin/apache2 -k start
    
    helicopter:~# chown -R www-data $SANET_HOME/static/measures
    

    You might need to grep httpd instead of apache2

2.1.4.3. Commodities

You probably would like to set some symbolic links

helicopter:~# ln -sf $SANET_HOME/bin/* /usr/local/bin
helicopter:~# ln -sf $SANET_HOME/etc/rc.sanet /etc/rc.d/

2.1.4.4. Maintenance operations

The script /etc/rc.d/rc.sanet nightly performs some maintenance operations. We suggest to copy maintenance_settings_dist.py to maintenance_settings.py and put nightly script it in your crontab (i.e. setting it to be launched every day at 6:45 am):

# SANET maintainance
45 6 * * * /etc/rc.d/rc.sanet nightly > /root/lastoutput.sanet.nightly 2>&1

2.1.5. Troubleshooting

For troubleshooting issues refer to the specific page Troubleshooting

If you have any other question please refer to Frequently Asked Questions.

If you still have doubts don’t hesitate to contact us at nad@labs.it