phpBB2 scripts

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Sam Salonen
Posts: 7
Joined: Mon Feb 14, 2005 1:28 pm

phpBB2 scripts

Post by Sam Salonen »

Here is two scripts to log your phpBB2 activity, users on-line (guests and registered users) and activity (posts and topics for the last 1 hour/3 hours).

Enjoy and feel free to do changes to the scripts and xml to fit your needs.
Attachments
phpbb2stats.zip
phpBB2 Statistics (includes perl-script and xml)
(3.51 KiB) Downloaded 2020 times
phpbb2users.zip
phpBB2 Users (includes perl-script and xml)
(3.33 KiB) Downloaded 2198 times
Sam Salonen
Posts: 7
Joined: Mon Feb 14, 2005 1:28 pm

Post by Sam Salonen »

Some screenshots of the graphs:
Attachments
phpBB2 Users On-Line graph
phpBB2 Users On-Line graph
phpBB2users.png (13.25 KiB) Viewed 42961 times
phpBB2 Statistics graph
phpBB2 Statistics graph
phpBB2stats.png (8.18 KiB) Viewed 42961 times
JustJoe
Posts: 10
Joined: Thu Mar 24, 2005 9:15 am

Post by JustJoe »

Thank you for these scripts !

phpbb2stats does work for me but phpbb2users doesn't:

Code: Select all

DBD::mysql::st execute failed: You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'TAMP(NOW()) AND session_logged_in=0' at line 2 at phpbb2users.pl line 28.
DBD::mysql::st fetchrow_array failed: fetch() without execute() at phpbb2users.pl line 29.
DBD::mysql::st execute failed: You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'TAMP(NOW()) AND session_logged_in=1' at line 2 at phpbb2users.pl line 38.
DBD::mysql::st fetchrow_array failed: fetch() without execute() at phpbb2users.pl line 39.
Using mysql-4.0.20-i486-1... any hints to resolve this would be much appreciated.
pbulteel
Cacti User
Posts: 150
Joined: Fri Sep 05, 2003 9:20 am
Location: London
Contact:

Post by pbulteel »

Looks like you're missing an S somewhere...

Code: Select all

MySQL server version for the right syntax to use near 'TAMP(NOW()) AND session_logged_in=1' at line 2 at phpbb2users.pl line 38. 
That should probably read TIMESTAMP or something like that. Did you copy the script? Check that your line wraps are ok.

=)
uname -a
JustJoe
Posts: 10
Joined: Thu Mar 24, 2005 9:15 am

Post by JustJoe »

How simple a solution it can be; linewraps did kill the script.

Thank you very much !

8)
qwolfe
Posts: 2
Joined: Fri Apr 15, 2005 10:36 am

Post by qwolfe »

With MYSql 4.1.11
Perl 5.6.1
Php 5.0.4

MySQL 4.1.11 does NOT support the --old-passwords option, so you will have to go into mysql by doing the following.

Log into Mysql

myServer# mysql -u root -p

Check for users with the 16 length encrypted password

SELECT Host, User, Password FROM mysql.user
WHERE LENGTH(Password) > 16;


should display something like:

+-----------------+-----------+-------------------------------------------+
| Host | User | Password |
+-----------------+-----------+-------------------------------------------+
*2764989343C1984926E85917C4F43171D846B09F |
| localhost | cactiuser | *2764989343C1984926E85917C4F43171D846B09F |
+-----------------+-----------+-------------------------------------------+


then you change the new password style of Mysql 4.1.xx to the OLD_PASSWORD style of pre mysql4.0 and older 3.20 versions.

UPDATE mysql.user SET Password = OLD_PASSWORD('new_password') WHERE Host = 'localhost' AND User = 'cactiuser';


For PERL, you need to download and install the following libraries if you are getting the DBI:: and DBD:: messages.

first. check what version of PERL you are running.
perl -v

for 5.6.1 users, go here
http://ppm.activestate.com/PPMPackages/ ... ilds-only/

for 5.8.x users, go here
http://ppm.activestate.com/PPMPackages/ ... ilds-only/
Pick your "Flavor"
# HP-UX/
# Linux/
# Solaris/
# Windows/

