Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

MRTGBits

Rating
0 votes
Favoured:
0
Current Version
v2
Last Release Date
2021-01-30
Hits
4307
Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
Do you run MRTG and NAGIOS but frustrated that NAGIOS default MRTG plugins only report as Bytes? Yeah me to. So I wrote this little opensource Nagios plugin called MRTGBits to do just that... convert the MRTG Bytes to bits for Nagios. MRTGBits can also set alarming thresholds for Nagios to display when breached. Written on NAGIOS Core Version 4.4.6
MRTGBits:: A NAGIOS core plug converting MRTG Bytes to bits
v2::1/30/2021
https://github.com/mjkatona/MRTGBits/releases

What does this do?
MRTG can display in bits but records everything in Bytes
When importing MRTG data in other applications as Bits, it must first be converted
This NAGIOS core plugin will convert, import, and set alarm threadsholds as Bits

Flow
MRTG writes log file to a dir which NAGIOS Core can read
NAGIO Core calls MRTGBits.pl via the device.cfg file pointing to the MRTG Log file
MRTGBits.pl does wonderful perl magic can tells NAGIOS Core
NAGIOS Core displays wonderful perl magic causing python lovers to cry


Why do you care about Bytes or Bits?
Bytes represent storage AKA Datacenter speak
Bits represent bandwidth AKA Network speak

How to install?
You must have perl installed
You must have MRTG installed
You must have NAGIOS CORE

Place MRTGBits.pl into your ~/nagios/libexec directory and chmod 755
the /nagios/libexec is where all your other check_this and check_that reside

How do you configure?
In your NAGIOS objects/device/host/services/how_ever_you_do_it config:

# Add the command
define command{
command_name MRTGBits
command_line $USER1$/MRTGBits.pl $ARG1$ $ARG2$ $ARG3$
}


# Add the service
define service{
use generic-service
host_name <# Hostname >
servicegroups <# If you use Servicegroups >
service_description <# Whatever you call it >
check_command MRTGBits!<# MRTG PWD and Logfile>!<# Warning Exceed Threshold>!<# Warning Exceed Threshold>
}

<# MRTG PWD and Logfile> = This is where MRTG writes the .log files. It is the working directory in your MRTG.CFG file
<# Warning Exceed Threshold> = This is the warning level in BITS when NAGIOS changes to yellow.
<# Warning Exceed Threshold> = This is the critical level in BITS when NAGIOS changes to red.
If you do not want to alarm on the thresholds, do not set them at all!

Example:
If you want to warn when the link exceeds 100Mb and critical when the link exceed 500Mb: check_command MRTGBits!<# MRTG PWD and Logfile>!100000000!500000000
If you want to warn when the link exceeds 700Mb and critical when the link exceed 900Mb: check_command MRTGBits!<# MRTG PWD and Logfile>!700000000!900000000
If you do not want to ever alarm so not set the warning or the critical: check_command MRTGBits!<# MRTG PWD and Logfile>

Here is my working example where my MRTG pushes logfiles to a network "/share" drive and Nagios picks them up

define command{
command_name MRTGBits
command_line $USER1$/MRTGBits.pl $ARG1$ $ARG2$ $ARG3$
}
#
define service{
use generic-service
host_name CORE-1
servicegroups NETWORK
service_description Primary Internet Interface
check_command MRTGBits!
}

And of course restart nagios!

Last - To manually run, same concept but just replace ! with spaces:
./MRTGBits.pl /share/temp/192.168.10.4_23.log 700000000 900000000

To do better list
A better install guide
auto build nagios config based on MRTG logs and MRTG CFG Working DIR
threshold for age of MRTG poll
Exceeds threashold by x amount