diff options
author | ivan <ivan> | 2011-02-09 08:57:23 +0000 |
---|---|---|
committer | ivan <ivan> | 2011-02-09 08:57:23 +0000 |
commit | b9cf39b5041702b3211a4ea5b471a3b059cd81ea (patch) | |
tree | b31c9f73630ee1b8183f4c01018e4c63d8fb406c /FS/FS/NetworkMonitoringSystem | |
parent | 1833cbb8c9a99ac9e650dda0a51bba492ad25c04 (diff) |
automatically generate monthly torrus reports before 1st of the month billing, RT#10574
Diffstat (limited to 'FS/FS/NetworkMonitoringSystem')
-rw-r--r-- | FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm b/FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm index d55bfc3..e48b6a6 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) = @_; |