split rtstat rrd, update graph script
This commit is contained in:
parent
9db670ee11
commit
a7101d33a9
51
p_rtstat.c
51
p_rtstat.c
@ -25,10 +25,12 @@
|
|||||||
|
|
||||||
#define BUFSIZE 1024
|
#define BUFSIZE 1024
|
||||||
|
|
||||||
|
#define DS_STAT 1
|
||||||
|
#define DS_GC 2
|
||||||
|
|
||||||
struct sammler_plugin plugin;
|
struct sammler_plugin plugin;
|
||||||
|
|
||||||
static char *ds_def[] = {
|
static char *ds_def_stat[] = {
|
||||||
"DS:entries:GAUGE:%d:0:U",
|
|
||||||
"DS:in_hit:DERIVE:%d:0:U",
|
"DS:in_hit:DERIVE:%d:0:U",
|
||||||
"DS:in_slow_tot:DERIVE:%d:0:U",
|
"DS:in_slow_tot:DERIVE:%d:0:U",
|
||||||
"DS:in_slow_mc:DERIVE:%d:0:U",
|
"DS:in_slow_mc:DERIVE:%d:0:U",
|
||||||
@ -39,18 +41,32 @@ static char *ds_def[] = {
|
|||||||
"DS:out_hit:DERIVE:%d:0:U",
|
"DS:out_hit:DERIVE:%d:0:U",
|
||||||
"DS:out_slow_tot:DERIVE:%d:0:U",
|
"DS:out_slow_tot:DERIVE:%d:0:U",
|
||||||
"DS:out_slow_mc:DERIVE:%d:0:U",
|
"DS:out_slow_mc:DERIVE:%d:0:U",
|
||||||
"DS:gc_total:DERIVE:%d:0:U",
|
|
||||||
"DS:gc_ignored:DERIVE:%d:0:U",
|
|
||||||
"DS:gc_goal_miss:DERIVE:%d:0:U",
|
|
||||||
"DS:gc_dst_overflow:DERIVE:%d:0:U",
|
|
||||||
"DS:in_hlist_search:DERIVE:%d:0:U",
|
"DS:in_hlist_search:DERIVE:%d:0:U",
|
||||||
"DS:out_hlist_search:DERIVE:%d:0:U",
|
"DS:out_hlist_search:DERIVE:%d:0:U",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static char *ds_def_gc[] = {
|
||||||
|
"DS:entries:GAUGE:%d:0:U",
|
||||||
|
"DS:gc_total:DERIVE:%d:0:U",
|
||||||
|
"DS:gc_ignored:DERIVE:%d:0:U",
|
||||||
|
"DS:gc_goal_miss:DERIVE:%d:0:U",
|
||||||
|
"DS:gc_dst_overflow:DERIVE:%d:0:U",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static char ** get_ds(int ds_id)
|
static char ** get_ds(int ds_id)
|
||||||
{
|
{
|
||||||
return ds_def;
|
switch (ds_id) {
|
||||||
|
case DS_STAT:
|
||||||
|
return ds_def_stat;
|
||||||
|
|
||||||
|
case DS_GC:
|
||||||
|
return ds_def_gc;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void probe(void)
|
static void probe(void)
|
||||||
@ -87,13 +103,20 @@ static void probe(void)
|
|||||||
if (len < 0 || len >= sizeof(filename))
|
if (len < 0 || len >= sizeof(filename))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
probe_submit(&plugin, filename, 0,
|
probe_submit(&plugin, filename, DS_STAT,
|
||||||
"%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu",
|
"%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu:%llu",
|
||||||
arr[0], arr[1], arr[2], arr[3],
|
arr[1], arr[2], arr[3], arr[4],
|
||||||
arr[4], arr[5], arr[6], arr[7],
|
arr[5], arr[6], arr[7], arr[8],
|
||||||
arr[8], arr[9], arr[10], arr[11],
|
arr[9], arr[10], arr[15], arr[16]);
|
||||||
arr[12], arr[13], arr[14], arr[15],
|
|
||||||
arr[16]);
|
len = snprintf(filename, sizeof(filename), "rtcache-%d.rrd", cpu);
|
||||||
|
if (len < 0 || len >= sizeof(filename))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
probe_submit(&plugin, filename, DS_GC,
|
||||||
|
"%llu:%llu:%llu:%llu:%llu",
|
||||||
|
arr[0], arr[11], arr[12], arr[13], arr[14]);
|
||||||
|
|
||||||
cpu++;
|
cpu++;
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
97
sammler.php
97
sammler.php
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
define('CONFIG', 'sammler_graph.conf');
|
define('CONFIG', 'sammler_graph.conf');
|
||||||
define('BASE_DIR', '/var/lib/rrd/');
|
define('BASE_DIR', '/var/www/rrd/');
|
||||||
define('RRDTOOL', '/usr/bin/rrdtool');
|
define('RRDTOOL', '/usr/local/bin/rrdtool');
|
||||||
|
|
||||||
function setup_html($conf) {
|
function setup_html($conf) {
|
||||||
echo "<html><head><title>sammler graph setup</title>\n";
|
echo "<html><head><title>sammler graph setup</title>\n";
|
||||||
@ -142,6 +142,7 @@ function get_hostdirs() {
|
|||||||
$retval[] = $file;
|
$retval[] = $file;
|
||||||
|
|
||||||
closedir($dh);
|
closedir($dh);
|
||||||
|
natsort($retval);
|
||||||
return $retval;
|
return $retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,6 +157,7 @@ function get_rrdfiles($directory) {
|
|||||||
$retval[] = $file;
|
$retval[] = $file;
|
||||||
}
|
}
|
||||||
closedir($dh);
|
closedir($dh);
|
||||||
|
natsort($retval);
|
||||||
return $retval;
|
return $retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -321,6 +323,48 @@ function show_rrd($conf) {
|
|||||||
'STACK:b#00CF00:"Nice " GPRINT:b:LAST:"Current\:%8.2lf %s" GPRINT:b:AVERAGE:"Average\:%8.2lf %s" GPRINT:b:MAX:"Maximum\:%8.2lf %s\n" ';
|
'STACK:b#00CF00:"Nice " GPRINT:b:LAST:"Current\:%8.2lf %s" GPRINT:b:AVERAGE:"Average\:%8.2lf %s" GPRINT:b:MAX:"Maximum\:%8.2lf %s\n" ';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'ctstat':
|
||||||
|
$cmd .= "--base=1000 --height={$height} --width={$width} --alt-autoscale-max --vertical-label=\"calls\" ".
|
||||||
|
"DEF:a={$rrdfile}:searched:AVERAGE ".
|
||||||
|
"DEF:b={$rrdfile}:found:AVERAGE ".
|
||||||
|
"DEF:c={$rrdfile}:new:AVERAGE ".
|
||||||
|
"DEF:d={$rrdfile}:invalid:AVERAGE ".
|
||||||
|
"DEF:e={$rrdfile}:ignore:AVERAGE ".
|
||||||
|
"DEF:f={$rrdfile}:delete:AVERAGE ".
|
||||||
|
"DEF:g={$rrdfile}:delete_list:AVERAGE ".
|
||||||
|
"DEF:h={$rrdfile}:insert:AVERAGE ".
|
||||||
|
"DEF:i={$rrdfile}:insert_failed:AVERAGE ".
|
||||||
|
"DEF:j={$rrdfile}:drop:AVERAGE ".
|
||||||
|
"DEF:k={$rrdfile}:early_drop:AVERAGE ".
|
||||||
|
"DEF:l={$rrdfile}:icmp_error:AVERAGE ".
|
||||||
|
"DEF:m={$rrdfile}:expect_new:AVERAGE ".
|
||||||
|
"DEF:n={$rrdfile}:expect_create:AVERAGE ".
|
||||||
|
"DEF:o={$rrdfile}:expect_delete:AVERAGE ".
|
||||||
|
'CDEF:ii=i,-1,* '.
|
||||||
|
'CDEF:jj=j,-1,* '.
|
||||||
|
'CDEF:kk=k,-1,* '.
|
||||||
|
'CDEF:ll=l,-1,* '.
|
||||||
|
'CDEF:mm=m,-1,* '.
|
||||||
|
'CDEF:nn=n,-1,* '.
|
||||||
|
'CDEF:oo=o,-1,* '.
|
||||||
|
'LINE1:a#FF0000:"searched " GPRINT:a:LAST:"Current\:%8.0lf" GPRINT:a:AVERAGE:"Average\:%8.0lf" GPRINT:a:MAX:"Maximum\:%8.0lf\n" '.
|
||||||
|
'LINE1:b#FF00FF:"found " GPRINT:b:LAST:"Current\:%8.0lf" GPRINT:b:AVERAGE:"Average\:%8.0lf" GPRINT:b:MAX:"Maximum\:%8.0lf\n" '.
|
||||||
|
'LINE1:c#0000FF:"new " GPRINT:c:LAST:"Current\:%8.0lf" GPRINT:c:AVERAGE:"Average\:%8.0lf" GPRINT:c:MAX:"Maximum\:%8.0lf\n" '.
|
||||||
|
'LINE1:d#007FFF:"invalid " GPRINT:d:LAST:"Current\:%8.0lf" GPRINT:d:AVERAGE:"Average\:%8.0lf" GPRINT:d:MAX:"Maximum\:%8.0lf\n" '.
|
||||||
|
'LINE1:e#00FFFF:"ignore " GPRINT:e:LAST:"Current\:%8.0lf" GPRINT:e:AVERAGE:"Average\:%8.0lf" GPRINT:e:MAX:"Maximum\:%8.0lf\n" '.
|
||||||
|
'LINE1:f#00FF00:"delete " GPRINT:f:LAST:"Current\:%8.0lf" GPRINT:f:AVERAGE:"Average\:%8.0lf" GPRINT:f:MAX:"Maximum\:%8.0lf\n" '.
|
||||||
|
'LINE1:g#FFFF00:"delete_list " GPRINT:g:LAST:"Current\:%8.0lf" GPRINT:g:AVERAGE:"Average\:%8.0lf" GPRINT:g:MAX:"Maximum\:%8.0lf\n" '.
|
||||||
|
'LINE1:h#FF7F00:"insert " GPRINT:h:LAST:"Current\:%8.0lf" GPRINT:h:AVERAGE:"Average\:%8.0lf" GPRINT:h:MAX:"Maximum\:%8.0lf\n" '.
|
||||||
|
'HRULE:0#000000:"-\n" '.
|
||||||
|
'LINE1:ii#FF0000:"insert_failed " GPRINT:i:LAST:"Current\:%8.0lf" GPRINT:i:AVERAGE:"Average\:%8.0lf" GPRINT:i:MAX:"Maximum\:%8.0lf\n" '.
|
||||||
|
'LINE1:jj#FF00FF:"drop " GPRINT:j:LAST:"Current\:%8.0lf" GPRINT:j:AVERAGE:"Average\:%8.0lf" GPRINT:j:MAX:"Maximum\:%8.0lf\n" '.
|
||||||
|
'LINE1:kk#0000FF:"early_drop " GPRINT:k:LAST:"Current\:%8.0lf" GPRINT:k:AVERAGE:"Average\:%8.0lf" GPRINT:k:MAX:"Maximum\:%8.0lf\n" '.
|
||||||
|
'LINE1:ll#007FFF:"icmp_errore " GPRINT:l:LAST:"Current\:%8.0lf" GPRINT:l:AVERAGE:"Average\:%8.0lf" GPRINT:l:MAX:"Maximum\:%8.0lf\n" '.
|
||||||
|
'LINE1:mm#00FFFF:"expect_new " GPRINT:m:LAST:"Current\:%8.0lf" GPRINT:m:AVERAGE:"Average\:%8.0lf" GPRINT:m:MAX:"Maximum\:%8.0lf\n" '.
|
||||||
|
'LINE1:nn#00FF00:"expect_create " GPRINT:n:LAST:"Current\:%8.0lf" GPRINT:n:AVERAGE:"Average\:%8.0lf" GPRINT:n:MAX:"Maximum\:%8.0lf\n" '.
|
||||||
|
'LINE1:oo#FFFF00:"expect_delete " GPRINT:o:LAST:"Current\:%8.0lf" GPRINT:o:AVERAGE:"Average\:%8.0lf" GPRINT:o:MAX:"Maximum\:%8.0lf\n" ';
|
||||||
|
break;
|
||||||
|
|
||||||
case 'load':
|
case 'load':
|
||||||
$cmd .= "--base=1000 --height={$height} --width={$width} --alt-autoscale-max --lower-limit=0 --vertical-label=\"load\" ".
|
$cmd .= "--base=1000 --height={$height} --width={$width} --alt-autoscale-max --lower-limit=0 --vertical-label=\"load\" ".
|
||||||
"DEF:a={$rrdfile}:1min:AVERAGE ".
|
"DEF:a={$rrdfile}:1min:AVERAGE ".
|
||||||
@ -404,6 +448,54 @@ function show_rrd($conf) {
|
|||||||
'LINE1:a#404040 ';
|
'LINE1:a#404040 ';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'rtcache':
|
||||||
|
$cmd .= "--base=1000 --height={$height} --width={$width} --alt-autoscale-max --vertical-label=\"calls\" ".
|
||||||
|
"DEF:a={$rrdfile}:entries:AVERAGE ".
|
||||||
|
"DEF:b={$rrdfile}:gc_total:AVERAGE ".
|
||||||
|
"DEF:c={$rrdfile}:gc_ignored:AVERAGE ".
|
||||||
|
"DEF:d={$rrdfile}:gc_goal_miss:AVERAGE ".
|
||||||
|
"DEF:e={$rrdfile}:gc_dst_overflow:AVERAGE ".
|
||||||
|
'LINE1:a#FF0000:"entries " GPRINT:a:LAST:"Current\:%8.0lf" GPRINT:a:AVERAGE:"Average\:%8.0lf" GPRINT:a:MAX:"Maximum\:%8.0lf\n" '.
|
||||||
|
'LINE1:b#FF00FF:"gc_total " GPRINT:b:LAST:"Current\:%8.0lf" GPRINT:b:AVERAGE:"Average\:%8.0lf" GPRINT:b:MAX:"Maximum\:%8.0lf\n" '.
|
||||||
|
'LINE1:c#0000FF:"gc_ignored " GPRINT:c:LAST:"Current\:%8.0lf" GPRINT:c:AVERAGE:"Average\:%8.0lf" GPRINT:c:MAX:"Maximum\:%8.0lf\n" '.
|
||||||
|
'LINE1:d#007FFF:"gc_goal_miss " GPRINT:d:LAST:"Current\:%8.0lf" GPRINT:d:AVERAGE:"Average\:%8.0lf" GPRINT:d:MAX:"Maximum\:%8.0lf\n" '.
|
||||||
|
'LINE1:e#00FFFF:"gc_dst_overflow " GPRINT:e:LAST:"Current\:%8.0lf" GPRINT:e:AVERAGE:"Average\:%8.0lf" GPRINT:e:MAX:"Maximum\:%8.0lf\n" ';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'rtstat':
|
||||||
|
$height *= 2;
|
||||||
|
$cmd .= "--base=1000 --height={$height} --width={$width} --alt-autoscale-max --vertical-label=\"calls\" ".
|
||||||
|
"DEF:a={$rrdfile}:in_hit:AVERAGE ".
|
||||||
|
"DEF:b={$rrdfile}:in_slow_tot:AVERAGE ".
|
||||||
|
"DEF:c={$rrdfile}:in_slow_mc:AVERAGE ".
|
||||||
|
"DEF:d={$rrdfile}:in_no_route:AVERAGE ".
|
||||||
|
"DEF:e={$rrdfile}:in_brd:AVERAGE ".
|
||||||
|
"DEF:f={$rrdfile}:in_martian_dst:AVERAGE ".
|
||||||
|
"DEF:g={$rrdfile}:in_martian_src:AVERAGE ".
|
||||||
|
"DEF:h={$rrdfile}:in_hlist_search:AVERAGE ".
|
||||||
|
"DEF:i={$rrdfile}:out_hit:AVERAGE ".
|
||||||
|
"DEF:j={$rrdfile}:out_slow_tot:AVERAGE ".
|
||||||
|
"DEF:k={$rrdfile}:out_slow_mc:AVERAGE ".
|
||||||
|
"DEF:l={$rrdfile}:out_hlist_search:AVERAGE ".
|
||||||
|
'CDEF:ii=i,-1,* '.
|
||||||
|
'CDEF:jj=j,-1,* '.
|
||||||
|
'CDEF:kk=k,-1,* '.
|
||||||
|
'CDEF:ll=l,-1,* '.
|
||||||
|
'LINE1:a#FF0000:"in_hit " GPRINT:a:LAST:"Current\:%8.0lf" GPRINT:a:AVERAGE:"Average\:%8.0lf" GPRINT:a:MAX:"Maximum\:%8.0lf\n" '.
|
||||||
|
'LINE1:b#FF00FF:"in_slow_tot " GPRINT:b:LAST:"Current\:%8.0lf" GPRINT:b:AVERAGE:"Average\:%8.0lf" GPRINT:b:MAX:"Maximum\:%8.0lf\n" '.
|
||||||
|
'LINE1:c#0000FF:"in_slow_mc " GPRINT:c:LAST:"Current\:%8.0lf" GPRINT:c:AVERAGE:"Average\:%8.0lf" GPRINT:c:MAX:"Maximum\:%8.0lf\n" '.
|
||||||
|
'LINE1:d#007FFF:"in_no_route " GPRINT:d:LAST:"Current\:%8.0lf" GPRINT:d:AVERAGE:"Average\:%8.0lf" GPRINT:d:MAX:"Maximum\:%8.0lf\n" '.
|
||||||
|
'LINE1:e#00FFFF:"in_brd " GPRINT:e:LAST:"Current\:%8.0lf" GPRINT:e:AVERAGE:"Average\:%8.0lf" GPRINT:e:MAX:"Maximum\:%8.0lf\n" '.
|
||||||
|
'LINE1:f#00FF00:"in_martian_dst " GPRINT:f:LAST:"Current\:%8.0lf" GPRINT:f:AVERAGE:"Average\:%8.0lf" GPRINT:f:MAX:"Maximum\:%8.0lf\n" '.
|
||||||
|
'LINE1:g#FFFF00:"in_martian_src " GPRINT:g:LAST:"Current\:%8.0lf" GPRINT:g:AVERAGE:"Average\:%8.0lf" GPRINT:g:MAX:"Maximum\:%8.0lf\n" '.
|
||||||
|
'LINE1:h#FF7F00:"in_hlist_search " GPRINT:h:LAST:"Current\:%8.0lf" GPRINT:h:AVERAGE:"Average\:%8.0lf" GPRINT:h:MAX:"Maximum\:%8.0lf\n" '.
|
||||||
|
'HRULE:0#FF0000:"-\n" '.
|
||||||
|
'LINE1:ii#FF0000:"out_hit " GPRINT:i:LAST:"Current\:%8.0lf" GPRINT:i:AVERAGE:"Average\:%8.0lf" GPRINT:i:MAX:"Maximum\:%8.0lf\n" '.
|
||||||
|
'LINE1:jj#FF00FF:"out_slow_tot " GPRINT:j:LAST:"Current\:%8.0lf" GPRINT:j:AVERAGE:"Average\:%8.0lf" GPRINT:j:MAX:"Maximum\:%8.0lf\n" '.
|
||||||
|
'LINE1:kk#0000FF:"out_slow_mc " GPRINT:k:LAST:"Current\:%8.0lf" GPRINT:k:AVERAGE:"Average\:%8.0lf" GPRINT:k:MAX:"Maximum\:%8.0lf\n" '.
|
||||||
|
'LINE1:ll#FF7F00:"out_hlist_search " GPRINT:l:LAST:"Current\:%8.0lf" GPRINT:l:AVERAGE:"Average\:%8.0lf" GPRINT:l:MAX:"Maximum\:%8.0lf\n" ';
|
||||||
|
break;
|
||||||
|
|
||||||
case 'swap':
|
case 'swap':
|
||||||
$cmd .= "--base=1024 --height={$height} --width={$width} --alt-autoscale-max --lower-limit=0 --vertical-label=\"kB\" ".
|
$cmd .= "--base=1024 --height={$height} --width={$width} --alt-autoscale-max --lower-limit=0 --vertical-label=\"kB\" ".
|
||||||
"DEF:aa={$rrdfile}:total:AVERAGE ".
|
"DEF:aa={$rrdfile}:total:AVERAGE ".
|
||||||
@ -435,6 +527,7 @@ function show_rrd($conf) {
|
|||||||
"DEF:d={$rrdfile}:pgfree:AVERAGE ".
|
"DEF:d={$rrdfile}:pgfree:AVERAGE ".
|
||||||
"DEF:e={$rrdfile}:pgfault:AVERAGE ".
|
"DEF:e={$rrdfile}:pgfault:AVERAGE ".
|
||||||
"CDEF:ee=e,-1,* ".
|
"CDEF:ee=e,-1,* ".
|
||||||
|
'HRULE:0#FF0000: '.
|
||||||
'AREA:c#FF0000:"pgalloc_dma " GPRINT:c:LAST:"Current\:%8.2lf %s" GPRINT:c:AVERAGE:"Average\:%8.2lf %s" GPRINT:c:MAX:"Maximum\:%8.2lf %s\n" '.
|
'AREA:c#FF0000:"pgalloc_dma " GPRINT:c:LAST:"Current\:%8.2lf %s" GPRINT:c:AVERAGE:"Average\:%8.2lf %s" GPRINT:c:MAX:"Maximum\:%8.2lf %s\n" '.
|
||||||
'STACK:b#00CF00:"pgalloc_normal " GPRINT:b:LAST:"Current\:%8.2lf %s" GPRINT:b:AVERAGE:"Average\:%8.2lf %s" GPRINT:b:MAX:"Maximum\:%8.2lf %s\n" '.
|
'STACK:b#00CF00:"pgalloc_normal " GPRINT:b:LAST:"Current\:%8.2lf %s" GPRINT:b:AVERAGE:"Average\:%8.2lf %s" GPRINT:b:MAX:"Maximum\:%8.2lf %s\n" '.
|
||||||
'STACK:a#00CFCF:"pgalloc_high " GPRINT:a:LAST:"Current\:%8.2lf %s" GPRINT:a:AVERAGE:"Average\:%8.2lf %s" GPRINT:a:MAX:"Maximum\:%8.2lf %s\n" '.
|
'STACK:a#00CFCF:"pgalloc_high " GPRINT:a:LAST:"Current\:%8.2lf %s" GPRINT:a:AVERAGE:"Average\:%8.2lf %s" GPRINT:a:MAX:"Maximum\:%8.2lf %s\n" '.
|
||||||
|
Loading…
Reference in New Issue
Block a user