Index: /trunk/Nebulous-Server/Build.PL
===================================================================
--- /trunk/Nebulous-Server/Build.PL	(revision 12004)
+++ /trunk/Nebulous-Server/Build.PL	(revision 12005)
@@ -100,4 +100,5 @@
         bin/neb-initdb
         bin/neb-addvol
+        bin/nebdiskd
     )],
 )->create_build_script;
Index: /trunk/Nebulous-Server/MANIFEST
===================================================================
--- /trunk/Nebulous-Server/MANIFEST	(revision 12004)
+++ /trunk/Nebulous-Server/MANIFEST	(revision 12005)
@@ -10,4 +10,5 @@
 bin/neb-addvol
 bin/neb-initdb
+bin/nebdiskd
 docs/c_api.h
 docs/database_setup.txt
Index: /trunk/Nebulous-Server/bin/nebdiskd
===================================================================
--- /trunk/Nebulous-Server/bin/nebdiskd	(revision 12005)
+++ /trunk/Nebulous-Server/bin/nebdiskd	(revision 12005)
@@ -0,0 +1,78 @@
+#!/usr/bin/env perl
+
+# Copyright (C) 2007  Joshua Hoblitt
+# 
+# $Id: nebdiskd,v 1.1 2007-02-23 01:10:57 jhoblitt Exp $
+
+use strict;
+use warnings FATAL => qw( all );
+
+use vars qw( $VERSION );
+$VERSION = '0.02';
+
+use Net::Server::Daemonize qw(daemonize);
+use Sys::Statistics::Linux::DiskUsage;
+use DBI;
+use Nebulous::Server::SQL;
+
+use Getopt::Long qw( GetOptions :config auto_help auto_version );
+use Pod::Usage qw( pod2usage );
+
+my ($debug, $db, $dbuser, $dbpass);
+
+$db     = $ENV{'NEB_DB'} unless $db;
+$dbuser = $ENV{'NEB_USER'} unless $dbuser;
+$dbpass = $ENV{'NEB_PASS'} unless $dbpass;
+
+our $POLL_INTERVAL = 5;
+
+GetOptions(
+    'debug|d'   => \$debug,
+    'db=s'      => \$db,
+    'user=s'    => \$dbuser,
+    'pass=s'    => \$dbpass,
+) || pod2usage( 2 );
+
+pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
+pod2usage( -msg => "Required options: --db --user --pass", -exitval => 2 )
+    unless $db && $dbuser && $dbpass;
+
+daemonize(
+    'jhoblitt', # User
+    'wheel',    # Group
+    undef       # PID file
+) unless $debug;
+
+my $sql = Nebulous::Server::SQL->new;
+
+my $dbh = DBI->connect(
+    "DBI:mysql:database=$db:host=localhost",
+    $dbuser,
+    $dbpass,
+    {
+        RaiseError => 1,
+        PrintError => 0,
+        AutoCommit => 0,
+    },
+);
+
+$dbh->do( $sql->set_transaction_model );
+$dbh->commit;
+
+my $lxs   = Sys::Statistics::Linux::DiskUsage->new;
+
+while (1) {
+    my $query = $dbh->prepare_cached("INSERT INTO mount VALUES(?, ?, ?)");
+    $dbh->do("DELETE FROM mount");
+
+    my $stats = $lxs->get;
+    foreach my $dev (keys %$stats) {
+        my $mnt = $stats->{$dev};
+        my %mount;
+        $query->execute(@$mnt{qw( mountpoint total usage )});
+    }
+
+    $dbh->commit;
+
+    sleep $POLL_INTERVAL;
+}
Index: /trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm
===================================================================
--- /trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm	(revision 12004)
+++ /trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm	(revision 12005)
@@ -1,5 +1,5 @@
 # Copyright (c) 2004  Joshua Hoblitt
 #
-# $Id: SQL.pm,v 1.21 2006-12-08 20:59:59 jhoblitt Exp $
+# $Id: SQL.pm,v 1.22 2007-02-23 01:10:57 jhoblitt Exp $
 
 package Nebulous::Server::SQL;
@@ -221,7 +221,14 @@
     vol_id INT NOT NULL AUTO_INCREMENT,
     name VARCHAR(255) UNIQUE NOT NULL,
-    uri VARCHAR(255) NOT NULL,
+    mountpoint VARCHAR(255) NOT NULL,
     PRIMARY KEY(vol_id),
     KEY(name(16))
+) ENGINE=innodb;
+
+CREATE TABLE mount (
+    mountpoint VARCHAR(255) NOT NULL,
+    total BIGINT NOT NULL,
+    used BIGINT NOT NULL,
+    PRIMARY KEY(mountpoint)
 ) ENGINE=innodb;
 
