Resource icon

Munin Graph Users / Guests Online 2.2

No permission to download
Complete munin noob and got this running in minutes. The only thing I'd say is the instructions don't mention explicitly editing the script to add your own url rather than Matt's (I FTPed it without even looking at it and assumed it looked for localhost).

I'm a sucker for decent stats, is there anything else we can easily monitor with munin?
 
I'm not sure if this is possible but would there be any way to count the number of names in the "Staff Online Now" block and create a graph for that? That'd be quite helpful in cross-referencing between number of users online and number of staff online (e.g. do we need another moderator in a different timezone, etc).

I suspect it's probably not that simple as you'd have to somehow count the number of names, rather than there being a specific number you could regex against.
 
Is there any reason that this would stop recording? New values aren't displaying as of noon today but all my other munin graph are still displaying fine.
 
Running the script directly seems to fail as well (it's worked fine for the last few weeks).

./xenforo_users
members.value U
guests.value U

Only difference I can think of it that we've been quite busy today (over 1000 users total). Is there some kind of upper limit hardcoded in?
 
Ah, actually, just looking at the regex, it's looking for d+ so a numerical value. Is your online user count showing as 1,000 (with the comma)?
 
Cheers

No rush, just I wouldn't know where to start :)
Probably this section here. ;)
Code:
if ($response->content =~ /Online\snow\:\s\d+\s\(members\:\s(\d+)\,\sguests\:\s(\d+)\)/im)
        {

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

I'm also researching, but I haven't ever used regex much but do found some examples to strip out commas.... but since my site doesn't get that many visitors I can't really check it. :p
 
This is a quick and dirty fix, as rather than looking for a number, we are just going to match anything in those specific places. I've tested it against Digital Points site, and it's pulling back results, but I don't currently have Munin installed myself to see if it will still graph correctly.

Change the below section:
Code:
# part of the output we want to catch : Online now: 79 (members: 18, guests: 61) --> 18 - 61
if ($response->content =~ /Online\snow\:\s\d+\s\(members\:\s(\d+)\,\sguests\:\s(\d+)\)/im)
        {

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

to be:
Code:
# part of the output we want to catch : Online now: 79 (members: 18, guests: 61) --> 18 - 61
if ($response->content =~ /Online\snow\:\s(.*)\s\(members\:\s(.*),\sguests\:\s(.*)\)/im)
        {
                print "members.value $2\n";
                print "guests.value $3\n";

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


Example:
Code:
[mworthington@artemis ~]$ ./xenforo_users2 
members.value 83
guests.value 1,228
 
Ready to roll with XF 1.2

Code:
./xenforo_users2
members.value 50
guests.value 417
robots.value  31

Nice one! I'd love to get the script to show these stats for all forums combined on each of my servers and then a grand total across all my servers :)
 
This is a quick and dirty fix, as rather than looking for a number, we are just going to match anything in those specific places. I've tested it against Digital Points site, and it's pulling back results, but I don't currently have Munin installed myself to see if it will still graph correctly.
Unluckily, I don't think it's going to work:
example.webp example1.webp
Notice the -nan for the guest in the graph.
 
Top Bottom