and download the appropriate packages.
DBI and DBD-MySQL
( you are on your own after that, because I have read several documents that DBI in 5.8.x is buggy and so I downgraded my install to 5.6.1, and had no issues whatsoever with my Cacti Install and scripts)

for MySQL 4.1.11 users download these Packages.
for DBI
http://ppm.activestate.com/PPMPackages/ ... ly/DBI.zip
for DBD
http://ppm.activestate.com/PPMPackages/ ... 2.9004.zip

to install the packages

unzip DBI.zip
ppm install DBI.ppd

then unzip DBD-mysql-2.9004.zip
ppm install DBD-mysql.ppd

This of course ASSUMES that you have ppm installed.. (This work applies to BOTH *nix and Windows users)

This ALSO assumes that you have your Databases properly configured.
qwolfe
Posts: 2
Joined: Fri Apr 15, 2005 10:36 am

Post by qwolfe »

Okay.. after that post, I noticed something.

I am getting data when I run the perl scripts manually
it is properly returning data:

perl phpbb2users.pl
guests:3 registered:22

perl phpbb2stats.pl
posts1h:10 posts3h:44 topics1h:6 topics3h:8

but there is no data showing on the graph.

After hours of checking the scripts, RRD is updating.. but nothing I can see is causing the graphs not to be produced.

Data in RRD files and manually running Perl Script.

No Graphs. Any ideas?
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

Great job! I added these graphs to the server which houses forums.cacti.net. Check it out:

http://querx.com/cacti/graph_view.php?a ... leaf_id=53

-Ian
Sam Salonen
Posts: 7
Joined: Mon Feb 14, 2005 1:28 pm

Post by Sam Salonen »

Nice that you guys liked the scripts! Thoug there seems to be some stange thing with the guest count sometimes... Once in a while it shows to many guests. This is probably due to the session handeling in phpBB, if anybody has a solution to this problem it would be nice!

Regards,
Sam Salonen
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

I always figured that the spike in guest users is due to search engine spiders. This would make sense since they often come from many different IP address and as a result create multiple PHP sessions.

-Ian
Sam Salonen
Posts: 7
Joined: Mon Feb 14, 2005 1:28 pm

Post by Sam Salonen »

raX wrote:I always figured that the spike in guest users is due to search engine spiders. This would make sense since they often come from many different IP address and as a result create multiple PHP sessions.
That might be one reason to these peaks, though the peaks should (logically) also show up on phpBB users online. This however does not happend (strange).
schizo
Posts: 4
Joined: Fri May 13, 2005 9:55 am
Location: Oslo, Norway
Contact:

Post by schizo »

It works! :D
www.gbps.no

cacti.gbps.no
Roderik
Posts: 6
Joined: Sun Dec 07, 2003 1:22 pm

Post by Roderik »

i had some problems with errors like:

06/10/2005 01:45:12 AM - CACTID: Poller[0] Host[1] WARNING: Result from SCRIPT not valid. Partial Result: posts1h:0 posts3h:0 ...

fixed it by removing the space after the last "echo" thingy in the pl files.
phpbbforfree
Posts: 3
Joined: Thu Sep 01, 2005 9:53 am

Post by phpbbforfree »

Would it be possible if someoen can upload their users script? I'm having problems with mine as the topics one is working I get errors when I try to run it from command line. I changed the tmp to timestamp but other then that I'm getting errors when I try to run it. Does anyone have an updated version?
User avatar
Diggit2001
Cacti User
Posts: 195
Joined: Tue May 03, 2005 4:29 pm
Location: MD, US

Post by Diggit2001 »

I'm having trouble getting this working and I think it's prolly cuz I am hosting my phpbb site on full SQL instead of MySQL. I had to go this route cuz I had another app on this server that required full SQL. My error when I try to run the script manually is this:

DBI connect ('mydbname:servername' , 'mydbname',...) failed: Can't connect to MySQL server on 'myservername' (111) at phpbb2stats.pl line 22

Can't call method "prepare" on an undefined value at phpbb2stats.pl line 27.

If I am correct in my assumption, what do I need to do to get this to work with full SQL?

Much thanks.
-Chris
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests