librenms-librenms/doc/Developing/Getting-Started.md
VVelox 6575042f5f go through making lots of the docs more lint happy (#10342)
* clean up all but header incrementing in Creating-Transport.md

* make Device-Dependencies.md mdl happy

* make Entities.md as mdl happy as possible... one long table line left

* make mdl as happy as possible for index.md

* clean up Introduction.md as much as possible

* minor formatting cleanup... move each icon onto its own row

* make ack and notes the same style

* clean Macros.md up

* clean Rules.md up as much as possible

* tweak one line a bit to get it to format a bit nicer

* a bit more format tweaking, making sure it does not sure with >

* clean up as much as possible for Templates.md

* make Testing.md as mdl happy as possibly

* clean Transports.md up as much as possible

* clean as many issues as possible for Alerts.md

* clean up as much of ARP.md as possible

* clean up as much as possible for Bills.md

* make DeviceGroups.md as mdl happy as possible

* cleanup Devices.md

* make as mdl happy as possible Inventory.md and index.md

* mdl cleanup for Logs.md and PortGroups.md

* make Ports.md and Routing.md as happy as possible

* clean up Services.md, Switching.md, and Systems.md as much as possible

* more markup cleanup

* lots more md cleanup udner Devloping/

* reapply bits from #10343 that accidentally got removed when merging
2019-06-20 13:53:44 -05:00

2.6 KiB

Get ready to contribute to LibreNMS

This document is intended to help you get your local environment set up to contribute code to the LibreNMS project.

Setting up a development environment

When starting to develop, it may be tempting to just make changes on your production server, but that will make things harder for you. Taking a little time to set up somewhere to work on code changes can really help.

Possible options:

  • A Linux computer, VM, or container
  • Another directory on your LibreNMS server
  • Windows Subsystem for Linux

Set up your development git clone

  1. Follow the documentation on using git

  2. Install development dependencies ./scripts/composer_wrapper.php install

  3. Set variables in .env, including database settings. Which could be a local or remote MySQL server including your production DB.

APP_ENV=local
APP_DEBUG=true
...
  1. Start a development webserver ./lnms serve

  2. Access the Web UI at http://localhost:8000

Automated testing

LibreNMS uses continuous integration to test code changes to help reduce bugs. This also helps guarantee the changes you contribute won't be broken in the future. You can find out more in our Validating Code Documentation

Polling debug output

You can see detailed info by running your polling code in debug mode. If you are looking at a specific

./discovery.php -d -h HOSTNAME
./poller.php -d -h HOSTNAME

Inspecting variables

Sometimes you want to find out what a variable contains (such as the data return from an snmpwalk). You can dump one or more variables and halt execution with the dd() function.

dd($variable1, $variable2);

Inspecting web pages

Installing the development dependencies and setting APP_DEBUG enables the Laravel Debugbar This will allow you to inspect page generation and errors right in your web browser.

Better code completion in IDEs and editors

You can generate some files to improve code completion. (These file are not updated automatically, so you may need to re-run these command periodically)

./lnms ide-helper:generate
./lnms ide-helper:models -N

Emulating devices

You can capture and emulate devices using Snmpsim. LibreNMS has a set of scripts to make it easier to work with snmprec files. LibreNMS Snmpsim helpers

Laravel documentation

You can find a lot of how LibreNMS works by following the Laravel Documentation