From b9cf39b5041702b3211a4ea5b471a3b059cd81ea Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 9 Feb 2011 08:57:23 +0000 Subject: automatically generate monthly torrus reports before 1st of the month billing, RT#10574 --- FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm') diff --git a/FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm b/FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm index d55bfc35b..e48b6a6f8 100644 --- a/FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm +++ b/FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm @@ -94,6 +94,21 @@ sub find_svc { 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) = @_; -- cgit v1.2.1