Logsize monitoring for LibreNMS (#15137)

* add logsize poller

* add set size info

* add more stats

* add min size

* more logsize files

* add logsize

* fix creating log file links

* add two new graphs

* add some graphs

* add no_minus_d

* add no minus d to app page

* add count of log files

* save logsizes in app data

* rename title log sizes

* only show top 12

* add mean median and mode

* cleanup naming a bit

* the values for the files hash is now a int instead of another hash

* add new stats and correct median name

* now properly handle unseen

* fix logsize bits

* add combined

* update metrics and add some tests

* add logsize graphs to apps page

* add the logsize bit

* add logszie docs

* add some example alert rules

* style cleanup

* more style cleanup

* fix a few things for metrics and update the test

* fix a variable name in the test and update the data
This commit is contained in:
Zane C. Bowers-Hadley
2023-07-19 22:02:23 -05:00
committed by GitHub
parent b3574ee282
commit 2ac9a634b4
17 changed files with 624 additions and 0 deletions

View File

@@ -961,6 +961,74 @@ The application should be auto-discovered as described at the top of
the page. If it is not, please follow the steps set out under `SNMP
Extend` heading top of page.
## Logsize
### SNMP Extend
1. Download the script and make it executable.
```
wget https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/logsize -O /etc/snmp/logsize
chmod +x /etc/snmp/logsize
```
2. Install the requirements.
```
# FreeBSD
pkg install p5-File-Find-Rule p5-JSON p5-TOML p5-Time-Piece p5-MIME-Base64 p5-File-Slurp p5-Statistics-Lite
# Debian
apt-get install cpanminus
cpanm File::Find::Rule JSON TOML Time::Piece MIME::Base64 File::Slurp Statistics::Lite
```
3. Configure the config at `/usr/local/etc/logsize.conf`. You can find
the documentation for the config file in the extend. Below is a
small example.
```
# monitor log sizes of logs directly udner /var/log
[sets.var_log]
dir="/var/log/"
# monitor remote logs from network devices
[sets.remote_network]
dir="/var/log/remote/network/"
# monitor remote logs from windows sources
[sets.remote_windows]
dir="/var/log/remote/windows/"
# monitor suricata flows logs sizes
[sets.suricata_flows]
dir="/var/log/suricata/flows/current"
```
4. If the directories all readable via SNMPD, this script can be ran
via snmpd. Otherwise it needs setup in cron. Similarly is
processing a large number of files, it may also need setup in cron
if it takes the script awhile to run.
```
*/5 * * * * /etc/snmp/logsize -b 2> /dev/null > /dev/null
```
5. Make sure that `/var/cache/logsize_extend` exists and is writable
by the user running the extend.
```
mkdir -p /var/cache/logsize_extend
```
6. Configure it in the SNMPD config.
```
# if not using cron
extend logsize /etc/snmp/logsize -b
# if using cron
extend logsize /bin/cat /var/cache/logsize_extend/extend_return
```
## linux_config_files
linux_config_files is an application intended to monitor a Linux distribution's configuration files via that distribution's configuration management tool/system. At this time, ONLY RPM-based (Fedora/RHEL) SYSTEMS ARE SUPPORTED utilizing the rpmconf tool. The linux_config_files application collects and graphs the total count of configuration files that are out of sync and graphs that number.