[yast-commit] <rest-service> master : added graph configuration file; some changes due Josefs comments, thanks :-)
ref: refs/heads/master commit 3d50d859e09ef7bd8c631218b7d7ed17a1ee84fe Author: Stefan Schubert <schubi@suse.de> Date: Tue Dec 22 16:01:33 2009 +0100 added graph configuration file; some changes due Josefs comments, thanks :-) --- plugins/status/app/models/metric.rb | 25 ++++-- plugins/status/app/views/metrics/show.html.erb | 2 + plugins/status/app/views/metrics/show.xml.erb | 2 + plugins/status/config/status_configuration.yaml | 87 ++++++++++++++++++++ .../status/package/yast2-webservice-status.spec | 5 +- 5 files changed, 113 insertions(+), 8 deletions(-) diff --git a/plugins/status/app/models/metric.rb b/plugins/status/app/models/metric.rb index ef8ec02..91d209d 100644 --- a/plugins/status/app/models/metric.rb +++ b/plugins/status/app/models/metric.rb @@ -258,12 +258,25 @@ class Metric xml.plugin_instance plugin_instance xml.type type xml.type_instance type_instance - - if @conf and @conf.has_key?(id) + if @conf + line_id = id[host.length+1..id.length-1] #remove hostname from id + limits = nil + @conf.each_value{|group| + group["graphs"].each{|graph| + graph["lines"].each{|line| + if line["id"] == line_id + limits = line["limits"] + break + end + } + break unless limits == nil + } + break unless limits == nil + } xml.limits() do - xml.max(@conf["#{id}"]["max"]) - xml.min(@conf["#{id}"]["min"]) - end + xml.max(limits["max"]) + xml.min(limits["min"]) + end if limits end # serialize data unless it is disabled @@ -298,7 +311,7 @@ class Metric def self.run_rrdtool(file, opts={}) #checking if collectd is running - ServiceNotRunning.new('collectd') unless collectd_running? + raise ServiceNotRunning.new('collectd') unless collectd_running? #checking if systemtime is BEHIND the last entry of collectd. #If yes, no data will be available. diff --git a/plugins/status/app/views/metrics/show.html.erb b/plugins/status/app/views/metrics/show.html.erb new file mode 100644 index 0000000..ab88948 --- /dev/null +++ b/plugins/status/app/views/metrics/show.html.erb @@ -0,0 +1,2 @@ +<%= @metric.to_xml( :root => "metric", :start => @start, :stop => @stop, :data => @data, :dasherize => false ) -%> + diff --git a/plugins/status/app/views/metrics/show.xml.erb b/plugins/status/app/views/metrics/show.xml.erb new file mode 100644 index 0000000..ab88948 --- /dev/null +++ b/plugins/status/app/views/metrics/show.xml.erb @@ -0,0 +1,2 @@ +<%= @metric.to_xml( :root => "metric", :start => @start, :stop => @stop, :data => @data, :dasherize => false ) -%> + diff --git a/plugins/status/config/status_configuration.yaml b/plugins/status/config/status_configuration.yaml new file mode 100644 index 0000000..a4b3713 --- /dev/null +++ b/plugins/status/config/status_configuration.yaml @@ -0,0 +1,87 @@ +--- +CPU: + y_label: Percent + y_scale: 1 + graphs: + - cummulated: false + headline: CPU + lines: + - id: cpu-0+cpu-idle + limits: + min: 0 + max: 0 + label: Used + - id: cpu-0+cpu-user + limits: + min: 0 + max: 0 + label: Free +Memory: + y_label: MByte + y_scale: 1024 + graphs: + - cummulated: true + headline: Memory + lines: + - id: memory+memory-used + limits: + min: 0 + max: 0 + label: Used + - id: memory+memory-free + limits: + min: 0 + max: 0 + label: Free + - id: memory+memory-cached + limits: + min: 0 + max: 0 + label: Cached +Network: + y_label: + y_scale: 1 + graphs: + - cummulated: false + headline: Network + lines: + - id: interface+if_errors-eth0 + limits: + min: 0 + max: 0 + label: Errors eth0 + - id: if_packets-eth0 + limits: + min: 0 + max: 0 + label: Packages eth0 +Disk: + y_label: MByte + y_scale: 1024 + graphs: + - cummulated: true + headline: root + lines: + - id: df+df-root+free + limits: + min: 0 + max: 0 + label: Errors eth0 + - id: df+df-root+used + limits: + min: 0 + max: 0 + label: Packages eth0 + - cummulated: true + headline: dev + lines: + - id: df+df-dev+free + limits: + min: 0 + max: 0 + label: Errors eth0 + - id: df+df-dev+used + limits: + min: 0 + max: 0 + label: Packages eth0 diff --git a/plugins/status/package/yast2-webservice-status.spec b/plugins/status/package/yast2-webservice-status.spec index fb1e1dc..81e8ee6 100644 --- a/plugins/status/package/yast2-webservice-status.spec +++ b/plugins/status/package/yast2-webservice-status.spec @@ -58,7 +58,6 @@ Authors: mkdir -p $RPM_BUILD_ROOT/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name} cp -a * $RPM_BUILD_ROOT/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name} rm -f $RPM_BUILD_ROOT/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/COPYING -#rm $RPM_BUILD_ROOT/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/config/status_limits.yaml # Policies mkdir -p $RPM_BUILD_ROOT/usr/share/PolicyKit/policy @@ -109,7 +108,7 @@ rccollectd restart %dir /srv/www/%{pkg_user}/vendor/plugins %dir /srv/www/%{pkg_user}/vendor/plugins/%{plugin_name} %dir /srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/doc -%attr(-,%{pkg_user},%{pkg_user}) %dir /srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/config +%dir /srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/config %dir /usr/share/PolicyKit %dir /usr/share/PolicyKit/policy /srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/* @@ -117,6 +116,8 @@ rccollectd restart %attr(644,root,root) %config /usr/share/PolicyKit/policy/org.opensuse.yast.modules.logfile.policy /srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/doc/README_FOR_APP /srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/doc/logs.yml +%attr(-,%{pkg_user},%{pkg_user}) /srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/config/status_configuration.yaml + %doc COPYING %changelog -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
Stefan Schubert