mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
Plugin-Gallery: Better 2nd level headings
This commit is contained in:
parent
3a6fdce80f
commit
ae4e85ab60
13 changed files with 11 additions and 13 deletions
94
plugins/vbulletin/vbulletin4_users
Normal file
94
plugins/vbulletin/vbulletin4_users
Normal file
|
@ -0,0 +1,94 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# Plugin to monitor the number of guests/users on a vbulletin4 forum
|
||||
# Since we are using a regexp, this will work for EN forum only... adapt the regexp if your forum is not using that language.
|
||||
# visual-regexp is a great help for tuning the regexp (package exists on Debian and Ubuntu repositories)
|
||||
#
|
||||
#
|
||||
# Parameters supported:
|
||||
#
|
||||
# config
|
||||
# autoconf
|
||||
#
|
||||
# Configurable variables
|
||||
#
|
||||
# url to online.php, this page is part of vbulletin distribution, pp=1 so the page is fast to load and doesn't give us too many unwanted info
|
||||
#
|
||||
# $Log$
|
||||
#
|
||||
#
|
||||
# Not sure about those lines...
|
||||
#
|
||||
# Magic markers:
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
my $ret = undef;
|
||||
|
||||
if (! eval "require LWP::UserAgent;")
|
||||
{
|
||||
$ret = "LWP::UserAgent not found";
|
||||
}
|
||||
|
||||
# CHANGE ME
|
||||
my $URL = exists $ENV{'url'} ? $ENV{'url'} : "http://www.url.to/forums/online.php?pp=1";
|
||||
|
||||
|
||||
# We will use this variable, not on this release ;-)
|
||||
my $forum_type = exists $ENV{'type'} ? $ENV{'type'} : "vbulletin";
|
||||
|
||||
# same here
|
||||
my %regexp = ("vbulletin"=> "<h1\>(\d+)[^\d]+(\d+)\sguests\</h1>",
|
||||
"punbb" => "",
|
||||
"phpbb" => "");
|
||||
|
||||
my $type = undef;
|
||||
my $timeout = 30;
|
||||
|
||||
if ( defined $ARGV[0] and $ARGV[0] eq "autoconf" )
|
||||
{
|
||||
if ($ret)
|
||||
{
|
||||
print "no ($ret)\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( defined $ARGV[0] and $ARGV[0] eq "config" )
|
||||
{
|
||||
print "graph_title Forum Users\n";
|
||||
print "graph_args -l 0\n";
|
||||
print "graph_vlabel current users\n";
|
||||
print "graph_category forum\n";
|
||||
print "graph_total Total\n";
|
||||
|
||||
print "members.label Members\n";
|
||||
print "members.draw AREA\n";
|
||||
print "guests.draw STACK\n";
|
||||
print "guests.label Guests\n";
|
||||
|
||||
|
||||
|
||||
exit 0;
|
||||
}
|
||||
|
||||
|
||||
my $ua = LWP::UserAgent->new(timeout => $timeout);
|
||||
my $url = sprintf $URL;
|
||||
my $response = $ua->request(HTTP::Request->new('GET',$url));
|
||||
|
||||
# part of the output we want to catch : <h1>42 members and 420 guests</h1> --> 42 - 420
|
||||
if ($response->content =~ /<h1>(\d+)\smembers[^\d]+(\d+)\sguests<\/h1>/im)
|
||||
{
|
||||
|
||||
print "members.value $1\n";
|
||||
print "guests.value $2\n";
|
||||
|
||||
} else {
|
||||
print "members.value U\n";
|
||||
print "guests.value U\n";
|
||||
}
|
||||
|
||||
|
||||
# vim:syntax=perl
|
94
plugins/vbulletin/vbulletin_users
Executable file
94
plugins/vbulletin/vbulletin_users
Executable file
|
@ -0,0 +1,94 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# Plugin to monitor the number of guests/users on a vbulletin forum
|
||||
# Since we are using a regexp, this will work for EN forum only... adapt the regexp if your forum is not using that language.
|
||||
# visual-regexp is a great help for tuning the regexp (package exists on Debian and Ubuntu repositories)
|
||||
#
|
||||
#
|
||||
# Parameters supported:
|
||||
#
|
||||
# config
|
||||
# autoconf
|
||||
#
|
||||
# Configurable variables
|
||||
#
|
||||
# url to online.php, this page is part of vbulletin distribution, pp=1 so the page is fast to load and doesn't give us too many unwanted info
|
||||
#
|
||||
# $Log$
|
||||
#
|
||||
#
|
||||
# Not sure about those lines...
|
||||
#
|
||||
# Magic markers:
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
my $ret = undef;
|
||||
|
||||
if (! eval "require LWP::UserAgent;")
|
||||
{
|
||||
$ret = "LWP::UserAgent not found";
|
||||
}
|
||||
|
||||
# CHANGE ME
|
||||
my $URL = exists $ENV{'url'} ? $ENV{'url'} : "http://www.url.to/forums/online.php?pp=1";
|
||||
|
||||
|
||||
# We will use this variable, not on this release ;-)
|
||||
my $forum_type = exists $ENV{'type'} ? $ENV{'type'} : "vbulletin";
|
||||
|
||||
# same here
|
||||
my %regexp = ("vbulletin"=> "<strong\>(\d+)[^\d]+(\d+)\sguests\</strong>",
|
||||
"punbb" => "",
|
||||
"phpbb" => "");
|
||||
|
||||
my $type = undef;
|
||||
my $timeout = 30;
|
||||
|
||||
if ( defined $ARGV[0] and $ARGV[0] eq "autoconf" )
|
||||
{
|
||||
if ($ret)
|
||||
{
|
||||
print "no ($ret)\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( defined $ARGV[0] and $ARGV[0] eq "config" )
|
||||
{
|
||||
print "graph_title Forum Users\n";
|
||||
print "graph_args -l 0\n";
|
||||
print "graph_vlabel current users\n";
|
||||
print "graph_category forum\n";
|
||||
print "graph_total Total\n";
|
||||
|
||||
print "members.label Members\n";
|
||||
print "members.draw AREA\n";
|
||||
print "guests.draw STACK\n";
|
||||
print "guests.label Guests\n";
|
||||
|
||||
|
||||
|
||||
exit 0;
|
||||
}
|
||||
|
||||
|
||||
my $ua = LWP::UserAgent->new(timeout => $timeout);
|
||||
my $url = sprintf $URL;
|
||||
my $response = $ua->request(HTTP::Request->new('GET',$url));
|
||||
|
||||
# part of the output we want to catch : <strong>42 members and 420 guests</strong> --> 42 - 420
|
||||
if ($response->content =~ /<strong>(\d+)\smembers[^\d]+(\d+)\sguests<\/strong>/im)
|
||||
{
|
||||
|
||||
print "members.value $1\n";
|
||||
print "guests.value $2\n";
|
||||
|
||||
} else {
|
||||
print "members.value U\n";
|
||||
print "guests.value U\n";
|
||||
}
|
||||
|
||||
|
||||
# vim:syntax=perl
|
Loading…
Add table
Add a link
Reference in a new issue