Giter Club home page Giter Club logo

Comments (5)

jonathanio avatar jonathanio commented on August 22, 2024 1

Sorry. I've no idea how I was never e-mailed about this until now.

I think @geertn is right - there's certainly a bad assumption on my part that should you select a type to be checked you have at least one of it. However, I supect it should be more like:

--- haproxyng
+++ munin-plugins/haproxyng
@@ -585,8 +585,8 @@
           ++$count;
           $total+=$data{$service}{'servers'}{$server}{'timing'}{'total'};
         }

-        $values{$service} = ($total/$count);
+        $values{$service} = ($count > 0 ? $total/$count : 0);
       }

       mg_fetch(TYPE_BACKEND, ['timing'], \%values);

This at least ensures that $values{$service} is set for any following code and required checks are properly conducted against the service. I'll try and fix it on the weekend.

Todo

  • Resolve divide-by-zero error in line 589.
  • Check all divisions for incorrect assumptions in counts or divisors.

from monitoring-munin-haproxy.

flintforge avatar flintforge commented on August 22, 2024

if count start at 1, count would be 2 for one service in one server. Is that correct ?
what about 588 $count=1 if $count==0; ?

from monitoring-munin-haproxy.

ericzc0423 avatar ericzc0423 commented on August 22, 2024

My scripting is not very good, but after changing to 1, it is fixed my
issues.

On Thu, Apr 14, 2016 at 10:20 AM, flintforge [email protected]
wrote:

if count start at 1, count will be 2 for one service in one server. Is
that correct ?
what about 588 $count=1 if $count==0; ?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#1 (comment)

Thanks
Eric Zhang

Skype: eric.zhang1008
Mobile: 008615000723581
Email: [email protected]

You are warmly welcome to visit my website: http://www.itopslife.com, the
best practice for OPERATION.

from monitoring-munin-haproxy.

geertn avatar geertn commented on August 22, 2024

Do you happen to have a stats listener configured? That will generate stats for a backend without any servers resulting in the error. The following quick fix made it work for me:

otalb0 20161108-17:15:58 /opt # diff -u haproxyng munin-plugins/haproxyng 
--- haproxyng   2016-11-08 17:15:58.877352196 +0100
+++ munin-plugins/haproxyng 2016-11-08 17:15:11.716604569 +0100
@@ -585,8 +585,9 @@
           ++$count;
           $total+=$data{$service}{'servers'}{$server}{'timing'}{'total'};
         }
-
-        $values{$service} = ($total/$count);
+        if($count != 0){
+          $values{$service} = ($total/$count);
+        }
       }

       mg_fetch(TYPE_BACKEND, ['timing'], \%values);

from monitoring-munin-haproxy.

jonathanio avatar jonathanio commented on August 22, 2024

@ericzc0423, @geertn,

I've added a commit which should prevent this error, and I cannot see anywhere else where I use a divisor, so which should be the only place that needs a check. Please feel free to test the version in PR #3 and let me know if this fixes your problem.

from monitoring-munin-haproxy.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.