Dirty growth-over-time query

I’ve been messing around with the Kontrollbase schema for the last couple of days, writing various queries for the daily reporting scripts that will eventually be an automated pdf report. I’ll give you examples of two of the queries, the first being overall environment stats, and the second being single-host growth over time.

Overall environment stats
select ((((MAX(os_mem_used)) / 1024 ) / 1024) / 1024) max_os_mem_used, ((((MIN(os_mem_used)) / 1024 ) / 1024) / 1024) min_os_mem_used, ((((AVG(os_mem_used)) / 1024 ) / 1024) / 1024) avg_os_mem_used, ((((STDDEV_POP(os_mem_used)) / 1024 ) / 1024) / 1024) stdev_os_mem_used, ((((MAX(length_data + length_index)) / 1024 ) / 1024) / 1024) max_size, ((((MIN(length_data + length_index)) / 1024 ) / 1024) / 1024) min_size, ((((AVG(length_data + length_index)) / 1024 ) / 1024) / 1024) avg_size, ((((STDDEV_POP(length_data + length_index)) / 1024 ) / 1024) / 1024) stdev_size, MAX(num_connections) max_connections, MIN(num_connections) min_connections, AVG(num_connections) avg_connections, STDDEV_POP(num_connections) stdev_connections, MAX(queries_per_second) max_qps, MIN(queries_per_second) min_qps, AVG(queries_per_second) avg_qps, STDDEV_POP(queries_per_second) stdev_qps from server_statistics;
*************************** 1. row ***************************
max_os_mem_used: 50.743488311768
min_os_mem_used: 0.023044586182
avg_os_mem_used: 1.5759627057922952
stdev_os_mem_used: 2.4064208226596184
max_size: 283.815660957247
min_size: 0.000492287800
avg_size: 10.8213909777686940
stdev_size: 39.9443980717105447
max_connections: 435
min_connections: 0
avg_connections: 16.9734
stdev_connections: 37.3269
stdev_os_mem_used: 2.4064208226596184
max_qps: 9243.6533203125
min_qps: 0.00011409764556447
avg_qps: 216.421064774444
stdev_qps: 1071.72792986232
1 row in set (0.00 sec)

single-host growth over time
mysql> select (select (((length_data + length_index) / 1024) / 1024) as curr_size from server_statistics where server_list_id='44' and CURDATE() < = Creation_time order by Creation_time asc limit 1) as 0_day_size_mb, (select (((length_data + length_index) / 1024) / 1024) as curr_size from server_statistics where server_list_id='44' and DATE_SUB(CURDATE(),INTERVAL 30 DAY) <= Creation_time order by Creation_time asc limit 1) as 30_day_size_mb, ( (select (((length_data + length_index) / 1024) / 1024) as curr_size from server_statistics where server_list_id='44' and CURDATE() <= Creation_time order by Creation_time asc limit 1) - (select (((length_data + length_index) / 1024) / 1024) as curr_size from server_statistics where server_list_id='44' and DATE_SUB(CURDATE(),INTERVAL 30 DAY) <= Creation_time order by Creation_time asc limit 1)) as difference, ( select (select ((select (((length_data + length_index) / 1024) / 1024) as curr_size from server_statistics where server_list_id='44' and CURDATE() <= Creation_time order by Creation_time asc limit 1) - (select (((length_data + length_index) / 1024) / 1024) as curr_size from server_statistics where server_list_id='44' and DATE_SUB(CURDATE(),INTERVAL 30 DAY) <= Creation_time order by Creation_time asc limit 1)) as difference) / (select(select (((length_data + length_index) / 1024) / 1024) as curr_size from server_statistics where server_list_id='44' and CURDATE() <= Creation_time order by Creation_time asc limit 1) as 0_day_size_mb ) * 100) as percent_growth;
+---------------+----------------+--------------+----------------+
| 0_day_size_mb | 30_day_size_mb | difference | percent_growth |
+---------------+----------------+--------------+----------------+
| 9100.43986130 | 8199.39263916 | 901.04722214 | 9.901139240197 |
+---------------+----------------+--------------+----------------+
1 row in set (0.01 sec)

Read More

Kontrollbase gets a new default theme

I couldn’t take staring at the default theme anymore so I enabled the Slate CSS. Unless I get sick of this one, it will be the default from here on out. Maybe I’ll make a theme chooser at some point as well. Here’s a screenshot of the Slate theme enabled.  If you’re inclined to enable this on your older version it’s very simple. There are two files to touch: system/application/views/header.php and header_host.php

