mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
6575042f5f
* 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
46 lines
1.5 KiB
Markdown
46 lines
1.5 KiB
Markdown
source: Alerting/Creating-Transport.md
|
|
path: blob/master/doc/
|
|
|
|
# Creating a new Transport
|
|
|
|
### File location
|
|
|
|
All transports are located in `LibreNMS\Alert\Transport` and the files
|
|
are named after the Transport name. I.e `Discord.php` for Discord.
|
|
|
|
### Transport structure
|
|
|
|
The following functions are required for a new transport to pass the unit tests:
|
|
|
|
`deliverAlert()` - This is function called within alerts to invoke the
|
|
transport. Here you should do any post processing of the transport
|
|
config to get it ready for use.
|
|
|
|
`contact$Transport()` - This is named after the transport so for
|
|
Discord it would be `contactDiscord()`. This is what actually
|
|
interacts with the 3rd party API, invokes the mail command or whatever
|
|
you want your alert to do.
|
|
|
|
`configTemplate()` - This is used to define the form that will accept
|
|
the transport config in the webui and then what data should be
|
|
validated and how. Validation is done using [Laravel validation](https://laravel.com/docs/5.7/validation)
|
|
|
|
The following function is __not__ required for new Transports and is
|
|
for legacy reasons only. `deliverAlertOld()`.
|
|
|
|
### Documentation
|
|
|
|
Please don't forget to update the [Transport](Transports.md) file to
|
|
include details of your new transport.
|
|
|
|
A table should be provided to indicate the form values that we ask for
|
|
and examples. I.e:
|
|
|
|
```
|
|
**Example:**
|
|
Config | Example
|
|
------ | -------
|
|
Discord URL | https://discordapp.com/api/webhooks/4515489001665127664/82-sf4385ysuhfn34u2fhfsdePGLrg8K7cP9wl553Fg6OlZuuxJGaa1d54fe
|
|
Options | username=myname
|
|
```
|