Commit 9ec1b245 authored by Christopher R. Gabriel's avatar Christopher R. Gabriel
Browse files

removed tg since it's in his dedicated branch

parent ff410c4a
*.pyc
*.swp
OctoMonUI/dev.cfg
OctoMonUI/imported/*.msg
OctoMonUI/octomonui/static/graphs/components/*.png
OctoMonUI/octomonui/static/graphs/usage/*.png
OctoMonUI/octomonui/static/graphs/usagechart.png
README for octomon-sender
=========================
Installing octomon-sender
-------------------------
1. Install the debian package
2. If you do not have octofuss installed:
2a. touch /var/lib/octofuss/octofuss.db
2b. generate a new set of keys for the sender:
openssl req -newkey rsa:1024 -nodes -x509 -days 3650 -out sender.pem
mv privkey.pem sender_key.pem
and for the receiver, if you don't already have them:
openssl req -newkey rsa:1024 -nodes -x509 -days 3650 -out receiver.pem
mv privkey.pem receiver_key.pem
2c. edit /etc/octomon/octomon.conf with the location of the keys:
[sender]
receiver cert = /etc/ssl/certs/octomon-central-server.pem
sender cert = /etc/ssl/certs/octomon-server-cert.pem
sender key = /etc/ssl/private/octomon-server-key.pem
3. Edit /etc/octomon/octomon.conf with the post address:
[sender]
post address = http://your.octomonui.receiver/upload/schooldata
Decoding an encrypted packet
----------------------------
This is done automatically by the server; however, if you want to open an
encrypted packet to see what is inside, this is the procedure:
To decrypt:
* openssl smime -in encrypted -out decrypted.zip -inkey certs/receiver_key.pem -decrypt
* unzip decrypted.zip
To verify the signature:
* openssl smime -in data.csv.gz.smime -out data.csv.gz -certfile sender.pem -verify -nointern -CAfile sender.pem
* openssl smime -in metadata.txt.gz.smime -out metadata.txt.gz -certfile sender.pem -verify -nointern -CAfile sender.pem
* openssl smime -in data.csv.gz.smime -out data.csv.gz -certfile pubkey.pem -verify -nointern -noverify
* openssl smime -in metadata.txt.gz.smime -out metadata.txt.gz -certfile pubkey.pem -verify -nointern -noverify
octomon-sender (0.2-2) UNRELESEAD; urgency=low
* New master SSL certificate
-- Christopher R. Gabriel <cgabriel@truelite.it> Mon, 13 Oct 2008 11:44:12 +0200
octomon-sender (0.2) UNRELEASED; urgency=low
* Fixed cron script
-- Enrico Zini <enrico@debian.org> Mon, 25 Feb 2008 11:18:10 +0000
octomon-sender (0.1) UNRELEASED; urgency=low
* Initial release.
-- Enrico Zini <enrico@debian.org> Mon, 04 Feb 2008 09:50:40 +0000
Source: octomon-sender
Section: admin
Priority: optional
Maintainer: Christopher Gabriel <cgabriel@truelite.it>
Uploaders: Enrico Zini <enrico@truelite.it>
Build-Depends: debhelper (>= 5.0.38), python-all-dev (>= 2.3.5-11), python-central (>= 0.5.6), cdbs
XS-Python-Version: >=2.3
Standards-Version: 3.7.2
Package: octomon-sender
Architecture: all
Depends: python-octomon, python-sqlite, ${python:Depends}, munin-node, munin
XB-Python-Version: ${python:Versions}
Description: Octomon sender tool
This package contains the tool used by Octomon to send data to the central
server.
.
Octomon is [...]
This package was debianized by Enrico Zini <enrico@debian.org> on
Mon Feb 4 9:20:30 GMT 2008.
Upstream Authors:
Christopher Gabriel <cgabriel@truelite.it>
Enrico Zini <enrico@truelite.it>
Copyright (C) 2008 Truelite S.r.l.
License:
This program 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 of the License, or
(at your option) any later version.
This program 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 this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
The Debian packaging is (C) 2008, Truelite S.r.l., and is licensed under the
GPL. On Debian systems, the complete text of the GNU General Public License can
be found in `/usr/share/common-licenses/GPL'.
#!/bin/sh
[ -f /usr/bin/octomon-sender ] && /usr/bin/octomon-sender --syslog --post=auto
/var/lib/octomon
/var/lib/octofuss
#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
# For the relevant CDBS documentation, see
# https://perso.duckcorp.org/duck/cdbs-doc/cdbs-doc.xhtml#id2528674
include /usr/share/cdbs/1/rules/debhelper.mk
DEB_PYTHON_SYSTEM = pycentral
include /usr/share/cdbs/1/class/python-distutils.mk
install/octomon-sender::
install -o root -g root -m 755 -d debian/$(cdbs_curpkg)/etc/octomon/
install -o root -g root -m 644 octomon.conf debian/$(cdbs_curpkg)/etc/octomon/
install -o root -g root -m 755 -d debian/$(cdbs_curpkg)/etc/ssl/certs
install -o root -g root -m 644 octomon-central-server.pem debian/$(cdbs_curpkg)/etc/ssl/certs/
#!/bin/sh
# Shows how to open an encrypted package using standard tools
FILE=$1
OUT=$FILE.out
rm -r "$OUT"
mkdir -p $OUT
openssl smime -in $FILE -out $OUT/decrypted -inkey certs/server_key.pem -decrypt
(
cd $OUT
unzip decrypted
openssl x509 -fingerprint -in pubkey.pem -noout
openssl smime -in data.csv.gz.smime -out data.csv.gz -certfile pubkey.pem -verify -noverify
openssl smime -in metadata.txt.gz.smime -out metadata.txt.gz -certfile pubkey.pem -verify -noverify
gunzip metadata.txt.gz
gunzip data.csv.gz
)
-----BEGIN CERTIFICATE-----
MIID1zCCA0CgAwIBAgIJAMAV2JNZsJEMMA0GCSqGSIb3DQEBBQUAMIGkMQswCQYD
VQQGEwJJVDEQMA4GA1UECBMHQm9semFubzEQMA4GA1UEBxMHQm9semFubzEVMBMG
A1UEChMMRlVTUyBQcm9qZWN0MRgwFgYDVQQLEw9PY3RvbW9uIFNlcnZpY2UxGzAZ
BgNVBAMTEm9jdG9tb24uZnVzcy5iei5pdDEjMCEGCSqGSIb3DQEJARYUd2VibWFz
dGVyQGZ1c3MuYnouaXQwHhcNMDgxMDEzMTAwMDM3WhcNMTgxMDExMTAwMDM3WjCB
pDELMAkGA1UEBhMCSVQxEDAOBgNVBAgTB0JvbHphbm8xEDAOBgNVBAcTB0JvbHph
bm8xFTATBgNVBAoTDEZVU1MgUHJvamVjdDEYMBYGA1UECxMPT2N0b21vbiBTZXJ2
aWNlMRswGQYDVQQDExJvY3RvbW9uLmZ1c3MuYnouaXQxIzAhBgkqhkiG9w0BCQEW
FHdlYm1hc3RlckBmdXNzLmJ6Lml0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB
gQDp9ma5wzU4aXZ5KVe9m36A0ZzWOSXP718AiJtmvTQAMUD72HcBMqnoEJqtiLEm
xSdj9aGECayra31lVwQRWaumHYVHInu8MePcg/xdnOyIGG++XQarlIKIySnT8E1P
kV4ZkNJbaerc2LE6bIJr5AadtiDYYtA4+IOXKLOENiMdiwIDAQABo4IBDTCCAQkw
HQYDVR0OBBYEFCfi7Im4gKHsTesFqC18OvxQELdSMIHZBgNVHSMEgdEwgc6AFCfi
7Im4gKHsTesFqC18OvxQELdSoYGqpIGnMIGkMQswCQYDVQQGEwJJVDEQMA4GA1UE
CBMHQm9semFubzEQMA4GA1UEBxMHQm9semFubzEVMBMGA1UEChMMRlVTUyBQcm9q
ZWN0MRgwFgYDVQQLEw9PY3RvbW9uIFNlcnZpY2UxGzAZBgNVBAMTEm9jdG9tb24u
ZnVzcy5iei5pdDEjMCEGCSqGSIb3DQEJARYUd2VibWFzdGVyQGZ1c3MuYnouaXSC
CQDAFdiTWbCRDDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAK073I7D
drRFOfC/Lx7Bpj8f9XXvm529JmVUn/lFUDqYXtDSSiPgA2HACuo6mEx5JBVbbvvS
v1sxwKrWJKYPJfkD3zBjBfrxoRs71yXfoLwwXiav4SZrHKf+rrB7aAojUZwDuOQ6
jebzvAcPpaxFuZtjdaRZBF++EvosKjHvuFhn
-----END CERTIFICATE-----
This diff is collapsed.
# This is the configuration file for OctoMon
#
# Default values are shown, but commented out
#
[sender]
# db = /var/lib/octofuss/octofuss.db
# receiver cert = /etc/ssl/certs/octomon-central-server.pem
# sender cert = /etc/ssl/certs/octomon-server-cert.pem
# sender key = /etc/ssl/private/octomon-server-key.pem
post address = http://octomon.fuss.bz.it/upload/schooldata
[munin components]
# regexp =
# regexp = substitution
df-.+ =
squid-.+ =
uptime-uptime = uptime
#smart_(.+)-Temperature_Celsius = temp_\1
hddtemp_smartctl-(.+) = temp_\1
load-load = load
netstat-established = netstat
processes-processes = processes
if_(.+)-up = \1-up
if_(.+)-down = \1-down
uptime-uptime = uptime
[munin resample]
# If only "regexp =" is given, CF defaults to AVERAGE and step defaults to 1 hour (3600)
# regexp = DEF:val=%DEF%:CF[:step=...] [CDEF:...] XPORT:val
[munin hostnames]
name localhost.localdomain = :SERVER:
#name stanlio.isicm.bo.it = :SERVER:
#re (.+)\.isicm.bo.it =
# regexp match = regexp substitution
#!/usr/bin/env python
from distutils.core import setup
setup(name='OctomonSender',
version='1.0',
description='Octomon sender',
author=['Enrico Zini','Christopher Gabriel'],
author_email=['enrico@truelite.it', 'cgabriel@truelite.it'],
url='https://devel.fuss.bz.it/wiki/OctoMon/',
install_requires = [
"octomon",
],
scripts=['octomon-sender'],
)
#!/bin/sh
PYTHONPATH=../lib ./octomon-sender "$@"
import unittest
from sender import DB
class TestDB(unittest.TestCase):
def setUp(self):
"""
Create an empty in-memory database to use for tests
"""
self.db = DB(":memory:")
cu = self.db.db.cursor()
cu.execute("create table client_activity (hostname text not null, timestamp float not null)");
cu.execute("create table client_components (hostname text not null, component text not null, value text not null, timestamp float not null)")
self.db.db.commit()
self.sequence = 0
def populate(self):
"""
Populate the database with 5 client_activity and 5 client_components rows.
The timestamps are always increasing, even across different populate() calls.
"""
cu = self.db.db.cursor()
for i in xrange(5):
self.sequence += 1
cu.execute("INSERT INTO client_activity VALUES (%s, %f)",
"host%d" % i,
self.sequence)
cu.execute("INSERT INTO client_components VALUES (%s, %s, %s, %f)",
"host%d" % i,
"comp%d" % i,
"val%d" % (self.sequence),
self.sequence)
self.db.db.commit()
def testEvrange(self):
"Test the boundary behaviour of DB.evrange"
self.populate()
# Check if the extremes are included
timestamps = []
for a, b, c, d in self.db.evrange(1, 3):
timestamps.append(d)
timestamps.sort()
self.assertEquals(timestamps, [1.0, 1.0, 2.0, 2.0])
# Check if all the rest of the data comes out
timestamps = []
for a, b, c, d in self.db.evrange(3, 10):
timestamps.append(d)
timestamps.sort()
self.assertEquals(timestamps, [3.0, 3.0, 4.0, 4.0, 5.0, 5.0])
def testSendLog(self):
"Test the behaviour of the send log"
self.populate()
# At the beginning, the send log is empty
lastsend = self.db.lastsend()
self.assertEquals(lastsend, 0.0)
# Perform an extraction
count = 0
for x in self.db.evrange(lastsend, 6):
count += 1
self.assertEquals(count, 10)
# Log the successful extraction
self.db.log_successful_send(lastsend, 6, 10)
# Check what is logged
log = [x for x in self.db.list_sends()]
self.assertEquals(len(log), 1)
self.assertEquals(log[0][0], lastsend) # Start
self.assertEquals(log[0][1], 6) # End
self.assertEquals(log[0][2], 10) # Lines
# Check that the next send will start from where we got
self.assertEquals(self.db.lastsend(), 6)
# See that we can parse references to past sends
res = self.db.parse_resend("-1")
self.assertEquals(res, (lastsend, 6))
res = self.db.parse_resend("6")
self.assertEquals(res, (lastsend, 6))
Uno di questi:
create index components_host_id_name on components (host_id, name);
create index components_name_host_id on components (name, host_id);
(probabilmente components_name_host_id)
Metadata-Version: 1.0
Name: OctoMonUI
Version: 0.1
Summary: OctoFuss Monitor
Home-page: http://devel.fuss.bz.it/wiki/OctoMon/
Author: Christopher R. Gabriel
Author-email: cgabriel@truelite.it
License: GPL-2
Description: UNKNOWN
Keywords: turbogears.app
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Framework :: TurboGears
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment