diff options
Diffstat (limited to 'type')
-rw-r--r-- | type/Default.class.php | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/type/Default.class.php b/type/Default.class.php index 8a5dd72..f40d12d 100644 --- a/type/Default.class.php +++ b/type/Default.class.php | |||
@@ -46,14 +46,26 @@ class Type_Default { | |||
46 | return $c[r].$c[g].$c[b]; | 46 | return $c[r].$c[g].$c[b]; |
47 | } | 47 | } |
48 | 48 | ||
49 | function identifier($host, $plugin, $pinst, $type, $tinst) { | ||
50 | $identifier = sprintf('%s/%s%s%s/%s%s%s', $host, | ||
51 | $plugin, strlen($pinst) ? '-' : '', $pinst, | ||
52 | $type, strlen($tinst) ? '-' : '', $tinst); | ||
53 | |||
54 | if (is_file($this->datadir.'/'.$identifier.'.rrd')) | ||
55 | return $identifier; | ||
56 | else | ||
57 | return FALSE; | ||
58 | } | ||
59 | |||
49 | function get_filename($tinstance=NULL) { | 60 | function get_filename($tinstance=NULL) { |
50 | if (!is_array($this->args['tinstance']) && $tinstance == NULL) | 61 | if (!is_array($this->args['tinstance']) && $tinstance == NULL) |
51 | $tinstance = $this->args['tinstance']; | 62 | $tinstance = $this->args['tinstance']; |
52 | 63 | ||
53 | $search = array('{host}', '{plugin}', '{pinstance}', '{type}', '{tinstance}'); | 64 | $identifier = $this->identifier($this->args['host'], |
54 | $replace = array($this->args['host'], $this->args['plugin'], $this->args['pinstance'], $this->args['type'], $tinstance); | 65 | $this->args['plugin'], $this->args['pinstance'], |
55 | $f = $this->datadir . '/' . str_replace($search, $replace, $this->path_format); | 66 | $this->args['type'], $tinstance); |
56 | return $f; | 67 | |
68 | return $this->datadir.'/'.$identifier.'.rrd'; | ||
57 | } | 69 | } |
58 | 70 | ||
59 | function rrd_graph($debug=false) { | 71 | function rrd_graph($debug=false) { |