Add the following to line 41 on header.php and line 44 on header_host.php
<link rel="stylesheet" type="text/css" href="$nroot/includes/extjs/resources/css/xtheme-slate.css" />

If your line numbers are different, basically you just want that css file include to be directly below the “ext-all.css” css include file. If you break it then you probably did something wrong. I recommend making a backup of the files before editing just to be sure. Of course you’ll want to make sure that the “includes/extjs/resources/css/xtheme-slate.css” file exists before trying to include it.

Slate theme

Read More

Kontrollbase screenshots are posted

It’s taken a while – for no good reason – but the Kontrollbase screenshots are online for viewing pleasure. There are a couple of the overall environment as well as several of the host-specific pages. Check them out here: http://kontrollsoft.com/screenshots

Read More

Kontrollbase gets Memcache support

After working with Memcache on another application I figured that Kontrollbase could benefit from it as well. Expect in the next release (coming this week), easily configurable support for memcache. This makes use of the memcache library for CodeIgniter talked about here: http://codeigniter.com/forums/viewthread/72538/

In the config.php file you just enable it and set the proper connection parameters.

$config['memcache_enabled'] = TRUE;
$config['memcache_ip'] = '127.0.0.1';
$config['memcache_port'] = '11211';

In the main controller I added the following code to the index and host functions.

$this->load->library('cache');
// memcache library information
$memcache = $this->config->item('memcache_enabled');
if($memcache == TRUE) {
$memcache_ip = $this->config->item('memcache_ip');
$memcache_port = $this->config->item('memcache_port');
$memcache = $this->cache->useMemcache($memcache_ip, $memcache_port);
if(!$memcache) {
log_message('debug', "Memcache connection failure.");
show_error("Memcache library not enabled correctly.");
}
else {
log_message('debug', "Memcache enabled!");
}
}
else {
log_message('debug', "Memcache not enabled in config.");
}
//end memcache

And then to load the view into the cache we see this later on…

$this->cache->save('cachedMain',$this->load->view('main/main', $g, TRUE),NULL,3600);

Read More

Kontrollbase gets new tabs for server cnf/stats/vars

Added some new code to Kontrollbase to allow you to view the cnf file on each host, as well as all of the global variables and global status information that was collected from the most recent polling period. Here are some screencaps.

cnf file display

global statistics display

global variables display

Read More

Monitoring MySQL with SNMP

A nice write up here: http://www.masterzen.fr/2009/04/13/introducing-mysql-snmp/ “It’s a Net-SNMP perl subagent that connects to your MySQL server, and reports various statistics (from show status or show innodb status, or even replication) through SNMP.”

This might find its way into Kontrollbase soon…

Read More

NPR helps out with Kontrollbase

Shain Miley from NPR has recently become a contributor to the Kontrollbase project. He’s been knocking out some of the bugs in the last release and adding good features as well – socket support for the client, server state checks, and many other nice additions. His code will be included with the next release, but if you’re impatient you can grab the latest release from subversion here: http://code.google.com/p/kontrollbase/source/checkout

Read More

Kontrollbase 2.0.1-beta revision 21 is available

You can see the change list here: https://fedorahosted.org/kontrollbase/timeline
You can download the new version here: http://kontrollsoft.com/software-downloads

Read More

Kontrollbase 2.0.1 Beta is Available – Download Now!

Today is a big day! The beta code is out and ready for downloading. This release does not have the branding or css changes that will be coming out soon – so for the time being you’ll be looking at the default css styling from the extjs library. Regardless, all of the features are working and the installer will hopefully make your experience painless.

Read about the release here: http://kontrollsoft.com/software-kontrollbase
Download the release here: http://kontrollsoft.com/software-downloads
Read the documentation here: http://kontrollsoft.com/kontrollbase/userguide/toc.php

As usual, please let me know your feedback so we can all make this a better product. If you have an issue, please submit a ticket here: https://fedorahosted.org/kontrollbase/newticket ( you will need to register for an account if you want to submit a bug: https://admin.fedoraproject.org/accounts/user/new ). If you don’t want to create an account, just email me directly with the issue.

Read More

Kontrollbase and Kontrollsoft have a new website

Please check out the new website for Kontrollbase and Kontrollsoft. You’ll find tons of information about the application, and it will be the site for all news updates on the releases for Kontrollbase. I’ll still be posting here about my coding thoughts and work that I do on the apps, but the formal information will be on the new site. So check it out! http://kontrollsoft.com

Read More