Xenforo Stats - Munin - Regex

akia

Well-known member
I'm trying to adapt the vbulletin munin plugin to track online members/guests to work with xenforo. See: https://github.com/munin-monitoring/contrib/blob/master/plugins/forum/vbulletin_users which isn't really a wise choice because I've not got a clue what I'm doing, but I suppose I'll never learn these things unless I start to try to do it myself.

Now looking at it I won't need to change much apart from the regex that's extracts the data which is currently:

Code:
/<strong>(\d+)\smembers[^\d]+(\d+)\sguests<\/strong>/im)

I can see from the source on my home page I'd need to extract the 9 and 50 numbers from below

Code:
Online now: 59 (members: 9, guests: 50)

Can anyone help with the regex to do that?

The second thing I'm trying to do with munin is then track how many posts and threads and members I've got on my site as it grows. (I know xenforo has this build in, but I want to be able to see it as part of the munin charts with the other information without having to log into xenforo.)

Code:
<dl class="discussionCount"><dt>Discussions:</dt>
                        <dd>7,050</dd></dl>
                    <dl class="messageCount"><dt>Messages:</dt>
                        <dd>125,986</dd></dl>
                    <dl class="memberCount"><dt>Members:</dt>
                        <dd>1,048</dd></dl>
I plan on having 3 different chats to track each thing so can someone help with the regex to extract each of the above?

Thirdly is there any way to simply output the above information so that I don't have to have it load the homepage every time. I'm thinking maybe a Page thats not displayed on the node tree with just that into on.
 
Yeah, mine is doing the same. It might be because it's taking the value to 2 decimal place, rather than whole numbers?

xenforo_users-day.webp

Also, the regex to use for the other stuff:

Code:
<dt>Discussions\:<\/dt>\n\s+<dd>([0-9]+(,[0-9]+)*)<\/dd>

Code:
[~/scripts]# ./xenforo_discussion
discussion.value 20,714

and then use the same but tweaked:
Code:
<dt>Messages\:<\/dt>\n\s+<dd>([0-9]+(,[0-9]+)*)<\/dd>
Code:
<dt>Members\:<\/dt>\n\s+<dd>([0-9]+(,[0-9]+)*)<\/dd>
 
Yea thats working fine. Thanks!

I'm a little puzzled with the charts on munin though as its given a output of 46.74
Yep, down to how Munin draws the graphs

Q: Why does my users plugin report floating point numbers?
...I have a plugin that counts users. Even though all the readings from it are integers, the cur value in munin is showing a floating point number.
A: This is due to the fact that Munin takes a while to collect all the input numbers and therefore the collection of most numbers does not happen at the precise point in time that RRD wants. When that happens, RRD makes an interpolation between the two last data points. This leads to floating point numbers in the display.
NOTE: COUNTER and DERIVE values have to be integers, but the averages calculated based on them are floating point. GAUGE values are floating point.
NOTE: Starting from Munin 1.3.3 you can specify graph_printf. Please see the man page rrdgraph_graph for more information on how to use this option. Note that the scaling unit (%s) is supplied automatically by Munin based on the graph_scale setting from the plugin. The default printf format is %6.2lf (except if the base is 1024, then the format is %7.2lf).
 
I can't get the members, messages and discussions charts to update properly because of the comma in the number.

Is there anyway to get xenforo to output the figures without the comma or strip it out with the regex?
 
Well I've figured out how to get xenforo to output the numbers without the comma,

Change:
Code:
<dd>{xen:number $boardTotals.discussions}</dd></dl>

to
Code:
<dd>{xen $boardTotals.discussions}</dd></dl>
 
Well I've figured out how to get xenforo to output the numbers without the comma,

Change:
Code:
<dd>{xen:number $boardTotals.discussions}</dd></dl>

to
Code:
<dd>{xen $boardTotals.discussions}</dd></dl>
Nope that dosn't work. I had it working but not sure how.
 
Top Bottom