Resource icon

Munin Graph Users / Guests Online 2.2

No permission to download
Ok, so it looks like the comma needs to be removed. Will take another look

Yep, and I've been "muddling" around trying to figure out how... I found a regex that will strip the commas (=~ s /,//) - not the parenthesis around it - but have not figured out how to get it into the code to work. I keep getting perl errors. :mad:
 
Oh yeah!

Code:
[mworthington@artemis ~]$ ./xenforo_users2 
members.value 145
guests.value 1959
 
And? ;)
Didn't you forget something else in the message?:whistle:

Was just updating the resource.

To fix it:

Code:
if ($response->content =~ /\:\s(.*)\s\(members\:\s(.*),\sguests\:\s(.*)\)/im)
        {
                my $members = $2;
                $members =~ s/,//g;
                my $guests = $3;
                $guests =~ s/,//g;
                print "members.value $members\n";
                print "guests.value $guests\n";

        } else {
                print "members.value U\n";
                print "guests.value U\n";
        }
 
Was just updating the resource.

To fix it:

Code:
                $members =~ s/,//g;
  
        }

THAT was the part I couldn't figure out where to put. I know almost nothing about perl and was swinging in the dark. ;)
Thanks! (even tho' my sites don't need it and probably won't for a LONG time)
 
Finally got around to applying the fix and it seems to be working. The screenshow shows gaps where our total was over 1k but it's now started picking it up correctly :-)

Screen Shot 2013-07-01 at 20.23.08.webp
 
Hmm think I spoke too soon. This seems to still fail when my members (green curve) are greater than 1000. When that happens the guests (blue curve) fails to show.

Any ideas @MattW?
 
If you want to use this with 1.2 and want the robots to also show up, then simply replace
PHP:
# part of the output we want to catch : Online now: 79 (members: 18, guests: 61) --> 18 - 61
if ($response->content =~ /\:\s(.*)\s\(members\:\s(.*),\sguests\:\s(.*)\)/im)
        {
                my $members = $2;
                $members =~ s/,//g;
                my $guests = $3;
                $guests =~ s/,//g;
                print "members.value $members\n";
                print "guests.value $guests\n";

        } else {
                print "members.value U\n";
                print "guests.value U\n";
        }

with
PHP:
# part of the output we want to catch : Online now: 79 (members: 18, guests: 61, robots: 0) --> 18 - 61
if ($response->content =~ /\:\s(.*)\s\(members\:\s(.*),\sguests\:\s(.*),\srobots\:\s(.*)\)/im)
        {
                my $members = $2;
                $members =~ s/,//g;
                my $guests = $3;
                $guests =~ s/,//g;
                my $robots = $4;
                $robots =~ s/,//g;
                print "members.value $members\n";
                print "guests.value $guests\n";
                print "robots.value $robots\n";

        } else {
                print "members.value U\n";
                print "guests.value U\n";
                print "robots.value U\n";
        }

You will also need to find

PHP:
      print "members.label Members\n";
        print "members.draw AREA\n";
        print "guests.draw STACK\n";
        print "guests.label Guests\n";

Replace

PHP:
      print "members.label Members\n";
        print "members.draw AREA\n";
        print "guests.draw STACK\n";
        print "guests.label Guests\n";
        print "robots.draw STACK\n";
        print "robots.label Robots\n";
 
Last edited:
Hmm, not too sure on that one :confused:
@MattW can you check my PHP and make sure it is right. I had forgotten to modify the graphing section - and I "think" this addendum I did is correct but thought you would be know best. :p
Reason I ask is on one forum I am getting 0, on another it's showing -nan.

It's working!

example.webp
 
Last edited:
Hmm think I spoke too soon. This seems to still fail when my members (green curve) are greater than 1000. When that happens the guests (blue curve) fails to show.

Any ideas @MattW?
I've just been looking at the documentation on drawing graphs, and there is nothing to suggest this would fail to draw when the first area section is greater than 1k, as the second should just stack on top of it.
 
It's quite rare that we get that many members online. Next time we do I'll let you know i it happens again.

Thanks for looking into it.
 
Can confirm that I still have this problem. When members is over 1000, the guest line disappears. As soon as members drops below 1000 the guest line comes back.
 
Would you mind messaging me your site URL so I can test what is happening when it goes above 1,000?
 
Top Bottom