Changeset 19796 for trunk/Nebulous-Server/bin/nebdiskd
- Timestamp:
- Oct 1, 2008, 10:42:31 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/Nebulous-Server/bin/nebdiskd (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous-Server/bin/nebdiskd
r19791 r19796 3 3 # Copyright (C) 2007 Joshua Hoblitt 4 4 # 5 # $Id: nebdiskd,v 1. 7 2008-10-01 00:30:53jhoblitt Exp $5 # $Id: nebdiskd,v 1.8 2008-10-01 20:42:31 jhoblitt Exp $ 6 6 7 7 use strict; … … 15 15 use File::Mountpoint qw( is_mountpoint ); 16 16 use File::Spec; 17 use Filesys::Df; 17 18 use Nebulous::Server::SQL; 18 19 use Net::Server::Daemonize qw( daemonize unlink_pid_file ); 19 use Sys::Statistics::Linux::DiskUsage;20 20 21 21 use Getopt::Long qw( GetOptions :config auto_help auto_version ); … … 95 95 my $poll_interval = $p{poll_interval} || 60; 96 96 my $debug = $p{debug} || 0; 97 98 my $lxs = Sys::Statistics::Linux::DiskUsage->new;99 97 100 98 while (1) { … … 137 135 # this has to be done AFTER we determine what the valid mountpoints 138 136 # are incase is_mountpoint() invokes the automounter 139 my $stats = $lxs->get;140 $stats = fix_disk_stats($stats);141 142 137 foreach my $mnt (@valid_mounts) { 143 my $dev_info = $stats->{$mnt};138 my $dev_info = df($mnt, 1024); 144 139 unless (defined $dev_info) { 145 print "can't find device info for $mnt\n" 146 if $debug; 140 print "can't find device info for $mnt\n" if $debug; 147 141 next; 148 142 } 149 $query->execute( @$dev_info{qw( mountpoint total usage)});150 print "adding $ dev_info->{mountpoint}to db\n" if $debug;143 $query->execute($mnt, @$dev_info{qw( blocks used )}); 144 print "adding $mnt to db\n" if $debug; 151 145 } 152 146
Note:
See TracChangeset
for help on using the changeset viewer.
