diff --git a/graph.php b/graph.php index 29fb123e..33cf6048 100644 --- a/graph.php +++ b/graph.php @@ -114,6 +114,10 @@ require_once 'type/GenericStacked.class.php'; $obj = new Type_GenericStacked($CONFIG, $_GET, $pluginconfig); break; + case 'stackedbis': + require_once 'type/GenericStackedBis.class.php'; + $obj = new Type_GenericStackedBis($CONFIG, $_GET); + break; case 'io': require_once 'type/GenericIO.class.php'; $obj = new Type_GenericIO($CONFIG, $_GET, $pluginconfig); @@ -122,6 +126,10 @@ require_once 'type/Uptime.class.php'; $obj = new Type_Uptime($CONFIG, $_GET, $pluginconfig); break; + case 'filled': + require_once 'type/GenericFilled.class.php'; + $obj = new Type_GenericFilled($CONFIG, $_GET, $pluginconfig); + break; case 'iowpm': require_once 'type/GenericIOWPM.class.php'; $obj = new Type_GenericIOWPM($CONFIG, $_GET, $pluginconfig); diff --git a/html/config/environment/f_environment.php b/html/config/environment/f_environment.php index 0e1c722a..a37cb538 100644 --- a/html/config/environment/f_environment.php +++ b/html/config/environment/f_environment.php @@ -11,7 +11,7 @@ ->labelGrid(IL_CSS) ->inputGrid(I_CSS); -$e_form->add('text', 'f_environment_desc') +$e_form->add('text', 'f_environment_description') ->value(@$cur_environment->environment_description) ->label(DESC) ->autocomplete(false) diff --git a/html/config/role/f_role.php b/html/config/role/f_role.php index ada031f3..51f5bdae 100644 --- a/html/config/role/f_role.php +++ b/html/config/role/f_role.php @@ -11,7 +11,7 @@ ->labelGrid(IL_CSS) ->inputGrid(I_CSS); -$m_form->add('text', 'f_role_desc') +$m_form->add('text', 'f_role_description') ->value(@$cur_role->role_description) ->label(DESC) ->autocomplete(false) diff --git a/html/config/server/r_server.php b/html/config/server/r_server.php index 316a0b9c..6bfa33ef 100644 --- a/html/config/server/r_server.php +++ b/html/config/server/r_server.php @@ -10,32 +10,38 @@ $filelist=array_merge(array_values(array_diff(scandir($datadir), array('..', '.', 'lost+found'))), $filelist); } +$cpt_filelist=count($filelist); +for($i=0; $i<$cpt_filelist; $i++) { + if (strpos($filelist[$i],':') !== false) { + $filelist[$i] = substr($filelist[$i], 0, strpos($filelist[$i],':')); + } +} +$filelist = array_unique($filelist); +$filelist = array_filter($filelist); +$filelist = array_values($filelist); + $lib=' CREATE TEMPORARY TABLE server_list ( `server_name` varchar(45) NOT NULL default \'\' )'; $connSQL->query($lib); - $find='0'; -$lib= 'INSERT INTO server_list (server_name) VALUES ('; +$lib= 'INSERT INTO server_list (server_name) VALUES ('; $cpt_filelist=count($filelist); for($i=0; $i<$cpt_filelist; $i++) { - if (strpos($filelist[$i],':')==false) { - if($find=='1') { - $lib.=" ), ("; - } - $lib.= '\''.$filelist[$i].'\''; - $find='1'; - } -} + if($find=='1') { + $lib.=" ), ("; + } + $lib.= '\''.$filelist[$i].'\''; + $find='1'; +} $lib.=' )'; - if ($find=='1') $connSQL->query($lib); $lib=' - SELECT * - FROM server_list + SELECT * + FROM server_list WHERE server_name NOT IN ( SELECT server_name FROM config_server ) ORDER BY server_name'; @@ -43,3 +49,4 @@ $all_rrdserver=$connSQL->query($lib); $cpt_rrdserver=count($all_rrdserver); ?> + diff --git a/html/dashboard/dashboard_light/d_dashboard_light.php b/html/dashboard/dashboard_light/d_dashboard_light.php index 2c9a8724..17f67dc3 100644 --- a/html/dashboard/dashboard_light/d_dashboard_light.php +++ b/html/dashboard/dashboard_light/d_dashboard_light.php @@ -266,7 +266,6 @@ /* VMHOST LibVirt */ $vmlist = array(); foreach($allDatadir as $datadir){ - //$vmlist=array_merge($vmlist,preg_find('#^'.$cur_server->server_name.':#', $datadir.'/', PREG_FIND_DIRMATCH|PREG_FIND_SORTBASENAME)); $vmlist=array_merge($vmlist,glob($datadir.'/'.$cur_server->server_name.':*')); } diff --git a/modules/AUTH_USER.php b/modules/AUTH_USER.php index 0d39de1f..ca20e683 100644 --- a/modules/AUTH_USER.php +++ b/modules/AUTH_USER.php @@ -16,8 +16,8 @@ function verif_auth() { $try_auth=False; // Auth Form if (isset($_POST['f_submit_auth'])) { - $this->user=mysql_escape_string($_POST['f_user']); - $this->passwd=mysql_escape_string($_POST['f_passwd']); + $this->user=$_POST['f_user']; + $this->passwd=$_POST['f_passwd']; $try_auth=True; // Auth Basic if "&f_basic_auth=true" WARNING You can't logout with BasicAuth (see http://httpd.apache.org/docs/1.3/howto/auth.html How do I log out?) } else if (isset($_GET['f_basic_auth']) && !isset($_SESSION['S_USER']) && !isset($_SERVER['PHP_AUTH_USER'])) { @@ -35,7 +35,9 @@ function verif_auth() { if (isset($_GET['f_logout'])) { $this->logout(); } else if ($try_auth==True) { - $res=$this->connSQL->row('SELECT id_auth_user, user, type FROM auth_user WHERE user="'.$this->user.'"'); + $lib='SELECT id_auth_user, user, type FROM auth_user WHERE user=:user'; + $this->connSQL->bind('user', $this->user); + $res=$this->connSQL->row($lib); if (!$res) { return false; } @@ -63,8 +65,8 @@ function verif_auth() { } } } else if (isset($_SESSION['S_USER'])) { - $this->user=mysql_escape_string($_SESSION['S_USER']); - $this->passwd=mysql_escape_string($_SESSION['S_PASSWD']); + $this->user=$_SESSION['S_USER']; + $this->passwd=$_SESSION['S_PASSWD']; $this->id_auth_user=intval($_SESSION['S_ID_USER']); if ($this->verif_auth_mysql(false)) { return true; @@ -97,10 +99,12 @@ function verif_auth_ldap($new_user) { // Verification du compte dans le LDAP function verif_auth_mysql($new_ident) { if ($new_ident==true) { - $lib='SELECT `user`,`passwd` FROM auth_user WHERE `user`="'.$this->user.'" AND `passwd`=password("'.$this->passwd.'")'; + $lib='SELECT `user`,`passwd` FROM auth_user WHERE `user`=:user AND `passwd`=password(:passwd)'; } else { - $lib='SELECT `user`,`passwd` FROM auth_user WHERE `user`="'.$this->user.'" AND `passwd`="'.$this->passwd.'"'; + $lib='SELECT `user`,`passwd` FROM auth_user WHERE `user`=:user AND `passwd`=:passwd'; } + $this->connSQL->bind('user', $this->user); + $this->connSQL->bind('passwd', $this->passwd); $res=$this->connSQL->row($lib); if ($res->user == $this->user) { $_SESSION['S_USER']=$res->user; diff --git a/modules/InputCheckbox.php b/modules/InputCheckbox.php index e8d24dae..d0a766fa 100644 --- a/modules/InputCheckbox.php +++ b/modules/InputCheckbox.php @@ -2,6 +2,7 @@ class InputCheckbox extends Field{ private $checked = false; private $default = false; + private $labelclass = null; public function buildField(){ $field = '
'."\n"; diff --git a/modules/Select.php b/modules/Select.php index 1029e8b5..eb810a2c 100644 --- a/modules/Select.php +++ b/modules/Select.php @@ -23,7 +23,7 @@ public function buildField(){ } else { $fieldclass=''; } - if ($formcontrol==true) { + if ($this->formcontrol==true) { $fieldclass='form-control '.$fieldclass; } diff --git a/plugin/curl_json-apc.json b/plugin/curl_json-apc.json new file mode 100644 index 00000000..76ca92b0 --- /dev/null +++ b/plugin/curl_json-apc.json @@ -0,0 +1,175 @@ +{ + "files-entries": { + "title": "Cache entries statistics on {{HOST}}", + "vertical": "Nb", + "legend_format": "%5.1lf%s", + "legend": { + "entries-opcode": { + "name": "Opcode (files) entries", + "color": "00ff00" + }, + "entries-user": { + "name": "User (variables) entries", + "color": "ff0000" + } + } + }, + "cache_ratio-opcode": { + "title": "Opcode cache queries on {{HOST}}", + "vertical": "%", + "type": "stacked", + "legend_format": "%5.1lf%s", + "legend": { + "opcode-hits": { + "name": "Opcode hits", + "color": "00ff00" + }, + "opcode-misses": { + "name": "Opcode misses", + "color": "ff0000" + } + } + }, + "cache_ratio-user": { + "title": "User cache queries on {{HOST}}", + "vertical": "%", + "type": "stacked", + "legend_format": "%5.1lf%s", + "legend": { + "user-hits": { + "name": "User hits", + "color": "00ff00" + }, + "user-misses": { + "name": "User misses", + "color": "ff0000" + } + } + }, + "cache_size-mem": { + "title": "Cache size on {{HOST}}", + "vertical": "Bytes", + "type": "stacked", + "legend_format": "%5.1lf%s", + "legend": { + "mem-free": { + "name": "Free", + "color": "00ff00" + }, + "mem-used": { + "name": "Used", + "color": "ff0000" + }, + "mem-size": { + "name": "Total", + "color": "4444ff" + } + } + }, + "cache_size-sizes": { + "title": "Cache size per cache on {{HOST}}", + "vertical": "Size", + "legend_format": "%5.1lf%s", + "legend": { + "sizes-user": { + "name": "User (variables) mem size", + "color": "4444ff" + }, + "sizes-opcode": { + "name": "Opcode (files) mem size", + "color": "00cf00" + } + } + }, + "files-opcode_rates": { + "title": "Opcode (files) cache statistics on {{HOST}}", + "vertical": "req/s", + "legend_format": "%5.1lf%s", + "legend": { + "opcode_rates-hits": { + "name": "Files hits", + "color": "00cf00" + }, + "opcode_rates-misses": { + "name": "Files misses", + "color": "ff0000" + }, + "opcode_rates-inserts": { + "name": "Files inserts", + "color": "f24ac8" + }, + "opcode_rates-requests": { + "name": "Files requests", + "color": "4444ff" + } + } + }, + "files-user_rates": { + "title": "User (variables) cache statistics on {{HOST}}", + "vertical": "req/s", + "legend_format": "%5.1lf%s", + "legend": { + "user_rates-hits": { + "name": "Variables hits", + "color": "00cf00" + }, + "user_rates-misses": { + "name": "Variables misses", + "color": "ff0000" + }, + "user_rates-inserts": { + "name": "Variables inserts", + "color": "f24ac8" + }, + "user_rates-requests": { + "name": "Variables requests", + "color": "4444ff" + } + } + }, + "cache_ratio-fragment_percentage": { + "title": "Cache memory fragmentation on {{HOST}}", + "vertical": "%", + "type": "stacked", + "legend_format": "%5.1lf%s", + "legend": { + "fragment_percentage": { + "name": "Fragmentation", + "color": "00ff00" + } + } + }, + "files-files": { + "title": "Files on {{HOST}}", + "vertical": "Files", + "type": "stackedtotal", + "legend_format": "%5.1lf%s", + "legend": { + "files-cached": { + "name": "Cached", + "color": "ff0000" + }, + "files-deleted": { + "name": "Deleted", + "color": "ff00ff" + } + } + }, + "cache_result-num": { + "title": "Cache results on {{HOST}}", + "vertical": "Num", + "type": "stacked", + "legend_format": "%5.1lf%s", + "legend": { + "num-hits": { + "name": "Hits", + "color": "00ff00" + }, + "num-misses": { + "name": "Misses", + "color": "ff0000" + } + } + } +} + diff --git a/plugin/dbi.json b/plugin/dbi.json index e0d6ac88..716aa23f 100644 --- a/plugin/dbi.json +++ b/plugin/dbi.json @@ -1,6 +1,6 @@ { "mysql_select": { - "title": "Mysql Select {{PI}}", + "title": "MySQL Select ({{PI}}) on {{HOST}}", "vertical": "counter", "type": "stacked", "legend": { @@ -22,7 +22,7 @@ } }, "mysql_slowqueries": { - "title": "Mysql Slow Queries {{PI}}", + "title": "MySQL Slow Queries ({{PI}}) on {{HOST}}", "vertical": "counter", "type": "stacked", "legend": { @@ -32,7 +32,7 @@ } }, "mysql_createtmp": { - "title": "Mysql Temporary Objects {{PI}}", + "title": "MySQL Temporary Objects ({{PI}}) on {{HOST}}", "vertical": "counter", "type": "stacked", "legend": { @@ -48,7 +48,7 @@ } }, "mysql_open": { - "title": "Mysql Open Objects {{PI}}", + "title": "MySQL Open Objects ({{PI}}) on {{HOST}}", "vertical": "counter", "type": "stacked", "legend": { @@ -61,7 +61,7 @@ } }, "mysql_opened": { - "title": "Mysql Opened Objects {{PI}}", + "title": "MySQL Opened Objects ({{PI}}) on {{HOST}}", "vertical": "counter", "type": "stacked", "legend": { @@ -74,7 +74,7 @@ } }, "mysql_qcachemem": { - "title": "Mysql Qcache Memory {{PI}}", + "title": "MySQL Qcache Memory ({{PI}}) on {{HOST}}", "vertical": "counter", "type": "stacked", "legend": { @@ -93,7 +93,7 @@ } }, "mysql_databasesize": { - "title": "MySQL Total BDD Size {{PI}}", + "title": "MySQL Total BDD Size ({{PI}}) on {{HOST}}", "vertical": "Bytes", "type": "stacked", "scale": "1000000", @@ -103,18 +103,8 @@ } } }, - "pg_db_size": { - "title": "PostgreSQL Total BDD Size {{PI}}", - "vertical": "MB", - "type": "stacked", - "legend": { - "pg_db_size": { - "name": "Total BDD Size" - } - } - }, "mysql_sort": { - "title": "Mysql Sort Operations {{PI}}", + "title": "MySQL Sort Operations ({{PI}}) on {{HOST}}", "vertical": "counter", "type": "stacked", "legend": { @@ -133,7 +123,7 @@ } }, "mysql_connectionsc": { - "title": "Mysql Connections {{PI}}", + "title": "MySQL Connections ({{PI}}) on {{HOST}}", "vertical": "counter", "type": "stacked", "legend": { @@ -148,8 +138,30 @@ } } }, + "mysql_connectionsg": { + "title": "MySQL Limits Connections ({{PI}}) on {{HOST}}", + "vertical": "counter", + "legend": { + "max_connections": { + "name": "Maximum Connections" + }, + "max_used_connections": { + "name": "Maximum Used Connections" + } + } + }, + "pg_db_size": { + "title": "PostgreSQL Total BDD Size ({{PI}}) on {{HOST}}", + "vertical": "MB", + "type": "stacked", + "legend": { + "pg_db_size": { + "name": "Total BDD Size" + } + } + }, "pg_xact": { - "title": "PostgreSQL Transactions {{PI}}", + "title": "PostgreSQL Transactions ({{PI}}) on {{HOST}}", "vertical": "counter", "type": "stacked", "legend": { @@ -162,7 +174,7 @@ } }, "pg_blks": { - "title": "PostgreSQL Disk IO {{PI}}", + "title": "PostgreSQL Disk IO ({{PI}}) on {{HOST}}", "vertical": "counter", "type": "stacked", "legend": { @@ -193,7 +205,7 @@ } }, "pg_n_tup_c": { - "title": "PostgreSQL Queries {{PI}}", + "title": "PostgreSQL Queries ({{PI}}) on {{HOST}}", "vertical": "counter", "type": "stacked", "legend": { @@ -217,34 +229,34 @@ } } }, - "pg_blks": { - "title": "PostgreSQL Blocks State {{PI}}", + "pg_n_tup_g": { + "title": "PostgreSQL Tables State ({{PI}}) on {{HOST}}", "vertical": "counter", "type": "stacked", "legend": { - "pg_blksh": { - "name": "Blocks Disk Buffer" + "live": { + "name": "Live Requests" }, - "pg_blksr": { - "name": "Blocks Disk Read" + "dead": { + "name": "Dead Requests" } } }, - "pg_n_tup_g": { - "title": "PostgreSQL Tables State {{PI}}", + "pg_blks": { + "title": "PostgreSQL Blocks State ({{PI}}) on {{HOST}}", "vertical": "counter", "type": "stacked", "legend": { - "live": { - "name": "Live Requests" + "pg_blksh": { + "name": "Blocks Disk Buffer" }, - "dead": { - "name": "Dead Requests" + "pg_blksr": { + "name": "Blocks Disk Read" } } }, "pg_scan": { - "title": "PostgreSQL Query Plans {{PI}}", + "title": "PostgreSQL Query Plans ({{PI}}) on {{HOST}}", "vertical": "counter", "type": "stacked", "legend": { @@ -263,28 +275,14 @@ } }, "pg_numbackends": { - "title": "PostgreSQL Connections {{PI}}", + "title": "PostgreSQL Connections ({{PI}}) on {{HOST}}", "vertical": "counter", - "type": "stacked", "legend": { - "pg_connection": { - "name": "Actives Connections" - }, "pg_max_connection": { "name": "Maximum Connections" - } - } - }, - "mysql_connectionsg": { - "title": "Mysql Limits Connections {{PI}}", - "vertical": "counter", - "type": "stacked", - "legend": { - "max_connections": { - "name": "Maximum Connections" }, - "max_used_connections": { - "name": "Maximum Used Connections" + "pg_connection": { + "name": "Active Connections" } } }, diff --git a/plugin/elasticsearch.json b/plugin/elasticsearch.json new file mode 100644 index 00000000..c0c4140e --- /dev/null +++ b/plugin/elasticsearch.json @@ -0,0 +1,285 @@ +{ + "bytes-indices_merges_size": { + "title": "Indices Merges Size ({{PI}}) on {{HOST}}", + "vertical": "Bytes", + "legend": { + "indices_merges_size-current": { + "name": "Current" + }, + "indices_merges_size-total": { + "name": "Total" + } + } + }, + "bytes-indices_size": { + "title": "Indices Size ({{PI}}) on {{HOST}}", + "vertical": "Bytes", + "legend": { + "indices_size-store": { + "name": "Store" + } + } + }, + "bytes-jvm_mem": { + "title": "JVM Mem ({{PI}}) on {{HOST}}", + "title": "{{TC}} {{PI}} for {{PC}} on {{HOST}}", + "vertical": "Bytes", + "legend": { + "jvm_mem-heap_committed": { + "name": "Heap Committed" + }, + "jvm_mem-heap_used": { + "name": "Heap Used" + }, + "jvm_mem-non_heap_committed": { + "name": "NonHeap Committed" + }, + "jvm_mem-non_heap_used": { + "name": "NonHeap Used" + } + } + }, + "bytes-transport_size": { + "title": "In/Out Size ({{PI}}) on {{HOST}}", + "vertical": "Bytes", + "legend": { + "transport_size-rx": { + "name": "rx" + }, + "transport_size-tx": { + "name": "tx" + } + } + }, + "counter-indices_docs": { + "title": "Indices Docs ({{PI}}) on {{HOST}}", + "vertical": "Count", + "legend": { + "indices_docs-deleted": { + "name": "deleted" + } + } + }, + "counter-indices_get_time": { + "title": "Get Time ({{PI}}) on {{HOST}}", + "vertical": "Millisecondes", + "legend": { + "indices_get_time-current": { + "name": "Current" + }, + "indices_get_time-exists": { + "name": "Exists" + }, + "indices_get_time-missing": { + "name": "Missing" + } + } + }, + "counter-indices_get_total": { + "title": "Get Total ({{PI}}) on {{HOST}}", + "vertical": "Count", + "legend": { + "indices_get_total-current": { + "name": "Current" + }, + "indices_get_total-exists": { + "name": "Exists" + }, + "indices_get_total-missing": { + "name": "Missing" + } + } + }, + "counter-indices_indexing_time": { + "title": "Indexing Time ({{PI}}) on {{HOST}}", + "vertical": "Millisecondes", + "legend": { + "indices_indexing_time-delete": { + "name": "Delete" + }, + "indices_indexing_time-index": { + "name": "Index" + } + } + }, + "counter-indices_indexing_total": { + "title": "Indexing Total ({{PI}}) on {{HOST}}", + "vertical": "Count", + "legend": { + "indices_indexing_total-delete": { + "name": "Delete" + }, + "indices_indexing_total-index": { + "name": "Index" + } + } + }, + "counter-indices_merges_time": { + "title": "Merge Time Count ({{PI}}) on {{HOST}}", + "vertical": "Millisecondes", + "legend": { + "indices_merges_time-total": { + "name": "Total" + } + } + }, + "counter-indices_merges": { + "title": "Merge Count ({{PI}}) on {{HOST}}", + "vertical": "Count", + "legend": { + "indices_merges-total": { + "name": "Total" + } + } + }, + "counter-indices_search_fetch": { + "title": "Search Fetch ({{PI}}) on {{HOST}}", + "vertical": "Count", + "legend": { + "indices_search_fetch-current": { + "name": "Current" + }, + "indices_search_fetch-total": { + "name": "Total" + } + } + }, + "counter-indices_search_time": { + "title": "Search Time ({{PI}}) on {{HOST}}", + "vertical": "Millisecondes", + "legend": { + "indices_search_time-fetch": { + "name": "Fetch" + }, + "indices_search_time-query": { + "name": "Query" + } + } + }, + "counter-indices_search_total": { + "title": "Search Total ({{PI}}) on {{HOST}}", + "vertical": "Count", + "legend": { + "indices_search_total-query": { + "name": "Query" + } + } + }, + "counter-indices_time": { + "title": "Time Count ({{PI}}) on {{HOST}}", + "vertical": "Millisecondes", + "legend": { + "indices_time-flush": { + "name": "Flush" + }, + "indices_time-refresh": { + "name": "Refresh" + } + } + }, + "counter-indices_total": { + "title": "Total Count ({{PI}}) on {{HOST}}", + "vertical": "Count", + "legend": { + "indices_total-flush": { + "name": "Flush" + }, + "indices_total-refresh": { + "name": "Refresh" + } + } + }, + "counter-transport_count": { + "title": "In/Out Count ({{PI}}) on {{HOST}}", + "vertical": "Count", + "legend": { + "transport_count-rx": { + "name": "rx" + }, + "transport_count-tx": { + "name": "tx" + } + } + }, + "gauge-http_open": { + "title": "HTTP Open ({{PI}}) on {{HOST}}", + "vertical": "Count", + "legend": { + "http_open-current": { + "name": "Current" + }, + "http_open-total": { + "name": "Total" + } + } + }, + "gauge-indices_docs": { + "title": "Indices Docs {{PI}}) on {{HOST}}", + "vertical": "", + "legend": { + "indices_docs-count": { + "name": "Count" + } + } + }, + "gauge-indices_merges": { + "title": "Indices Meges ({{PI}}) on {{HOST}}", + "vertical": "", + "legend": { + "indices_merges-current": { + "name": "Current" + } + } + }, + "gauge-indices_merges_docs": { + "title": "Indices Merges Docs ({{PI}}) on {{HOST}}", + "vertical": "", + "legend": { + "indices_merges_docs-current": { + "name": "Current" + }, + "indices_merges_docs-total": { + "name": "Total" + } + } + }, + "gauge-indices_search_current": { + "title": "Indices Search ({{PI}}) on {{HOST}}", + "vertical": "", + "legend": { + "indices_search_current-query": { + "name": "Query" + } + } + }, + "gauge-jvm_threads": { + "title": "JVM Threads ({{PI}}) on {{HOST}}", + "vertical": "", + "legend": { + "jvm_threads-count": { + "name": "Count" + }, + "jvm_threads-peak": { + "name": "Peak" + } + } + }, + "gauge-process": { + "title": "Process ({{PI}}) on {{HOST}}", + "vertical": "", + "legend": { + "process-open_file_descriptors": { + "name": "Open File Descriptor" + } + } + }, + "gauge-transport_open": { + "title": "Transport Open ({{PI}}) on {{HOST}}", + "vertical": "", + "legend": { + "transport_open-server": { + "name": "Server" + } + } + } +} diff --git a/plugin/fscache.json b/plugin/fscache.json new file mode 100644 index 00000000..17a6a28e --- /dev/null +++ b/plugin/fscache.json @@ -0,0 +1,5 @@ +{ + "fscache": { + "title": "Fscache on {{HOST}}" + } +} diff --git a/plugin/memcached.json b/plugin/memcached.json index 897fc4cb..90e88494 100644 --- a/plugin/memcached.json +++ b/plugin/memcached.json @@ -110,9 +110,13 @@ "title": "Memcached number of Threads ({{PI}}) on {{HOST}}", "vertical": "Threads", "legend": { - "value": { + "threads": { "name": "Threads", "color": "00b000" + }, + "processes": { + "name": "Processes", + "color": "0b0000" } }, "legend_format": "%5.1lf%s" diff --git a/plugin/mysql.json b/plugin/mysql.json index c1071972..d6fcb63d 100644 --- a/plugin/mysql.json +++ b/plugin/mysql.json @@ -105,7 +105,7 @@ "legend_format": "%5.1lf%s" }, "mysql_octets": { - "title": "MySQL Traffic ({{TI}}) on {{HOST}}", + "title": "MySQL Traffic ({{PI}}) on {{HOST}}", "vertical": "Bits per second", "type": "io", "legend": { diff --git a/plugin/oracle.json b/plugin/oracle.json index fdcc12b9..ead6edb3 100644 --- a/plugin/oracle.json +++ b/plugin/oracle.json @@ -1,14 +1,179 @@ { - "df": { - "title": "Tablespace usage on {{HOST}}", - "vertical": "Bytes", - "legend_format": "%5.1lf%s", - "base": "1024", + "oracle_tbssize": { + "title": "Disk Usage on Tablespace {{TI}}", + "type": "stacked", + "vertical": "Bytes", + "legend": { + "free": { + "name": "Free", + "color": "00ff00" + }, + "used": { + "name": "Used", + "color": "ff0000" + } + }, + "legend_format": "%5.1lf%s" + }, + "oracle_tbsio": { + "title": "Tablespace I/O Traffic on {{TI}}", + "vertical": "Bytes/s", + "legend": { + "rx": { + "name": "Read" + }, + "tx": { + "name": "Written" + } + }, + "type": "io", + "legend_format": "%5.1lf%s" + }, + "uptime": { + "title": "Uptime", + "vertical": "Days", + "type": "stacked", + "legend": { + "UPSINCE": { + "name": "UP Since", + "color": "00e000" + } + }, + "legend_format": "%.1lf" + }, + "disk_time": { + "title": "Efficiency Disk Time per operation", + "vertical": "Avg. Time/Op", + "legend": { + "read": { + "name": "Read", + "color": "0000ff" + }, + "write": { + "name": "Write", + "color": "00b000" + } + }, "type": "stacked" }, - "io_octets": { - "title": "Database i/o on {{HOST}}", - "vertical": "Bytes/s", - "legend_format": "%5.1lf%s" - } -} + "oracle_hitratio": { + "title": "Percent Hit Ratio", + "vertical": "Percent", + "legend": { + "HIT_RATIO": { + "name": "RowCache Hit Ratio", + "color": "ff8c00" + } + }, + "type": "stacked" + }, + "oracle_session": { + "title": "Sessions", + "vertical": "Count", + "legend": { + "maxsessions": { + "name": "Max Sessions available", + "color": "ff0000" + }, + "cursessions": { + "name": "Current Session", + "color": "0000cd" + } + } + }, + "oracle_lockwait": { + "title": "Number(s) of Lock Wait", + "vertical": "Count", + "legend": { + "LOCKWAIT": { + "name": "Lock Wait" + } + }, + "type": "stacked" + }, + "oracle_redoswperhour": { + "title": "Redolog switches per hour", + "vertical": "Count", + "legend": { + "REDOLOG_SW": { + "name": "Redolog switches" + } + }, + "type": "stacked" + }, + "oracle_state": { + "title": "Oracle State", + "vertical": "State", + "legend": { + "STATE": { + "name": "STATE: 1=OPEN, 2=STARTED, 3=MOUNTED, 4=OPEN MIGRATE" + } + }, + "type": "stacked" + }, + "oracle_usedmempool": { + "title": "Memory Pool Allocation Usage", + "vertical": "Bytes", + "legend": { + "shpool": { + "name": "Shared Pool" + }, + "japool": { + "name": "Java Pool" + }, + "stpool": { + "name": "Streams Pool" + }, + "lapool": { + "name": "Large Pool" + }, + "bcache": { + "name": "Default Buffer Pool" + }, + "pgainuse": { + "name": "PGA in use" + } + }, + "type": "stacked" + }, + "oracle_defmempool": { + "title": "Memory Pool Allocation Configuration", + "vertical": "Bytes", + "legend": { + "memmaxt": { + "name": "Memory Max Target Size" + }, + "memt": { + "name": "Memory Target Size" + }, + "sgamax": { + "name": "SGA Max Size" + }, + "sgat": { + "name": "SGA Target Size" + }, + "pgat": { + "name": "PGA Aggregate Target Size" + }, + "shpools": { + "name": "Shared Pool Size" + }, + "dbcachesize": { + "name": "DB Cache Size" + } + }, + "type": "stacked" + }, + "oracle_bddsize": { + "title": "Total Oracle BDD Size", + "vertical": "Bytes", + "legend": { + "TOTALBDDSIZE": { + "name": "Total Size" + } + }, + "type": "stacked", + "legend_format": "%5.1lf%s", + "scale": "1000000" + } +} \ No newline at end of file diff --git a/type/Base.class.php b/type/Base.class.php index bf12e18c..a5ecb960 100644 --- a/type/Base.class.php +++ b/type/Base.class.php @@ -38,7 +38,8 @@ class Type_Base { function __construct($config, $_get, $pluginconfig) { $this->log = new LOG(); $this->datadir = $pluginconfig['rrd_path']; - $this->flush_path = $pluginconfig['flush_path']; + if (!empty($pluginconfig['flush_path'])) + $this->flush_path = $pluginconfig['flush_path']; $this->rrdtool = $config['rrdtool']; if (!empty($config['rrdtool_opts'])) { if (is_array($config['rrdtool_opts'])) { @@ -346,7 +347,12 @@ function rrd_get_sources() { $sources = $this->tinstances; } else { # use data_sources as sources - $sources = $this->data_sources; + if (is_array($this->order)) { + $sources = array_intersect($this->order,$this->data_sources); + } else { + $sources = $this->data_sources; + } + $this->data_sources = $sources; } } $this->parse_legend($sources); diff --git a/type/GenericAggregation.class.php b/type/GenericAggregation.class.php new file mode 100644 index 00000000..2d19abb6 --- /dev/null +++ b/type/GenericAggregation.class.php @@ -0,0 +1,140 @@ +datadir."/".$this->args['host']."/"; + $files=glob($rep."cpu*/*.rrd"); + + $this->tinstances = array(); + $this->files = array(); + $this->identifiers = array(); + + $datadir_prefix = preg_quote($this->datadir, '#'); + foreach($files as $filename) { + $basename=basename($filename,'.rrd'); + $instance = strpos($basename,'-') + ? substr($basename, strpos($basename,'-') + 1) + : 'value'; + if(!in_array($instance,$this->tinstances)) $this->tinstances[] = $instance; + $this->files[$instance] = $filename; + $this->identifiers[$instance]=$basename; + } + + $this->files=glob($rep."cpu*/"); + + sort($this->tinstances); + ksort($this->files); + ksort($this->identifiers); + + } + + function rrd_gen_graph() { + $rrdgraph = $this->rrd_options(); + + $sources = $this->rrd_get_sources(); + + $raw = null; + if ($this->scale) + $raw = '_raw'; + $i=0; + + foreach ($this->tinstances as $tinstance) { + foreach ($this->data_sources as $ds) { + $num_f=0; + foreach($this->files as $pathrrd){ + $rrdgraph[] = sprintf('DEF:min_%s_%s%s=%s:%s:MIN', crc32hex($sources[$i]),$num_f, $raw, $this->parse_filename($pathrrd.$this->identifiers[$tinstance].".rrd"), $ds); + $rrdgraph[] = sprintf('DEF:avg_%s_%s%s=%s:%s:AVERAGE', crc32hex($sources[$i]),$num_f, $raw, $this->parse_filename($pathrrd.$this->identifiers[$tinstance].".rrd"), $ds); + $rrdgraph[] = sprintf('DEF:max_%s_%s%s=%s:%s:MAX', crc32hex($sources[$i]),$num_f, $raw, $this->parse_filename($pathrrd.$this->identifiers[$tinstance].".rrd"), $ds); + $num_f++; + } + $i++; + } + } + + if ($this->scale) { + $i=0; + foreach ($this->tinstances as $tinstance) { + foreach ($this->data_sources as $ds) { + $num_f=0; + foreach($this->files as $pathrrd){ + $rrdgraph[] = sprintf('CDEF:min_%s_%s=min_%1$s_%2$s_raw,%s,*', crc32hex($sources[$i]), $num_f, $this->scale); + $rrdgraph[] = sprintf('CDEF:avg_%s_%s=avg_%1$s_%2$s_raw,%s,*', crc32hex($sources[$i]), $num_f, $this->scale); + $rrdgraph[] = sprintf('CDEF:max_%s_%s=max_%1$s_%2$s_raw,%s,*', crc32hex($sources[$i]), $num_f, $this->scale); + $num_f++; + } + $i++; + } + } + } + + + $i=0; + foreach ($this->tinstances as $tinstance) { + foreach ($this->data_sources as $ds) { + $num_f=0; + $cdef_min=""; + $cdef_avg=""; + $cdef_max=""; + foreach($this->files as $pathrrd){ + if($num_f>0){ + $cdef_min.=","; + $cdef_avg.=","; + $cdef_max.=","; + } + $cdef_min.=sprintf("min_%s_%s", crc32hex($sources[$i]), $num_f); + $cdef_avg.=sprintf("avg_%s_%s", crc32hex($sources[$i]), $num_f); + $cdef_max.=sprintf("max_%s_%s", crc32hex($sources[$i]), $num_f); + if($num_f>0){ + $cdef_min.=",+"; + $cdef_avg.=",+"; + $cdef_max.=",+"; + } + $num_f++; + } + if($num_f>1){ + $rrdgraph[] = sprintf('CDEF:min_%s=%s,%s,/', crc32hex($sources[$i]), $cdef_min,$num_f); + $rrdgraph[] = sprintf('CDEF:avg_%s=%s,%s,/', crc32hex($sources[$i]), $cdef_avg,$num_f); + $rrdgraph[] = sprintf('CDEF:max_%s=%s,%s,/', crc32hex($sources[$i]), $cdef_max,$num_f); + }else{ + $rrdgraph[] = sprintf('CDEF:min_%s=min_%1$s_0', crc32hex($sources[$i])); + $rrdgraph[] = sprintf('CDEF:avg_%s=avg_%1$s_0', crc32hex($sources[$i])); + $rrdgraph[] = sprintf('CDEF:max_%s=max_%1$s_0', crc32hex($sources[$i])); + } + $i++; + } + } + + for ($i=count($sources)-1 ; $i>=0 ; $i--) { + if ($i == (count($sources)-1)) + $rrdgraph[] = sprintf('CDEF:area_%s=avg_%1$s', crc32hex($sources[$i])); + else + $rrdgraph[] = sprintf('CDEF:area_%s=area_%s,avg_%1$s,ADDNAN', crc32hex($sources[$i]), crc32hex($sources[$i+1])); + } + + $c = 0; + foreach ($sources as $source) { + $color = is_array($this->colors) ? (isset($this->colors[$source])?$this->colors[$source]:$this->colors[$c++]) : $this->colors; + $color = $this->get_faded_color($color); + $rrdgraph[] = sprintf('AREA:area_%s#%s', crc32hex($source), $color); + } + + $c = 0; + foreach ($sources as $source) { + $legend = empty($this->legend[$source]) ? $source : $this->legend[$source]; + $color = is_array($this->colors) ? (isset($this->colors[$source])?$this->colors[$source]:$this->colors[$c++]) : $this->colors; + $rrdgraph[] = sprintf('LINE1:area_%s#%s:%s', crc32hex($source), $this->validate_color($color), $this->rrd_escape($legend)); + $rrdgraph[] = sprintf('GPRINT:min_%s:MIN:%s Min,', crc32hex($source), $this->rrd_format); + $rrdgraph[] = sprintf('GPRINT:avg_%s:AVERAGE:%s Avg,', crc32hex($source), $this->rrd_format); + $rrdgraph[] = sprintf('GPRINT:max_%s:MAX:%s Max,', crc32hex($source), $this->rrd_format); + $rrdgraph[] = sprintf('GPRINT:avg_%s:LAST:%s Last\\l', crc32hex($source), $this->rrd_format); + } + + return $rrdgraph; + } +} + +?> diff --git a/type/GenericFilled.class.php b/type/GenericFilled.class.php new file mode 100644 index 00000000..06a50d25 --- /dev/null +++ b/type/GenericFilled.class.php @@ -0,0 +1,79 @@ +rrd_options(); + + $sources = $this->rrd_get_sources(); + + $raw = null; + if ($this->scale) + $raw = '_raw'; + $i=0; + foreach ($this->tinstances as $tinstance) { + foreach ($this->data_sources as $ds) { + $rrdgraph[] = sprintf('DEF:min_%s%s=%s:%s:MIN', crc32hex($sources[$i]), $raw, $this->parse_filename($this->files[$tinstance]), $ds); + $rrdgraph[] = sprintf('DEF:avg_%s_raw=%s:%s:AVERAGE', crc32hex($sources[$i]), $this->parse_filename($this->files[$tinstance]), $ds); + $rrdgraph[] = sprintf('DEF:max_%s%s=%s:%s:MAX', crc32hex($sources[$i]), $raw, $this->parse_filename($this->files[$tinstance]), $ds); + $i++; + } + } + if ($this->scale) { + $i=0; + foreach ($this->tinstances as $tinstance) { + foreach ($this->data_sources as $ds) { + $rrdgraph[] = sprintf('CDEF:min_%s=min_%1$s_raw,%s,*', crc32hex($sources[$i]), $this->scale); + $rrdgraph[] = sprintf('CDEF:avg_%s=avg_%1$s_raw,%s,*', crc32hex($sources[$i]), $this->scale); + $rrdgraph[] = sprintf('CDEF:max_%s=max_%1$s_raw,%s,*', crc32hex($sources[$i]), $this->scale); + if ($i == 1) + $rrdgraph[] = sprintf('CDEF:avg_%s_neg=avg_%1$s_raw,%s%s,*', crc32hex($sources[$i]), $this->negative_io ? '-' : '', $this->scale); + if ($this->percentile) + $rrdgraph[] = sprintf('VDEF:pct_%1$s=avg_%1$s,%2$s,PERCENT', crc32hex($sources[$i]), $this->percentile); + $i++; + } + } + } + + $rrdgraph[] = sprintf('CDEF:overlap=avg_%s,avg_%s_neg,LT,avg_%1$s,avg_%2$s_neg,IF', + crc32hex($sources[0]), crc32hex($sources[1])); + + $i = 0; + foreach($sources as $source) { + $rrdgraph[] = sprintf('AREA:avg_%s%s#%s', crc32hex($source), $i == 1 ? '_neg' : '', $this->get_faded_color($this->colors[$source])); + $i++; + } + + $rrdgraph[] = sprintf('AREA:overlap#%s', + $this->get_faded_color( + $this->get_faded_color($this->colors[$sources[0]]), + $this->get_faded_color($this->colors[$sources[1]]) + ) + ); + + $i = 0; + foreach($sources as $source) { + $legend = empty($this->legend[$source]) ? $source : $this->legend[$source]; + $rrdgraph[] = sprintf('LINE1:avg_%s%s#%s:%s', crc32hex($source), $i == 1 ? '_neg' : '', $this->colors[$source], $this->rrd_escape($legend)); + $rrdgraph[] = sprintf('GPRINT:min_%s:MIN:%s Min,', crc32hex($source), $this->rrd_format); + $rrdgraph[] = sprintf('GPRINT:avg_%s:AVERAGE:%s Avg,', crc32hex($source), $this->rrd_format); + $rrdgraph[] = sprintf('GPRINT:max_%s:MAX:%s Max,', crc32hex($source), $this->rrd_format); + $rrdgraph[] = sprintf('GPRINT:avg_%s:LAST:%s Last\l', crc32hex($source), $this->rrd_format); + $i++; + } + + if ($this->percentile) { + $rrdgraph[] = 'COMMENT: \l'; + foreach($sources as $source) { + $legend = empty($this->legend[$source]) ? $source : $this->legend[$source]; + $rrdgraph[] = sprintf('HRULE:pct_%s#%s:%sth Percentile %s', crc32hex($source), $this->get_faded_color($this->colors[$source], '000000', 0.6), $this->percentile, $this->rrd_escape($legend)); + $rrdgraph[] = sprintf('GPRINT:pct_%s:%s\l', crc32hex($source), $this->rrd_format); + } + } + + return $rrdgraph; + } +} + diff --git a/type/GenericIOWPM.class.php b/type/GenericIOWPM.class.php index 13855352..51af2f47 100644 --- a/type/GenericIOWPM.class.php +++ b/type/GenericIOWPM.class.php @@ -1,114 +1,105 @@ rrd_options(); - - $sources = $this->rrd_get_sources(); - + $rrdgraph = $this->rrd_options (); + + $sources = $this->rrd_get_sources (); + $raw = null; if ($this->scale) $raw = '_raw'; - - // Permet d'afficher seulement les graphes présent dans ds_names - $new_sources=array(); - $i=0; - foreach($this->ds_names as $rrd_name){ - if(in_array($rrd_name,$sources)){ - $new_sources[]=$rrd_name; - $i++; + + // Permet d'afficher seulement les graphes présent dans ds_names + $new_sources = array (); + $i = 0; + foreach ( $this->ds_names as $rrd_name ) { + if (in_array ( $rrd_name, $sources )) { + $new_sources [] = $rrd_name; + $i ++; } } - $sources=array_reverse($new_sources); - $this->tinstances=array_reverse($new_sources); + $sources = array_reverse ( $new_sources ); + $this->tinstances = array_reverse ( $new_sources ); // ajoute la definition du graphe d'erreur et du temps total - $isCanvas=false; - foreach($this->files as $file){ - if (basename($file,'.rrd')=='gauge-wpm_error'){ + $isCanvas = false; + foreach ( $this->files as $file ) { + if (basename ( $file, '.rrd' ) == 'gauge-wpm_error') { // verifie si le rrd est en format canvas ou non - if(!$isCanvas){ - $isCanvas=($file!=$this->parse_filename($file)); + if (! $isCanvas) { + $isCanvas = ($file != $this->parse_filename ( $file )); } - $rrdgraph[] = sprintf('DEF:a=%s:%s:MAX', $this->parse_filename($file),'value'); - } elseif(basename($file,'.rrd')=='gauge-wpm_Time_total'){ - $rrdgraph[] = sprintf("DEF:b=%s:value:AVERAGE",$this->parse_filename($file),'value'); + // $rrdgraph[] = sprintf('DEF:a=%s:%s:MAX', $this->parse_filename($file),'value'); + $rrdgraph [] = sprintf ( 'DEF:a=%s:%s:AVERAGE', $this->parse_filename ( $file ), 'value' ); + } elseif (basename ( $file, '.rrd' ) == 'gauge-wpm_Time_total') { + $rrdgraph [] = sprintf ( "DEF:b=%s:value:AVERAGE", $this->parse_filename ( $file ), 'value' ); } } - $i=0; - foreach ($this->tinstances as $tinstance) { - foreach ($this->data_sources as $ds) { - $rrdgraph[] = sprintf('DEF:min_%s%s=%s:%s:MIN', crc32hex($sources[$i]), $raw, $this->parse_filename($this->files[$tinstance]), $ds); - $rrdgraph[] = sprintf('DEF:avg_%s_raw=%s:%s:AVERAGE', crc32hex($sources[$i]), $this->parse_filename($this->files[$tinstance]), $ds); - $rrdgraph[] = sprintf('DEF:max_%s%s=%s:%s:MAX', crc32hex($sources[$i]), $raw, $this->parse_filename($this->files[$tinstance]), $ds); - if (!$this->scale) - $rrdgraph[] = sprintf('VDEF:tot_%s=avg_%1$s,TOTAL', crc32hex($sources[$i])); - $i++; + $i = 0; + foreach ( $this->tinstances as $tinstance ) { + foreach ( $this->data_sources as $ds ) { + $rrdgraph [] = sprintf ( 'DEF:avg_%s_raw=%s:%s:AVERAGE', crc32hex ( $sources [$i] ), $this->parse_filename ( $this->files [$tinstance] ), $ds ); + $i ++; } } if ($this->scale) { - $i=0; - foreach ($this->tinstances as $tinstance) { - foreach ($this->data_sources as $ds) { - $rrdgraph[] = sprintf('CDEF:min_%s=min_%1$s_raw,%s,*', crc32hex($sources[$i]), $this->scale); - $rrdgraph[] = sprintf('CDEF:avg_%s=avg_%1$s_raw,%s,*', crc32hex($sources[$i]), $this->scale); - $rrdgraph[] = sprintf('CDEF:max_%s=max_%1$s_raw,%s,*', crc32hex($sources[$i]), $this->scale); + $i = 0; + foreach ( $this->tinstances as $tinstance ) { + foreach ( $this->data_sources as $ds ) { + $rrdgraph [] = sprintf ( 'CDEF:avg_%s=avg_%1$s_raw,%s,*', crc32hex ( $sources [$i] ), $this->scale ); if ($i == 1) - $rrdgraph[] = sprintf('CDEF:avg_%s_neg=avg_%1$s_raw,%s%s,*', crc32hex($sources[$i]), $this->negative_io ? '-' : '', $this->scale); - $rrdgraph[] = sprintf('VDEF:tot_%1$s=avg_%1$s,TOTAL', crc32hex($sources[$i])); - $i++; + $rrdgraph [] = sprintf ( 'CDEF:avg_%s_neg=avg_%1$s_raw,%s%s,*', crc32hex ( $sources [$i] ), $this->negative_io ? '-' : '', $this->scale ); + $i ++; } } } // ajoute les calculs du taux de dispo et affichage des maintenance, erreur et OK - $rrdgraph[] = "CDEF:cdefa=a,0,EQ,INF,UNKN,IF"; - //$rrdgraph[] = "CDEF:cdefb=a,0.00001,EQ,INF,UNKN,IF"; - $rrdgraph[] = "CDEF:cdefb=a,0,GT,a,0.1,LT,*,INF,UNKN,IF"; - $rrdgraph[] = "CDEF:cdefcd=a,0.1,GT,INF,UNKN,IF"; + $rrdgraph [] = "CDEF:cdefa=a,0,EQ,INF,UNKN,IF"; + // $rrdgraph[] = "CDEF:cdefb=a,0.00001,EQ,INF,UNKN,IF"; + $rrdgraph [] = "CDEF:cdefb=a,0,GT,a,0.1,LT,*,INF,UNKN,IF"; + $rrdgraph [] = "CDEF:cdefcd=a,0.1,GT,INF,UNKN,IF"; // Affichage des AREA pour les maintenance et OK - $rrdgraph[] = 'AREA:cdefa#71FF067F'; - $rrdgraph[] = 'AREA:cdefb#7CB3F1FF'; + $rrdgraph [] = 'AREA:cdefa#71FF067F'; + $rrdgraph [] = 'AREA:cdefb#7CB3F1FF'; $i = 0; - foreach($sources as $source) { - $rrdgraph[] = sprintf('AREA:avg_%s%s#%s', crc32hex($source), $i == 1 ? '_neg' : '', $this->get_faded_color($this->colors[$source])); - $i++; + foreach ( $sources as $source ) { + $rrdgraph [] = sprintf ( 'AREA:avg_%s%s#%s', crc32hex ( $source ), $i == 1 ? '_neg' : '', $this->get_faded_color ( $this->colors [$source] ) ); + $i ++; } $i = 0; - foreach ($sources as $source) { - $legend = empty($this->legend[$source]) ? $source : $this->legend[$source]; - $rrdgraph[] = sprintf('LINE1:avg_%s%s#%s:%s', crc32hex($source), $i == 1 ? '_neg' : '', $this->colors[$source], $this->rrd_escape($legend)); - $rrdgraph[] = sprintf('GPRINT:min_%s:MIN:%s Min,', crc32hex($source), $this->rrd_format); - $rrdgraph[] = sprintf('GPRINT:avg_%s:AVERAGE:%s Avg,', crc32hex($source), $this->rrd_format); - $rrdgraph[] = sprintf('GPRINT:max_%s:MAX:%s Max,', crc32hex($source), $this->rrd_format); - $rrdgraph[] = sprintf('GPRINT:avg_%s:LAST:%s Last', crc32hex($source), $this->rrd_format); - $rrdgraph[] = sprintf('GPRINT:tot_%s:%s Total\l',crc32hex($source), $this->rrd_format); - $i++; + foreach ( $sources as $source ) { + $legend = empty ( $this->legend [$source] ) ? $source : $this->legend [$source]; + $rrdgraph [] = sprintf ( 'LINE1:avg_%s%s#%s:%s', crc32hex ( $source ), $i == 1 ? '_neg' : '', $this->colors [$source], $this->rrd_escape ( $legend ) ); + $rrdgraph [] = sprintf ( 'GPRINT:avg_%s:MIN:%s Min,', crc32hex ( $source ), $this->rrd_format ); + $rrdgraph [] = sprintf ( 'GPRINT:avg_%s:AVERAGE:%s Avg,', crc32hex ( $source ), $this->rrd_format ); + $rrdgraph [] = sprintf ( 'GPRINT:avg_%s:MAX:%s Max,', crc32hex ( $source ), $this->rrd_format ); + $rrdgraph [] = sprintf ( 'GPRINT:avg_%s:LAST:%s Last\l', crc32hex ( $source ), $this->rrd_format ); + $i ++; } - // Calculs et affichage du taux de dispo - $rrdgraph[] = "CDEF:cdefce=b,POP,TIME,PREV,UN,INF,PREV,IF,MIN"; - $rrdgraph[] = "CDEF:cdefcf=a,POP,TIME"; - $rrdgraph[] = "CDEF:cdefcg=a,POP,TIME,cdefce,-"; - - $rrdgraph[] = "CDEF:cdefch=PREV(a),UN,0,PREV(a),IF,0.1,GT,PREV,UN,0,PREV,IF,cdefcf,UN,0,cdefcf,IF,PREV(cdefcf),UN,0,PREV(cdefcf),IF,-,ADDNAN,PREV,UN,0,PREV,IF,IF"; - - $rrdgraph[] = "CDEF:dispo=1,cdefch,cdefcg,/,-,100,*"; - //$rrdgraph[] = 'GPRINT:dispo:LAST:Taux de disponibilite\: %5.1lf%s%%'; - + /* + * // Calculs et affichage du taux de dispo + * $rrdgraph[] = "CDEF:cdefce=b,POP,TIME,PREV,UN,INF,PREV,IF,MIN"; + * $rrdgraph[] = "CDEF:cdefcf=a,POP,TIME"; + * $rrdgraph[] = "CDEF:cdefcg=a,POP,TIME,cdefce,-"; + * + * $rrdgraph[] = "CDEF:cdefch=PREV(a),UN,0,PREV(a),IF,0.1,GT,PREV,UN,0,PREV,IF,cdefcf,UN,0,cdefcf,IF,PREV(cdefcf),UN,0,PREV(cdefcf),IF,-,ADDNAN,PREV,UN,0,PREV,IF,IF"; + * + * $rrdgraph[] = "CDEF:dispo=1,cdefch,cdefcg,/,-,100,*"; + * //$rrdgraph[] = 'GPRINT:dispo:LAST:Taux de disponibilite\: %5.1lf%s%%'; + */ // Affichage du AREA pour les erreurs ( en dernier pour que le reste des graphes ne soient pas visibles ) - $rrdgraph[] = 'AREA:cdefcd#dd0000FF'; + $rrdgraph [] = 'AREA:cdefcd#dd0000FF'; return $rrdgraph; }