1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Xenforo Stats - Munin - Regex

Discussion in 'XenForo Questions and Support' started by akia, Jun 20, 2012.

  1. akia

    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:

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

    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.)

    <dl class="discussionCount"><dt>Discussions:</dt>
                        <dl class="messageCount"><dt>Messages:</dt>
                        <dl class="memberCount"><dt>Members:</dt>
    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.
    Darkimmortal likes this.
  2. MattW

    MattW Well-Known Member

    That should match the part you want to extract.
    Jake Bunce and akia like this.
  3. MattW

    MattW Well-Known Member

    Yep, I've just tried it now ;)

    root@vps [/usr/share/munin/plugins]# ./xenforo_users 
    members.value 14
    guests.value 48
    Jake Bunce and akia like this.
  4. akia

    akia Well-Known Member

    Yea thats working fine. Thanks!

    I'm a little puzzled with the charts on munin though as its given a output of 46.74
  5. MattW

    MattW Well-Known Member

    Yeah, mine is doing the same. It might be because it's taking the value to 2 decimal place, rather than whole numbers?


    Also, the regex to use for the other stuff:

    [~/scripts]# ./xenforo_discussion
    discussion.value 20,714
    and then use the same but tweaked:
    akia likes this.
  6. MattW

    MattW Well-Known Member

    Yep, down to how Munin draws the graphs

    akia likes this.
  7. akia

    akia Well-Known Member

    I can live with that. :D

    Thanks for all your help.
    MattW likes this.
  8. MattW

    MattW Well-Known Member

    You're welcome (y)
  9. akia

    akia Well-Known Member

    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?
  10. akia

    akia Well-Known Member

    Well I've figured out how to get xenforo to output the numbers without the comma,

    <dd>{xen:number $boardTotals.discussions}</dd></dl>
    <dd>{xen $boardTotals.discussions}</dd></dl>
  11. akia

    akia Well-Known Member

    Nope that dosn't work. I had it working but not sure how.
  12. akia

    akia Well-Known Member

    Ahh, figured it out.

    It needs to be


Share This Page