[freeside-commits] freeside/FS/FS/NetworkMonitoringSystem Torrus_Internal.pm, 1.5, 1.6

Ivan,,, ivan at wavetail.420.am
Wed Feb 9 00:57:25 PST 2011


Update of /home/cvs/cvsroot/freeside/FS/FS/NetworkMonitoringSystem
In directory wavetail.420.am:/tmp/cvs-serv3814/FS/NetworkMonitoringSystem

Modified Files:
	Torrus_Internal.pm 
Log Message:
automatically generate monthly torrus reports before 1st of the month billing, RT#10574

Index: Torrus_Internal.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -d -r1.5 -r1.6
--- Torrus_Internal.pm	7 Feb 2011 23:22:33 -0000	1.5
+++ Torrus_Internal.pm	9 Feb 2011 08:57:23 -0000	1.6
@@ -94,6 +94,21 @@
     return $svc_port[0];
 }
 
+sub report {
+  my $self = shift;
+
+  my @lt = localtime(time);
+  my ($d,$m,$y) = ($ls[3], $ls[4]+1, $ls[5]+1900);
+  if ( $ls[3] == 1 ) {
+    $m--;
+    if ($m == 0) { $m=12; $y-- }
+    #i should have better error checking
+    system('torrus', 'report', '--report=MonthlyUsage', "--date=$y-$m-01");
+    system('torrus', 'report', '--genhtml', '--tree=main');
+  }
+
+}
+
 sub add_router {
   my($self, $ip) = @_;
 



More information about the freeside-commits mailing list