sagan_stat_check - LibreNMS JSON SNMP extend and Nagios style check for Sagan stats.
sagan_stats_check [-a <age>] [-m single] [-s <eve>] [-S <instance name>] [-d <drop percent warn>] [-D <drop percent crit>] [-r <error percent warn>] [-r <error percent crit>]
sagan_stats_check [-a <age>] -m slug [-s <slug>] [-l <log dir>] [-d <drop percent warn>] [-D <drop percent crit>] [-r <error percent warn>] [-r <error percent crit>]
sagan_stats_check [-a <age>] -m manual -1 <manual> [-d <drop percent warn>] [-D <drop percent crit>] [-r <error percent warn>] [-r <error percent crit>] [-2 <manual>] [-3 <manual>] [-4 <manual>] [-5 <manual>] [-6 <manual>] [-7 <manual>] [-8 <manual>] [-9 <manual>] [-0 <manual>]
sagan_stats_check -c [-b]
For Nagious, this should be ran via NRPE.
For LibreNMS, this should be set up to run from cron and as a snmp extend.
cron...
*/5 * * * * /usr/local/bin/sagan_stat_check
snmp.conf...
extend sagan-stats /usr/local/bin/sagan_stat_check -c
This assumes that stats-json.subtract_old_values is set to 'true' for Sagan.
How far back to read in the log in seconds.
Default: 360
Print from cache, '/var/cache/sagan_monitoring.json'.
When used with -c, the output will be compressed via base64+gzip.
Mode to run in.
Default: single
Eve file for use with single mode.
Default: /var/log/sagan/stats.json
Instance name to use in single mode.
Default: ids
The slug to use in slug mode.
Default: alert
Log directory for slug mode.
Default: /var/log/sagan
A file to use in manual mode.
Percent of drop packets to warn on.
Default: 0.75%
Percent of dropped packets to critical on.
Default: 1%
Run as a nagios check style instead of LibreNMS.
Print help info.
Print version info.
Use the specified eve file, -e, and the specified instance name, -i.
Check the dir specified, -l. for files starting with the slug, -s. The files must match /^$slug\-[A-Za-z\_\-]\.[Jj][Ss][Oo][Nn]$/. The instance name is formed by removing /^$slug\-/ and /\.[Jj][Ss][Oo][Nn]$/. So "alert-ids.json" becomes "ids".
Use the files specified via -0 to -9 to specify instance names and files. The value taken by each of those is comma seperated with the first part being the instance name and the second being the eve file. So "inet,/var/log/sagan/inet.json" would be a instance name of "inet" with a eve file of "/var/log/sagan/inet.json".
To install Sagan::Monitoring, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Sagan::Monitoring
CPAN shell
perl -MCPAN -e shell install Sagan::Monitoring
For more information on module installation, please visit the detailed CPAN module installation guide.