The goal, here, is to have a graph of your number of total blogs, by time.
To start with, a disclaimer that will surely be ignored: the objective is not to use the number of posts as a measure of a blog’s worth, or as a goal; in other words, quantity before quality! That’s not the point at all - but I’m sure that I’ll be accused of promoting that, anyway. But I just do this for fun.
It can, however, be inspiring - assuming you write interesting, useful, quality posts - to look back and see how many posts you had written, say, 6 months ago, and how many there are now. It can also be helpful to see your blogging tendencies, like “I was too busy that month, so the line stayed flat”.
If, on the other hand, you think that looking at the amount of blog posts will make you write just to see the line go up… forget all this. Easy. I really don’t want to be accused of promoting having the number of posts as a blog’s main goal.
Having said that, here goes nothing…
All of this is for WordPress blogs, and requires you to have shell access to the server, and to be able to query the MySQL database. If you have your blog hosted somewhere, such as WordPress.com, you won’t be able to do this. If you use some other blogging software, this is possible, but the queries will be different, and you’ll have to write them yourself.
I’m assuming that each of your blogs is in a different database. WordPress allows you to use a single database for several blogs, by having different table prefixes, but I prefer having them apart. Once again, if you have a single database, it’s just a matter of adapting the queries.
Obviously, you need to have MRTG installed.
So, finally:
1- file /etc/mrtg-blogposts.cfg
WorkDir: /var/www/htdocs/blogposts
Options[blogposts]: nopercent,noi,growright,nobanner,nolegend,noinfo,gauge,integer
Refresh: 6000
Target[blogposts]: `/root/bin/blogposts.php`
MaxBytes[blogposts]: 5000
Title[blogposts]: Blog Posts
PageTop[blogposts]: <h1>Blog Posts</h1>
XSize[blogposts]: 500
YSize[blogposts]: 250
XScale[blogposts]: 1.4
YScale[blogposts]: 1.4
YLegend[blogposts]: posts
ShortLegend[blogposts]: posts
Legend1[blogposts]: Blog Posts
Legend3[blogposts]: Max Posts
LegendI[blogposts]: Blog Posts:
LegendO[blogposts]: Blog Posts:
2- file /root/bin/blogposts.php
#!/usr/local/bin/php
<?php
$posts[1] = rtrim (`mysql -s -u blog1user -pblog1pw blog1 -e ’select count(*) from wp_posts;’ `);
$posts[2] = rtrim (`mysql -s -u blog2user -pblog2pw blog2 -e ’select count(*) from wp_posts;’ `);
$posts[3] = rtrim (`mysql -s -u blog3user -pblog3pw blog3 -e ’select count(*) from wp_posts;’ `);
# …
$total = array_sum ($posts);
print “$total\n”;
print “$total\n”;
print `uptime`;
print `uname -n`;
?>
NOTE 1: the script is in /root/bin , because it contains the databases’ passwords.
NOTE 2: obviously, you should change blog#user, blog#pw and blog#.
NOTE 3: if there are more blogs, just add the queries at “# …”, in the script
3- in root’s crontab:
*/5 * * * * /usr/local/bin/mrtg /etc/mrtg-blogposts.cfg
And that’s it. I’m assuming that /var/www/htdocs/blogposts exists, that the web server is making that directory available, and so on.
Related posts:






















You need to show examples.
As you wish.
The most interesting graph is the last one (yearly), IMO.