Index: /trunk/Nebulous/Build.PL
===================================================================
--- /trunk/Nebulous/Build.PL	(revision 12004)
+++ /trunk/Nebulous/Build.PL	(revision 12005)
@@ -100,4 +100,5 @@
         bin/neb-initdb
         bin/neb-addvol
+        bin/nebdiskd
     )],
 )->create_build_script;
Index: /trunk/Nebulous/MANIFEST
===================================================================
--- /trunk/Nebulous/MANIFEST	(revision 12004)
+++ /trunk/Nebulous/MANIFEST	(revision 12005)
@@ -10,4 +10,5 @@
 bin/neb-addvol
 bin/neb-initdb
+bin/nebdiskd
 docs/c_api.h
 docs/database_setup.txt
Index: /trunk/Nebulous/bin/nebdiskd
===================================================================
--- /trunk/Nebulous/bin/nebdiskd	(revision 12005)
+++ /trunk/Nebulous/bin/nebdiskd	(revision 12005)
@@ -0,0 +1,78 @@
+#!/usr/bin/env perl
+
+# Copyright (C) 2007  Joshua Hoblitt
+# 
+# $Id: nebdiskd,v 1.1 2007-02-23 01:10:57 jhoblitt Exp $
+
+use strict;
+use warnings FATAL => qw( all );
+
+use vars qw( $VERSION );
+$VERSION = '0.02';
+
+use Net::Server::Daemonize qw(daemonize);
+use Sys::Statistics::Linux::DiskUsage;
+use DBI;
+use Nebulous::Server::SQL;
+
+use Getopt::Long qw( GetOptions :config auto_help auto_version );
+use Pod::Usage qw( pod2usage );
+
+my ($debug, $db, $dbuser, $dbpass);
+
+$db     = $ENV{'NEB_DB'} unless $db;
+$dbuser = $ENV{'NEB_USER'} unless $dbuser;
+$dbpass = $ENV{'NEB_PASS'} unless $dbpass;
+
+our $POLL_INTERVAL = 5;
+
+GetOptions(
+    'debug|d'   => \$debug,
+    'db=s'      => \$db,
+    'user=s'    => \$dbuser,
+    'pass=s'    => \$dbpass,
+) || pod2usage( 2 );
+
+pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
+pod2usage( -msg => "Required options: --db --user --pass", -exitval => 2 )
+    unless $db && $dbuser && $dbpass;
+
+daemonize(
+    'jhoblitt', # User
+    'wheel',    # Group
+    undef       # PID file
+) unless $debug;
+
+my $sql = Nebulous::Server::SQL->new;
+
+my $dbh = DBI->connect(
+    "DBI:mysql:database=$db:host=localhost",
+    $dbuser,
+    $dbpass,
+    {
+        RaiseError => 1,
+        PrintError => 0,
+        AutoCommit => 0,
+    },
+);
+
+$dbh->do( $sql->set_transaction_model );
+$dbh->commit;
+
+my $lxs   = Sys::Statistics::Linux::DiskUsage->new;
+
+while (1) {
+    my $query = $dbh->prepare_cached("INSERT INTO mount VALUES(?, ?, ?)");
+    $dbh->do("DELETE FROM mount");
+
+    my $stats = $lxs->get;
+    foreach my $dev (keys %$stats) {
+        my $mnt = $stats->{$dev};
+        my %mount;
+        $query->execute(@$mnt{qw( mountpoint total usage )});
+    }
+
+    $dbh->commit;
+
+    sleep $POLL_INTERVAL;
+}
Index: /trunk/Nebulous/lib/Nebulous/Server/SQL.pm
===================================================================
--- /trunk/Nebulous/lib/Nebulous/Server/SQL.pm	(revision 12004)
+++ /trunk/Nebulous/lib/Nebulous/Server/SQL.pm	(revision 12005)
@@ -1,5 +1,5 @@
 # Copyright (c) 2004  Joshua Hoblitt
 #
-# $Id: SQL.pm,v 1.21 2006-12-08 20:59:59 jhoblitt Exp $
+# $Id: SQL.pm,v 1.22 2007-02-23 01:10:57 jhoblitt Exp $
 
 package Nebulous::Server::SQL;
@@ -221,7 +221,14 @@
     vol_id INT NOT NULL AUTO_INCREMENT,
     name VARCHAR(255) UNIQUE NOT NULL,
-    uri VARCHAR(255) NOT NULL,
+    mountpoint VARCHAR(255) NOT NULL,
     PRIMARY KEY(vol_id),
     KEY(name(16))
+) ENGINE=innodb;
+
+CREATE TABLE mount (
+    mountpoint VARCHAR(255) NOT NULL,
+    total BIGINT NOT NULL,
+    used BIGINT NOT NULL,
+    PRIMARY KEY(mountpoint)
 ) ENGINE=innodb;
 
