This is the code that I have so far. It outputs the number of questions on the database server since the last restart.
Code: Select all
<?php
require_once 'DB.php';
$user = 'mylimiteduser';
$pass = 'XXXXXX';
$host = 'myhost';
$db_name = 'template1';
$dsn = "pgsql://$user:$pass@$host/$db_name";
$db = DB::connect($dsn, true);
$sql = "select sum(xact_commit) as total from pg_stat_database;";
$result = $db->query($sql);
$row = $result->fetchRow(DB_FETCHMODE_ASSOC);
print trim( $row['total']);
$db->disconnect();
?>
I have a graph setup (it, oddly enough, also looks like the MySQL one) that is generating pretty pictures but not quite what I had imagined. On the MySQL graph the vertical numbers are in the form of 1.0-4.0 (I have very little running on this server yet) and the GPRINTs on the bottom of the graph are also in the x.xx floating point form.
On my Postgres graph I have numbers in the form like '240 m' and this continues with smaller numbers on the GPRINTs. I am also getting 'nan' strings on the monthly and yearly graphs.
All of the configurations are identical. What could cause the graphs to have a wild dispertion of output like this?
I hope someone enjoys the Postgres script I made as well. That SQL was tough to figure out (I'm a SQL n00b).