Billing auto add

Hi all,

did anyone manage to properly enable billing auto add? What I’m trying to achieve is to create bill for every customer port that is properly descriped including speed.
For example, I have port with description: Cust: Customer1 [100Mbps] {12345678} (Customer physical Address)

If I understand correctly, after setting in config.php:
$config[‘enable_billing’] = 1;
$config[‘billing’][‘customer_autoadd’] = 1;
$config[‘billing’][‘bill_autoadd’] = 1;

bills should be created for every customer using speed and notes part of port description. Or did I understand this wrong?

That would be cool if it works, where did you find that information?

I can’t find anything in the code except in defaults.php for that.

I think its left-over config options from the original fork.

Hi Chas,

defaults file was place where I found that info. I hope that isn’t leftover, although until we have this case resolved, I think I’ll write my own script to add bills for every customer port

Any luck with this? I’m looking to do the same but did not know there was a bill “auto add” feature as I do not see it in the documentation or the WebUI. I thought the only way to do it was manually through the API.

Hi, I ended up creating my own script that create bills based on Customers port type and data

Can you share your script or do a description? :slight_smile:

hi, I suppose my script won’t be of much help for you as it’s highly customized for my organization needs, but I can give you a brief description how it works :wink:

  1. connect to librenms database
  2. check for customer parsed ports (this is in my case most important step as thanks to LibreNMS I standardized interface descriptions allowing me to get rid of much hassle writing proper code in script)
  3. check billing table if we have already proper pairs: customer name = bill name, customer bandwidth = bill cdr (95th percentile in my case), customer circuit ID = billing reference, customer address = billing notes
  4. if there is any difference regarding point 3, I can either create new bill, modify or delete existing one, depending on my needs (for example I want to save bill history when only CDR changes)

Summarizing, what I achieved is complete automatic billing including changing and deleting outdated :wink:

ps. when script see that there is bill with note having word “custom” inside, it leaves it as is. I may want to add something on my own to billing system.

If you need any more info, don’t hesistate to ask

Even though the script is heavily customised it would help greatly with getting started with the automatic billing and incorporate that with LibreNMS as a new function. Is there any possibility that we can get the script that you have made?

I have created a script that only relies on LibreNMS API, you have to change some settings before using it. You can find it here https://github.com/mp4lm/billing_librenms