Skip to content

Commit 6e30e5a

Browse files
authored
Include DeviceGroups in Alert Data (librenms#18443)
* Add device group information to alert object * Implode device group IDs into a comma-separated string Change device_group to implode device group IDs into a string. * Rename 'device_group' to 'device_groups' * Update RunAlerts.php * Tweak * StyleCI * Add device groups information to alert templates * Update device groups description in Templates.md Clarified the format for device groups in the alert template.
1 parent adc5d59 commit 6e30e5a

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

LibreNMS/Alert/RunAlerts.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ public function describeAlert($alert)
104104
$obj['os'] = $device->os;
105105
$obj['type'] = $device->type;
106106
$obj['ip'] = $device->ip;
107+
$obj['device_groups'] = $device->groups->pluck('name', 'id')->all();
107108
$obj['hardware'] = $device->hardware;
108109
$obj['version'] = $device->version;
109110
$obj['serial'] = $device->serial;

doc/Alerting/Templates.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ been up for 30344 seconds`.
5454
- Features of the Device: `$alert->features`
5555
- Serial number of the Device: `$alert->serial`
5656
- Location of the Device: `$alert->location`
57+
- Device Groups of the Device (group_id->group_name Array): `$alert->device_groups`
5758
- uptime of the Device (in seconds): `$alert->uptime`
5859
- Short uptime of the Device (28d 22h 30m 7s): `$alert->uptime_short`
5960
- Long uptime of the Device (28 days, 22h 30m 7s): `$alert->uptime_long`

0 commit comments

Comments
 (0)