From jprewett at common-lisp.net Mon Jun 2 19:12:08 2008 From: jprewett at common-lisp.net (jprewett) Date: Mon, 2 Jun 2008 15:12:08 -0400 (EDT) Subject: [noctool-cvs] CVS source Message-ID: <20080602191208.C4E9620018@common-lisp.net> Update of /project/noctool/cvsroot/source In directory clnet:/tmp/cvs-serv23117 Modified Files: classes.lisp Log Message: added :AFTER method for initialize-instance for the PING-MONITOR class so that it will add-graphs to the ping-monitor by default. --- /project/noctool/cvsroot/source/classes.lisp 2008/05/17 12:43:27 1.2 +++ /project/noctool/cvsroot/source/classes.lisp 2008/06/02 19:12:08 1.3 @@ -85,6 +85,9 @@ ) (:default-initargs :interval 60)) +(defmethod initialize-instance :after ((instance ping-monitor) &key) + (add-graphs instance)) + (add-graph-info ping-monitor graph gauge-graph percentile-graph-display) (defclass disk-monitor (monitor) From imattsson at common-lisp.net Thu Jun 5 05:50:31 2008 From: imattsson at common-lisp.net (imattsson) Date: Thu, 5 Jun 2008 01:50:31 -0400 (EDT) Subject: [noctool-cvs] CVS source Message-ID: <20080605055031.F0FDB4D043@common-lisp.net> Update of /project/noctool/cvsroot/source In directory clnet:/tmp/cvs-serv4928 Modified Files: classes.lisp packages.lisp Log Message: IM Added a stub "view" class (it currently has barely enough slots to be usable and is lacking in methods). The config loader was complaining about it missing, for some reason (never done so before). I think a recent upgrade of SBCL made FIND-CLASS more twitchy. --- /project/noctool/cvsroot/source/classes.lisp 2008/06/02 19:12:08 1.3 +++ /project/noctool/cvsroot/source/classes.lisp 2008/06/05 05:50:31 1.4 @@ -192,3 +192,10 @@ (defmethod remote-passwd ((peer null)) (octetify "a")) +(defclass view () + ((width :accessor width :initarg :width) + (height :accessor height :initarg :height) + (name :accessor name :initarg :name) + (display-objects :accessor display-objects :initarg :display-objects) + ) + (:default-initargs :display-objects nil)) --- /project/noctool/cvsroot/source/packages.lisp 2008/05/29 07:21:12 1.4 +++ /project/noctool/cvsroot/source/packages.lisp 2008/06/05 05:50:31 1.5 @@ -24,7 +24,7 @@ (:nicknames #:noctool-config) (:use #:net.hexapodia.noctool #:cl) (:shadow #:load) - (:export #:cluster #:ping #:load #:machine #:user #:ip #:ssh-port #:disk #:disks #:disk-ignore)) + (:export #:cluster #:ping #:load #:machine #:user #:ip #:ssh-port #:disk #:disks #:disk-ignore #:local-password #:peer)) (defpackage #:net.hexapodia.noctool-network (:use #:net.hexapodia.noctool #:cl #:usocket) From imattsson at common-lisp.net Fri Jun 6 06:18:33 2008 From: imattsson at common-lisp.net (imattsson) Date: Fri, 6 Jun 2008 02:18:33 -0400 (EDT) Subject: [noctool-cvs] CVS source Message-ID: <20080606061833.BA36E67045@common-lisp.net> Update of /project/noctool/cvsroot/source In directory clnet:/tmp/cvs-serv1391 Removed Files: noctool-protocol.txt Log Message: IM Ooops, forgot to shift one doc file at initial check-in. From imattsson at common-lisp.net Fri Jun 6 06:18:34 2008 From: imattsson at common-lisp.net (imattsson) Date: Fri, 6 Jun 2008 02:18:34 -0400 (EDT) Subject: [noctool-cvs] CVS source/docs Message-ID: <20080606061834.1879F6D07D@common-lisp.net> Update of /project/noctool/cvsroot/source/docs In directory clnet:/tmp/cvs-serv1391/docs Added Files: noctool-protocol.txt Log Message: IM Ooops, forgot to shift one doc file at initial check-in. --- /project/noctool/cvsroot/source/docs/noctool-protocol.txt 2008/06/06 06:18:33 NONE +++ /project/noctool/cvsroot/source/docs/noctool-protocol.txt 2008/06/06 06:18:33 1.1 NOCTOOL inter-node protocol * Status messages ** Message Encapsulation All messages are sent in a "message" container, as follows: (message ) The digest is a HMAC-SHA1, keyed by the secret for that connection. ** General error (protocol-error) *Session control **Session initialisation (iam ) **Session termination Either party sends: (session-terminate) Both ends close down the TCP connection *Proxy objects **Requesting proxy objects (request-proxy-class ) (request-proxy-equipment ) (request-proxy-graph ) **Proxy wire protocol (proxy-equipment (id ) (classes ...) (name "") [(monitors (monitor (id ) (type ) (alert-level )))]) (proxy-update (id ) (alert-level )) (proxy-graph (id ) (type ) (values )) (graph-update (id ) (measure )) (class-list (proxy-equipment ...)) **Deleting proxies (delete-proxy ) From imattsson at common-lisp.net Sat Jun 7 10:24:07 2008 From: imattsson at common-lisp.net (imattsson) Date: Sat, 7 Jun 2008 06:24:07 -0400 (EDT) Subject: [noctool-cvs] CVS source Message-ID: <20080607102407.978635E0C8@common-lisp.net> Update of /project/noctool/cvsroot/source In directory clnet:/tmp/cvs-serv11491 Modified Files: utils.lisp Log Message: IM Restructured the BASE64-encoding, needed a way of BASE64-encoding arbritary octet arrays. Added a nonce generator (needed for at least the network layer). Uses /dev/urandom as data source under linux, uses RANDOM (for now) on other architectures. MAKE-NONCE retuns a BASE64-encoded nonce, suitable to send across, get fed through a HMAC and then compared on the return. --- /project/noctool/cvsroot/source/utils.lisp 2008/05/18 10:54:44 1.6 +++ /project/noctool/cvsroot/source/utils.lisp 2008/06/07 10:24:07 1.7 @@ -1,6 +1,8 @@ (in-package #:net.hexapodia.noctool) (defvar *base64* "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/") +(defvar *random-file* nil) + (defmacro with-pty (ptyspec &body body) @@ -180,14 +182,14 @@ collect (ldb (byte 8 pos) n)))) '(vector (unsigned-byte 8)))) -(defun encode-base64 (str) - (let* ((start (octetify str)) - (len (length start))) +(defun encode-base-64-octet-vector (octet-vector) + (let ((start octet-vector) + (len (length octet-vector))) (labels ((get-val (base offset) (let ((pos (+ base offset))) (if (< pos len) (aref start pos) - 0)))) + 0)))) (with-output-to-string (out) (loop for pos from 0 below (* 3 (ceiling len 3)) by 3 for val = (+ (* 256 256 (get-val pos 0)) @@ -200,6 +202,28 @@ out) else do (write-char #\= out))))))) + +(defun encode-base64 (str) + (encode-base-64-octet-vector (octetify str))) + +;;; Crypto helpers +(defun make-nonce (&optional (bits 160)) + "Generate a nonce, with roughly BITS random bits (specifically, at least +that many bits, but it will be read as octets, so may be a bit more), then +returned as a base64-encoded string." + (let* ((octets (ceiling bits 8)) + (data (make-array octets :element-type '(unsigned-byte 8)))) + #+linux + (progn + (unless *random-file* + (setf *random-file* (open "/dev/urandom" + :element-type '(unsigned-byte 8)))) + (read-sequence data *random-file*)) + #-linux + (loop for ix from 0 below octets + do (setf (aref data ix) (random 256))) + + (encode-base-64-octet-vector data))) ;;; (defun get-peer (name) (gethash (string name) *peers*)) From imattsson at common-lisp.net Thu Jun 12 06:02:18 2008 From: imattsson at common-lisp.net (imattsson) Date: Thu, 12 Jun 2008 02:02:18 -0400 (EDT) Subject: [noctool-cvs] CVS source Message-ID: <20080612060218.966B219243@common-lisp.net> Update of /project/noctool/cvsroot/source In directory clnet:/tmp/cvs-serv27867 Modified Files: classes.lisp Log Message: IM Added a slot to the remote-node class, to keep a "local name". --- /project/noctool/cvsroot/source/classes.lisp 2008/06/05 05:50:31 1.4 +++ /project/noctool/cvsroot/source/classes.lisp 2008/06/12 06:02:17 1.5 @@ -183,6 +183,7 @@ (defclass remote-node () ((destination :reader destination :initarg :destination) (dst-port :reader dst-port :initarg :dst-port) + (my-name :reader my-name :initarg :my-name) (my-passwd :reader my-passwd :initarg :my-passwd) (remote-passwd :reader remote-passwd :initarg :remote-passwd) (conn :accessor conn :initarg :conn) From imattsson at common-lisp.net Thu Jun 12 06:11:01 2008 From: imattsson at common-lisp.net (imattsson) Date: Thu, 12 Jun 2008 02:11:01 -0400 (EDT) Subject: [noctool-cvs] CVS source Message-ID: <20080612061101.06AB47323E@common-lisp.net> Update of /project/noctool/cvsroot/source In directory clnet:/tmp/cvs-serv30287 Modified Files: packages.lisp config.lisp Log Message: IM Added a local variable in the config package and a new config statement, to set local network name. --- /project/noctool/cvsroot/source/packages.lisp 2008/06/05 05:50:31 1.5 +++ /project/noctool/cvsroot/source/packages.lisp 2008/06/12 06:11:00 1.6 @@ -10,21 +10,21 @@ (:nicknames #:noctool-graphs) (:use :cl #+sbcl :sb-mop) - (:export #:graph.type #:serialize-data #:show #:make-graph #:meter-graph #:gauge-graph #:avg-graph #:max-graph #:add-value #:fixed-graph-display #:percentile-graph-display #:add-graphs #:add-graph-info #:interval #:store)) + (:export #:graph-type #:serialize-data #:show #:make-graph #:meter-graph #:gauge-graph #:avg-graph #:max-graph #:add-value #:fixed-graph-display #:percentile-graph-display #:add-graphs #:add-graph-info #:interval #:store)) (defpackage #:net.hexapodia.noctool (:nicknames #:noctool) (:use #:cl #:usocket #:net.hexapodia.noctool-scheduler #:net.hexapodia.noctool-graphs #+sbcl :sb-mop) (:export - #:*proxies* #:*peers* #:*equipment* #:*views* #:last-updated #:unix-host #:linux-host #:cpu-monitor #:load-monitor #:ping-monitor #:remote-node #:decode-base64 #:encode-base64 #:octetify #:destination + #:*proxies* #:*peers* #:*equipment* #:*views* #:*noctool-package* #:id #:last-updated #:unix-host #:linux-host #:cpu-monitor #:load-monitor #:ping-monitor #:remote-node #:decode-base64 #:encode-base64 #:octetify #:destination )) (defpackage #:net.hexapodia.noctool-config (:nicknames #:noctool-config) - (:use #:net.hexapodia.noctool #:cl) + (:use #:net.hexapodia.noctool #:net.hexapodia.noctool-graphs #:cl) (:shadow #:load) - (:export #:cluster #:ping #:load #:machine #:user #:ip #:ssh-port #:disk #:disks #:disk-ignore #:local-password #:peer)) + (:export #:cluster #:ping #:load #:machine #:user #:ip #:ssh-port #:disk #:disks #:disk-ignore #:local-password #:local-hostname #:peer)) (defpackage #:net.hexapodia.noctool-network (:use #:net.hexapodia.noctool #:cl #:usocket) --- /project/noctool/cvsroot/source/config.lisp 2008/05/29 07:21:12 1.7 +++ /project/noctool/cvsroot/source/config.lisp 2008/06/12 06:11:01 1.8 @@ -10,6 +10,7 @@ (defvar *config-object* nil) (defvar *disk-container* nil) (defvar *my-password* nil) +(defvar *my-name* nil) (defun bodge-package () (when (find-package *scrap-package-name*) @@ -79,16 +80,20 @@ (defmacro peer (name remote-passwd &optional this-passwd port) `(push (make-instance 'remote-node - :destination ,name - :remote-passwd ,(decode-base64 remote-passwd :result :octet) - :my-passwd ,(choose-password this-passwd - remote-passwd) - ,@(when port (list :dst-port port))) - *loaded-objects*)) + :destination ,name + :remote-passwd ,(decode-base64 remote-passwd :result :octet) + :my-name (or *my-name* (error "No local hostname defined")) + :my-passwd ,(choose-password this-passwd + remote-passwd) + ,@(when port (list :dst-port port))) + *loaded-objects*)) (defmacro local-password (string) `(setf *my-password* ,(decode-base64 string :result :octet))) +(defmacro local-hostname (string-des) + `(setf *my-name* ,(string string-des))) + (defmacro machine (name type &rest specifics) (let ((*config-object* (new-symbol)) (*macro-nesting* (cons :machine *macro-nesting*))) From jprewett at common-lisp.net Thu Jun 12 13:24:41 2008 From: jprewett at common-lisp.net (jprewett) Date: Thu, 12 Jun 2008 09:24:41 -0400 (EDT) Subject: [noctool-cvs] CVS source Message-ID: <20080612132441.2CA11702EF@common-lisp.net> Update of /project/noctool/cvsroot/source In directory clnet:/tmp/cvs-serv31179 Modified Files: classes.lisp Log Message: added :AFTER method for INITIALIZE-INSTANCE for the load-monitor class to add graphs to the instance after it is initialized. --- /project/noctool/cvsroot/source/classes.lisp 2008/06/12 06:02:17 1.5 +++ /project/noctool/cvsroot/source/classes.lisp 2008/06/12 13:24:40 1.6 @@ -45,6 +45,9 @@ ) (:default-initargs :low-water 1.0 :high-water 5.0)) +(defmethod initialize-instance :after ((instance load-monitor) &key) + (add-graphs instance)) + (defclass tcp-monitor (monitor) ((sent-data :reader sent-data :initarg :sent-data :initform nil) (match-data :reader match-data :initarg :match-data :initform nil) From imattsson at common-lisp.net Thu Jun 12 14:41:12 2008 From: imattsson at common-lisp.net (imattsson) Date: Thu, 12 Jun 2008 10:41:12 -0400 (EDT) Subject: [noctool-cvs] CVS web Message-ID: <20080612144112.2451847183@common-lisp.net> Update of /project/noctool/cvsroot/web In directory clnet:/tmp/cvs-serv21313 Modified Files: index.html Log Message: IM Updated the index page, to reflect workingness of anon CVS. --- /project/noctool/cvsroot/web/index.html 2008/05/14 20:31:01 1.3 +++ /project/noctool/cvsroot/web/index.html 2008/06/12 14:41:12 1.4 @@ -46,7 +46,7 @@

Current status

NOCtool is currently a work in progress and not really suitable for - deployment. There is web access to the CVS repository and anonymous cvs via cvs -z3 -d :pserver:anonymous:anonymous at common-lisp.net:/project/noctool/cvsroot co source. Note, it seems the anonymous CVS isn't working quite yet, it's being worked on.

+ deployment. There is web access to the CVS repository and anonymous cvs via cvs -z3 -d :pserver:anonymous:anonymous at common-lisp.net:/project/noctool/cvsroot co source.

There's some guidance to NOCtool internals, for those who are interested.