Issue plotting memory usage data in Grafana

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
neworderfac33
Posts: 329
Joined: Fri Jul 24, 2015 11:04 am

Issue plotting memory usage data in Grafana

Post by neworderfac33 »

Good afternoon - as the title of my thread suggests, this is PROBABLY a Grafana issue, rather than a Nagios one, but I'm just hoping that it might ring a bell with someone, so here goes...
In Grafana, I have set up a dashboard with graphs that monitor memory usage based on the following Nagios command and service definitions

Code: Select all

define command{
        command_name    check_nt
        command_line    $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$
        }

define service{
        use                      generic-service
        #host_name          MyServer
        hostgroup_name MyServers           
       service_description      Win_TotMem_NT
       check_command            check_nt!MEMUSE!-w 90 -c 95
       }
However, the memory usage values returned seem higher than if I obtain them by remoting into the servers directly, so I tried to replicate the above functionality with check_nrpe using the following:

Code: Select all

define command{
        command_name check_nrpe_totmem
        command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckMEM -a MaxWarn=80% MaxCrit=90% ShowAll=long
}
define service{
        use                     generic-service
        #host_name       MyServer
        hostgroup_name MyServers
        service_description     Win_TotMem_NRPE
        check_command           check_nrpe_totmem
    }
Whilst the values returned in Nagios for the check_nt and check_nrpe services match each other in the Nagios web page, when I try to set up graphs for these in a Grafana dashboard, whilst the check_nt charts work fine, the check_nrpe ones don't - they pretty much flatline.
I have the Y Axis unit set to megabytes and whilst check_nt reports values in the range 2.0-3.0 GB, check_nrpe shows minimal MB values.
I'm assuming that this is something to do with the way in which the check_nrpe data is parsing, but I have no idea as to where to start in resolving this, so any advice would be gratefully received!
Thanks in advance
Pete
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Issue plotting memory usage data in Grafana

Post by scottwilkerson »

Not sure what the configuration if for this Grafana dashboard, but can you see if you can see the theck that isn't showing up when you just look for it in grafana?

The likely have different datasource names which could cause an issue (for clarity, I have no Grafana experience)

also, can you show the output of both when running from the CLI?
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
neworderfac33
Posts: 329
Joined: Fri Jul 24, 2015 11:04 am

Re: Issue plotting memory usage data in Grafana

Post by neworderfac33 »

Thanks for replying - here you go:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H 99.99.99.99 -p5666 -c CheckMEM -a MaxWarn=80% MaxCrit=90% ShowAll=long

OK: committed: Total: 10GB - Used: 2.431GB (24%) - Free: 7.569GB (75%), physical: Total: 4GB - Used: 1.246GB (31%) - Free: 2.754GB (68%)|'committed'=2.43098GB;7.99965;8.9996;0;9.99956 'committed %'=24%;79;89;0;100 'physical'=1.24602GB;3.19965;3.5996;0;3.99956 'physical %'=31%;79;89;0;100

Code: Select all

/usr/local/nagios/libexec/check_nt -H 99.99.99.99 -p 12489 -v MEMUSE

Memory usage: total:10239.64 MB - used: 2489.45 MB (24%) - free: 7750.19 MB (76%) | 'Memory usage'=2489.45MB;0.00;0.00;0.00;10239.64
I have a single Influx Database, populated by Graphios, from which all Nagios data is sourced.

Pete
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Issue plotting memory usage data in Grafana

Post by scottwilkerson »

See, the 1st check has 4 data metrics, some in GB and others in %

The second MEMUSE check only report a single check.

this is really going to come down to how how have this dashboard setup, but you likely cannot mix/match different checks in a single dashboard.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
neworderfac33
Posts: 329
Joined: Fri Jul 24, 2015 11:04 am

Re: Issue plotting memory usage data in Grafana

Post by neworderfac33 »

Hi, Scott, although you can in fact have multiple graphs on the same dashboard showing different measurements e.g. memory, CPU, disk usage etc, your post set me off on a different track which has gone some way towards solving my problem.

Data from the check_nt service is picked up by Grafana as a GB value, but data from the check_nrpe service is picked up as a % value, so, once I changed the Y axist to plot % (0-100%), the chart pairs matched up - kind of.

Each server has 4GB of physical memory and 6GB of virtual memory - 10GB in all. So, you would reasonably expect the GB chart and the % charts to look identical - they do, up to a point - whilst they have the same peaks and troughs at the same time, you would (for example) expect 3GB usage on one chart to reflect 30% usage on the other - but the values on the % chart are lower (% wise) than you might expect.

AND, both plugins return the same values in the Nagios UI and from the CLI!

Code: Select all

 /usr/local/nagios/libexec/check_nt -H 99.99.99.99 -p 12489 -v MEMUSE
Memory usage: total:10239.64 MB - used: 2568.19 MB (25%) - free: 7671.46 MB (75%) | 'Memory usage'=2568.19MB;0.00;0.00;0.00;10239.64

/usr/local/nagios/libexec/check_nrpe -H 99.99.99.99 -p5666 -c CheckMEM -a MaxWarn=80% MaxCrit=90% ShowAll=long
OK: committed: Total: 10GB - Used: 2.508GB (25%) - Free: 7.492GB (74%), physical: Total: 4GB - Used: 1.202GB (30%) - Free: 2.798GB (69%)|'committed'=2.50799GB;7.99965;8.9996;0;9.99956 'committed %'=25%;79;89;0;100 'physical'=1.20167GB;3.19965;3.5996;0;3.99956 'physical %'=30%;79;89;0;100
So now I have something ELSE to look at!
But your response has helped me greatly, so thanks very much!
Pete
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Issue plotting memory usage data in Grafana

Post by scottwilkerson »

I am going to also point out that the nrpe check is showing bot the physical as well as total which includes pagefile usages.

The MEMUSE check only uses the total numbers and cannot split-out the physical usage.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked