[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r15270 - in gauger: . bindings bindings/python
From: |
gnunet |
Subject: |
[GNUnet-SVN] r15270 - in gauger: . bindings bindings/python |
Date: |
Fri, 20 May 2011 13:37:00 +0200 |
Author: bartpolot
Date: 2011-05-20 13:37:00 +0200 (Fri, 20 May 2011)
New Revision: 15270
Added:
gauger/bindings/python/
gauger/bindings/python/gauger.py
gauger/bindings/python/setup.py
gauger/bindings/python/test.py
Modified:
gauger/README
gauger/gauger-cli.py
gauger/install.sh
Log:
Added python bindings, updated install script, README
Modified: gauger/README
===================================================================
--- gauger/README 2011-05-20 11:32:55 UTC (rev 15269)
+++ gauger/README 2011-05-20 11:37:00 UTC (rev 15270)
@@ -6,10 +6,10 @@
gauger-cli.py is distributed under:
- GNU GENERAL PUBLIC LICENSE
-gauger.py, styles.css and all .php files are distributed under:
+All .css and .php files are distributed under:
- GNU AFFERO GENERAL PUBLIC LICENSE
-gauger.h is distributed as public domain
+All bindings are distributed as public domain
For details, see each file's header and the COPYING file.
@@ -30,16 +30,9 @@
Installation
============
-* Run install.sh to check for potential problems and try to automatically
- adapt gauger's python scripts to the local machine configuration.
+* Run install.sh with --client and/or --server options to attempt
+ an automatic installation of gauger
-* Client
- Put gauger.py into your $PATH
-
-* Server
- No installation necessary, run from command line or follow your
- distro startup scripts' format.
-
* Create configuration files as described below
@@ -49,8 +42,6 @@
* gauger.conf: Server configuration
Should be placed in same directory as gauger.py. Should contain two
sections,
one with directories and one for authentication.
- * Section net
- Should contain the port on which to listen for incoming connections,
default=10111
* Section dir
Should contain a path where to put the data logged from clients
* Section hosts
@@ -58,9 +49,6 @@
machine authorized to log data to the server, one per line. Username and
password should be separated by a comma and contain no blank spaces.
Example:
- [net]
- port=10111
-
[dir]
data=my_data_directory
@@ -81,14 +69,13 @@
Before running, make sure the appropiate .conf files are in place
* Server
- Run directly in data directory with ./gauger.py > gauger.log
- When manual changes has been done to the raw data files, it's possible
- to regenerate the .dat plotting source files with: ./gauger.py --refresh
+ Start the webserver according to your distribution instructions, making
sure that
+ the web/ directory of gauger is reachable.
* Client
* Command line
- invoke with ./gauger-cli.py -c CATEGORY -n COUNTER_NAME -d COUNTER_VALUE
-u UNIT
- Run ./gauger-cli.py -h for full help and additional options
+ invoke with gauger-cli.py -c CATEGORY -n COUNTER_NAME -d COUNTER_VALUE -u
UNIT
+ Run gauger-cli.py -h for full help and additional options
* C program
* Include "gauger.h"
* Call the macro GAUGER("CATEGORY", "COUNTER_NAME", COUNTER_VALUE,
"COUNTER_UNIT")
Added: gauger/bindings/python/gauger.py
===================================================================
--- gauger/bindings/python/gauger.py (rev 0)
+++ gauger/bindings/python/gauger.py 2011-05-20 11:37:00 UTC (rev 15270)
@@ -0,0 +1,33 @@
+"""gauger.py
+
+ This file is part of gauger.
+ Copyright 2011 Bartlomiej Polot
+
+ gauger is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ gauger is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with gauger; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+Gauger python binding.
+
+"""
+import os
+
+"""
+GAUGER main function: try to execute the gauger client and log data to remote
server
+"""
+def GAUGER(category, counter, value, unit):
+ os.system("gauger-cli.py -c %s -n %s -d %s -u %s > /dev/null" % (category,
counter, value, unit))
+
+def GAUGER(category, counter, value, unit, rev):
+ os.system("gauger-cli.py -c %s -n %s -d %s -u %s -i %s > /dev/null" %
(category, counter, value, unit, rev))
\ No newline at end of file
Added: gauger/bindings/python/setup.py
===================================================================
--- gauger/bindings/python/setup.py (rev 0)
+++ gauger/bindings/python/setup.py 2011-05-20 11:37:00 UTC (rev 15270)
@@ -0,0 +1,5 @@
+from distutils.core import setup
+setup(name='gauger',
+ version='1.0.0',
+ py_modules=['gauger'],
+ )
Added: gauger/bindings/python/test.py
===================================================================
--- gauger/bindings/python/test.py (rev 0)
+++ gauger/bindings/python/test.py 2011-05-20 11:37:00 UTC (rev 15270)
@@ -0,0 +1,3 @@
+from gauger import GAUGER
+
+GAUGER("CAT", "NAME", 100, "UNIT", 10000)
Modified: gauger/gauger-cli.py
===================================================================
--- gauger/gauger-cli.py 2011-05-20 11:32:55 UTC (rev 15269)
+++ gauger/gauger-cli.py 2011-05-20 11:37:00 UTC (rev 15270)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python
"""gauger-cli.py
This file is part of gauger.
Modified: gauger/install.sh
===================================================================
--- gauger/install.sh 2011-05-20 11:32:55 UTC (rev 15269)
+++ gauger/install.sh 2011-05-20 11:37:00 UTC (rev 15270)
@@ -31,36 +31,36 @@
V=${V#* }
MSD=${V%%.*}
case $MSD in
- 2)
- echo "Default python version: 2"
- echo "Nothing to change..."
- ;;
- 3)
- echo "Default python version: 3"
- echo "Trying version 2..."
- V=$(/usr/bin/env python2 --version 2>&1)
- if [ "$?" != "0" ]; then
- echo "Please make sure python v2 is installed"
- echo "Consult README for more information"
- echo "and adapt scripts accordingly."
- exit 1
- fi
- V=${V##* }
- MSD=${V%%.*}
- if [ "$MSD" != "2" ]; then
- echo "Executlabe python2 is NOT python 2!!"
- echo "Consult README for more information"
- echo "and adapt scripts accordingly."
- exit 1
- fi
- sed -e "s/#!\/usr\/bin\/env python$/#!\/usr\/bin\/env python2/"
gauger-cli.py > gauger-cli.tmp
- mv gauger-cli.tmp gauger-cli.py
- echo "Done!!"
- ;;
- *)
- echo "Unknown version of python $MSD."
- echo "*** PROGRAM MIGHT NOT WORK ***"
- echo "Consult README file."
+ 2)
+ echo "Default python version: 2"
+ echo "Nothing to change..."
+ ;;
+ 3)
+ echo "Default python version: 3"
+ echo "Trying version 2..."
+ V=$(/usr/bin/env python2 --version 2>&1)
+ if [ "$?" != "0" ]; then
+ echo "Please make sure python v2 is installed"
+ echo "Consult README for more information"
+ echo "and adapt scripts accordingly."
+ exit 1
+ fi
+ V=${V##* }
+ MSD=${V%%.*}
+ if [ "$MSD" != "2" ]; then
+ echo "Executlabe python2 is NOT python 2!!"
+ echo "Consult README for more information"
+ echo "and adapt scripts accordingly."
+ exit 1
+ fi
+ sed -e "s/#!\/usr\/bin\/env python$/#!\/usr\/bin\/env python2/"
gauger-cli.py > gauger-cli.tmp
+ mv gauger-cli.tmp gauger-cli.py
+ echo "Done!!"
+ ;;
+ *)
+ echo "Unknown version of python $MSD."
+ echo "*** PROGRAM MIGHT NOT WORK ***"
+ echo "Consult README file."
esac
# ################ CLIENT INSTALL ################ #
@@ -69,10 +69,10 @@
echo " default [/usr/local/bin]"
read CLIENTPATH
if [ "$CLIENTPATH" = "" ]; then
- CLIENTPATH="/usr/local/bin/"
+ CLIENTPATH="/usr/local/bin/"
fi
if [ ! -d "$CLIENTPATH" ]; then
- mkdir -p "$CLIENTPATH"
+ mkdir -p "$CLIENTPATH"
fi
cp "gauger-cli.py" "$CLIENTPATH"
@@ -81,51 +81,55 @@
if [ "$SERVER" = "0" ]; then
-
+
# ################ GNUPLOT ################ #
-
+
V=$(gnuplot --version 2>&1)
if [ "$?" != "0" ]; then
- echo "Gnuplot not detected. Since you are installing the gauger server,"
- echo "please make sure gnuplot is installed. Otherwise plots won't
work."
+ echo "Gnuplot not detected. Since you are installing the gauger
server,"
+ echo "please make sure gnuplot is installed. Otherwise plots won't
work."
fi
V=${V#* }
MSD=${V%%.*}
case $MSD in
- 4)
- echo "Version of gnuplot is OK."
- ;;
- *)
- echo "Untested version of gnuplot $MSD. Plotting *might* not work."
- echo "Since you are insalling a server, try to update Gnuplot."
+ 4)
+ echo "Version of gnuplot is OK."
+ ;;
+ *)
+ echo "Untested version of gnuplot $MSD. Plotting *might* not work."
+ echo "Since you are insalling a server, try to update Gnuplot."
esac
-
+
# ################ PHP ################ #
-
+
V=$(php --version 2>&1 | head -n 1)
if [ "$?" != "0" ]; then
- echo "Please make sure PHP is installed."
- echo "Otherwise clients won't be able to visualize the data."
+ echo "Please make sure PHP is installed."
+ echo "Otherwise clients won't be able to visualize the data."
fi
V=${V#* }
MSD=${V%%.*}
case $MSD in
- 5)
- echo "Version of PHP is OK."
- ;;
- *)
- echo "Untested version of PHP $MSD."
- echo "Server *might* not work."
+ 5)
+ echo "Version of PHP is OK."
+ ;;
+ *)
+ echo "Untested version of PHP: $MSD."
+ echo "Server *might* not work."
esac
# ################ SERVER INSTALL ################ #
echo "Please input route where to install the gauger server PHP scripts"
echo " default [/usr/share/gauger]"
- read CLIENTPATH
- if [ "$CLIENTPATH" = "" ]; then
- CLIENTPATH="/usr/local/bin/"
+ read SERVERPATH
+ if [ "$SERVERPATH" = "" ]; then
+ SERVERPATH="/usr/share/gauger"
fi
- cp "gauger-cli.py" "$CLIENTPATH"
-
+ if [ ! -d "$SERVERPATH" ]; then
+ mkdir -p "$SERVERPATH"
+ fi
+ cp -r "web/*" "$SERVERPATH"
+ # TODO: add apache httpd.conf/apache2.conf modification
+
fi #Server part
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r15270 - in gauger: . bindings bindings/python,
gnunet <=