2014-11-28 01:26:28 +01:00
|
|
|
# Billing Module
|
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
With the billing module you can create a bill, assign a quota to it
|
|
|
|
and add ports to it. It then tracks the ports usage and shows you the
|
|
|
|
usage in the bill, including any overage.
|
2016-04-10 16:33:02 +02:00
|
|
|
Accounting by both total transferred data and 95th percentile is supported.
|
|
|
|
|
2014-01-28 20:44:04 +00:00
|
|
|
To enable and use the billing module you need to perform the following steps:
|
|
|
|
|
2014-11-28 01:26:28 +01:00
|
|
|
Edit `config.php` and add (or enable) the following line near the end of the config
|
|
|
|
|
|
|
|
```php
|
|
|
|
$config['enable_billing'] = 1; # Enable Billing
|
|
|
|
```
|
|
|
|
|
|
|
|
Edit `/etc/cron.d/librenms` and add the following:
|
2014-01-28 20:44:04 +00:00
|
|
|
|
2014-11-28 01:26:28 +01:00
|
|
|
```bash
|
2015-08-13 11:36:08 +02:00
|
|
|
*/5 * * * * librenms /opt/librenms/poll-billing.php >> /dev/null 2>&1
|
|
|
|
01 * * * * librenms /opt/librenms/billing-calculate.php >> /dev/null 2>&1
|
2014-11-28 01:26:28 +01:00
|
|
|
```
|
2014-01-28 20:44:04 +00:00
|
|
|
|
2015-08-13 11:36:08 +02:00
|
|
|
Create billing graphs as required.
|
2016-03-02 18:39:16 +00:00
|
|
|
|
2019-05-27 19:44:02 -07:00
|
|
|
## Data Retention
|
2016-03-02 18:39:16 +00:00
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
Billing data is stored in the MySQL database, and you may wish to
|
|
|
|
purge the detailed stats for old data (per-month totals will always be
|
|
|
|
kept). To enable this, add the
|
2016-03-02 18:39:16 +00:00
|
|
|
following to `config.php`:
|
|
|
|
|
|
|
|
```php
|
|
|
|
$config['billing_data_purge'] = 12; // Number of months to retain
|
|
|
|
```
|
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
Data for the last complete billing cycle will always be retained -
|
|
|
|
only data older than this by the configured number of months will be
|
|
|
|
removed. This task is performed in the daily cleanup tasks.
|
2019-05-27 19:44:02 -07:00
|
|
|
|
|
|
|
## 95th Percentile Calculation
|
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
For 95th Percentile billing, the default behavior is to use the
|
|
|
|
highest of the input or output 95th Percentile calculation.
|
2019-05-27 19:44:02 -07:00
|
|
|
|
|
|
|
To instead use the combined total of inout + output to derive the 95th percentile,
|
|
|
|
This can be changed on a per bill basis by setting 95th Calculation to "Aggregate".
|
|
|
|
|
|
|
|
To change the default option to Aggregate,
|
|
|
|
add the following the `config.php`:
|
|
|
|
|
|
|
|
```php
|
|
|
|
$config['billing']['95th_default_agg'] = 1; // Set aggregate 95th as default
|
|
|
|
```
|
|
|
|
|
2019-09-09 05:48:35 -05:00
|
|
|
This configuration setting is cosmetic and only changes the default
|
|
|
|
selected option when adding a new bill.
|