cloudscale-monitor 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +33 -0
- data/lib/cloudscale/monitor.rb +131 -0
- data/lib/cloudscale/monitor/agent/init.rb +95 -0
- data/lib/cloudscale/monitor/agent/init_components.rb +88 -0
- data/lib/cloudscale/monitor/agent/init_menus.rb +53 -0
- data/lib/cloudscale/monitor/agent/preops/general_preop.rb +35 -0
- data/lib/cloudscale/monitor/agent/preops/preop.rb +48 -0
- data/lib/cloudscale/monitor/model/agent/agent_instance.rb +33 -0
- data/lib/cloudscale/monitor/model/agent/agent_instance_settings.rb +26 -0
- data/lib/cloudscale/monitor/model/component/component.rb +29 -0
- data/lib/cloudscale/monitor/model/constants/agent_instance_store.rb +42 -0
- data/lib/cloudscale/monitor/model/constants/agent_store.rb +23 -0
- data/lib/cloudscale/monitor/model/constants/agent_unit_store.rb +69 -0
- data/lib/cloudscale/monitor/model/constants/setup/display_unit_store.rb +210 -0
- data/lib/cloudscale/monitor/model/constants/statistic_store.rb +67 -0
- data/lib/cloudscale/monitor/model/coredata/coredata.rb +32 -0
- data/lib/cloudscale/monitor/model/format/format.rb +69 -0
- data/lib/cloudscale/monitor/model/measurement/chart.rb +37 -0
- data/lib/cloudscale/monitor/model/measurement/measurement.rb +29 -0
- data/lib/cloudscale/monitor/model/measurement/statistic.rb +27 -0
- data/lib/cloudscale/monitor/model/measurement/unit.rb +31 -0
- data/lib/cloudscale/monitor/model/measurement/value.rb +32 -0
- data/lib/cloudscale/monitor/model/metric/metric.rb +29 -0
- data/lib/cloudscale/monitor/model/table/table.rb +34 -0
- data/lib/cloudscale/monitor/version.rb +11 -0
- data/lib/cloudscale/plugins/apache/apache2_server_status.rb +125 -0
- data/lib/cloudscale/plugins/cpu/sigar_cpu_info.rb +52 -0
- data/lib/cloudscale/plugins/cpu/sigar_cpu_perc.rb +69 -0
- data/lib/cloudscale/plugins/cpu/sigar_cpu_time.rb +48 -0
- data/lib/cloudscale/plugins/definition/plugin_components.rb +384 -0
- data/lib/cloudscale/plugins/definition/plugin_components_apache.rb +158 -0
- data/lib/cloudscale/plugins/definition/plugin_components_java.rb +68 -0
- data/lib/cloudscale/plugins/definition/plugin_components_mongodb.rb +358 -0
- data/lib/cloudscale/plugins/definition/plugin_components_postgres.rb +196 -0
- data/lib/cloudscale/plugins/definition/plugin_menus.rb +148 -0
- data/lib/cloudscale/plugins/definition/plugin_menus_apache.rb +85 -0
- data/lib/cloudscale/plugins/definition/plugin_menus_java.rb +67 -0
- data/lib/cloudscale/plugins/definition/plugin_menus_mongodb.rb +125 -0
- data/lib/cloudscale/plugins/definition/plugin_menus_postgres.rb +99 -0
- data/lib/cloudscale/plugins/disk/sigar_disk_iops.rb +71 -0
- data/lib/cloudscale/plugins/disk/sigar_disk_space.rb +67 -0
- data/lib/cloudscale/plugins/general/sigar_net_info.rb +55 -0
- data/lib/cloudscale/plugins/general/sigar_os_information.rb +45 -0
- data/lib/cloudscale/plugins/java/jvm_status.rb +110 -0
- data/lib/cloudscale/plugins/mongo/mongo_db_status.rb +74 -0
- data/lib/cloudscale/plugins/mongo/mongo_replica_status.rb +108 -0
- data/lib/cloudscale/plugins/mongo/mongo_server_status.rb +177 -0
- data/lib/cloudscale/plugins/net/sigar_byte_information.rb +64 -0
- data/lib/cloudscale/plugins/net/sigar_packet_information.rb +84 -0
- data/lib/cloudscale/plugins/plugin.rb +252 -0
- data/lib/cloudscale/plugins/postgres/postgres_server_status.rb +148 -0
- data/lib/cloudscale/plugins/preops/plugin_apache_preop.rb +48 -0
- data/lib/cloudscale/plugins/preops/plugin_mongodb_preop.rb +105 -0
- data/lib/cloudscale/plugins/preops/plugin_postgres_preop.rb +70 -0
- data/lib/cloudscale/plugins/preops/plugin_preop.rb +51 -0
- data/lib/cloudscale/plugins/ram/sigar_ram_usage.rb +61 -0
- data/lib/cloudscale/plugins/ram/sigar_swap_usage.rb +61 -0
- data/lib/cloudscale/rest/rest_client.rb +178 -0
- data/lib/cloudscale/rest/rest_client_helper.rb +70 -0
- data/lib/cloudscale/schedule.rb +45 -0
- data/lib/cloudscale/store/agent/agent.store +2 -0
- data/lib/cloudscale/store/agent/agent_instance.store +11 -0
- data/lib/cloudscale/store/charts/cpuPercCombinedAreaChart +0 -0
- data/lib/cloudscale/store/charts/cpuPercIdleAreaChart +0 -0
- data/lib/cloudscale/store/charts/cpuPercNiceAreaChart +0 -0
- data/lib/cloudscale/store/charts/cpuPercSysAreaChart +0 -0
- data/lib/cloudscale/store/charts/cpuPercWaitAreaChart +0 -0
- data/lib/cloudscale/store/charts/diskFreeAreaChart- +0 -0
- data/lib/cloudscale/store/charts/diskFreeAreaChart-dev +0 -0
- data/lib/cloudscale/store/charts/diskReadBytesPerSecondAreaChart- +0 -0
- data/lib/cloudscale/store/charts/diskReadBytesPerSecondAreaChart-dev +0 -0
- data/lib/cloudscale/store/charts/diskReadsPerSecondAreaChart- +0 -0
- data/lib/cloudscale/store/charts/diskReadsPerSecondAreaChart-dev +0 -0
- data/lib/cloudscale/store/charts/diskTotalAreaChart- +0 -0
- data/lib/cloudscale/store/charts/diskTotalAreaChart-dev +0 -0
- data/lib/cloudscale/store/charts/diskUsedAreaChart- +0 -0
- data/lib/cloudscale/store/charts/diskUsedAreaChart-dev +0 -0
- data/lib/cloudscale/store/charts/diskWriteBytesPerSecondAreaChart- +0 -0
- data/lib/cloudscale/store/charts/diskWriteBytesPerSecondAreaChart-dev +0 -0
- data/lib/cloudscale/store/charts/diskWritesPerSecondAreaChart- +0 -0
- data/lib/cloudscale/store/charts/diskWritesPerSecondAreaChart-dev +0 -0
- data/lib/cloudscale/store/charts/ramFreeAreaChart +0 -0
- data/lib/cloudscale/store/charts/ramTotalAreaChart +0 -0
- data/lib/cloudscale/store/charts/ramUsedAreaChart +0 -0
- data/lib/cloudscale/store/charts/receivedBytesChart-bridge0 +0 -0
- data/lib/cloudscale/store/charts/receivedBytesChart-en0 +0 -0
- data/lib/cloudscale/store/charts/receivedBytesChart-en1 +0 -0
- data/lib/cloudscale/store/charts/receivedBytesChart-en2 +0 -0
- data/lib/cloudscale/store/charts/receivedBytesChart-en4 +0 -0
- data/lib/cloudscale/store/charts/receivedBytesChart-lo0 +0 -0
- data/lib/cloudscale/store/charts/receivedBytesChart-p2p0 +0 -0
- data/lib/cloudscale/store/charts/receivedBytesChart-vmnet1 +0 -0
- data/lib/cloudscale/store/charts/receivedBytesChart-vmnet8 +0 -0
- data/lib/cloudscale/store/charts/receivedPacketsChart-bridge0 +0 -0
- data/lib/cloudscale/store/charts/receivedPacketsChart-en0 +0 -0
- data/lib/cloudscale/store/charts/receivedPacketsChart-en1 +0 -0
- data/lib/cloudscale/store/charts/receivedPacketsChart-en2 +0 -0
- data/lib/cloudscale/store/charts/receivedPacketsChart-en4 +0 -0
- data/lib/cloudscale/store/charts/receivedPacketsChart-lo0 +0 -0
- data/lib/cloudscale/store/charts/receivedPacketsChart-p2p0 +0 -0
- data/lib/cloudscale/store/charts/receivedPacketsChart-vmnet1 +0 -0
- data/lib/cloudscale/store/charts/receivedPacketsChart-vmnet8 +0 -0
- data/lib/cloudscale/store/charts/receivedPacketsDroppedChart-bridge0 +0 -0
- data/lib/cloudscale/store/charts/receivedPacketsDroppedChart-en0 +0 -0
- data/lib/cloudscale/store/charts/receivedPacketsDroppedChart-en1 +0 -0
- data/lib/cloudscale/store/charts/receivedPacketsDroppedChart-en2 +0 -0
- data/lib/cloudscale/store/charts/receivedPacketsDroppedChart-en4 +0 -0
- data/lib/cloudscale/store/charts/receivedPacketsDroppedChart-lo0 +0 -0
- data/lib/cloudscale/store/charts/receivedPacketsDroppedChart-p2p0 +0 -0
- data/lib/cloudscale/store/charts/receivedPacketsDroppedChart-vmnet1 +0 -0
- data/lib/cloudscale/store/charts/receivedPacketsDroppedChart-vmnet8 +0 -0
- data/lib/cloudscale/store/charts/receivedPacketsErrorChart-bridge0 +0 -0
- data/lib/cloudscale/store/charts/receivedPacketsErrorChart-en0 +0 -0
- data/lib/cloudscale/store/charts/receivedPacketsErrorChart-en1 +0 -0
- data/lib/cloudscale/store/charts/receivedPacketsErrorChart-en2 +0 -0
- data/lib/cloudscale/store/charts/receivedPacketsErrorChart-en4 +0 -0
- data/lib/cloudscale/store/charts/receivedPacketsErrorChart-lo0 +0 -0
- data/lib/cloudscale/store/charts/receivedPacketsErrorChart-p2p0 +0 -0
- data/lib/cloudscale/store/charts/receivedPacketsErrorChart-vmnet1 +0 -0
- data/lib/cloudscale/store/charts/receivedPacketsErrorChart-vmnet8 +0 -0
- data/lib/cloudscale/store/charts/sendBytesChart-bridge0 +0 -0
- data/lib/cloudscale/store/charts/sendBytesChart-en0 +0 -0
- data/lib/cloudscale/store/charts/sendBytesChart-en1 +0 -0
- data/lib/cloudscale/store/charts/sendBytesChart-en2 +0 -0
- data/lib/cloudscale/store/charts/sendBytesChart-en4 +0 -0
- data/lib/cloudscale/store/charts/sendBytesChart-lo0 +0 -0
- data/lib/cloudscale/store/charts/sendBytesChart-p2p0 +0 -0
- data/lib/cloudscale/store/charts/sendBytesChart-vmnet1 +0 -0
- data/lib/cloudscale/store/charts/sendBytesChart-vmnet8 +0 -0
- data/lib/cloudscale/store/charts/sendPacketsChart-bridge0 +0 -0
- data/lib/cloudscale/store/charts/sendPacketsChart-en0 +0 -0
- data/lib/cloudscale/store/charts/sendPacketsChart-en1 +0 -0
- data/lib/cloudscale/store/charts/sendPacketsChart-en2 +0 -0
- data/lib/cloudscale/store/charts/sendPacketsChart-en4 +0 -0
- data/lib/cloudscale/store/charts/sendPacketsChart-lo0 +0 -0
- data/lib/cloudscale/store/charts/sendPacketsChart-p2p0 +0 -0
- data/lib/cloudscale/store/charts/sendPacketsChart-vmnet1 +0 -0
- data/lib/cloudscale/store/charts/sendPacketsChart-vmnet8 +0 -0
- data/lib/cloudscale/store/charts/sendPacketsDroppedChart-bridge0 +0 -0
- data/lib/cloudscale/store/charts/sendPacketsDroppedChart-en0 +0 -0
- data/lib/cloudscale/store/charts/sendPacketsDroppedChart-en1 +0 -0
- data/lib/cloudscale/store/charts/sendPacketsDroppedChart-en2 +0 -0
- data/lib/cloudscale/store/charts/sendPacketsDroppedChart-en4 +0 -0
- data/lib/cloudscale/store/charts/sendPacketsDroppedChart-lo0 +0 -0
- data/lib/cloudscale/store/charts/sendPacketsDroppedChart-p2p0 +0 -0
- data/lib/cloudscale/store/charts/sendPacketsDroppedChart-vmnet1 +0 -0
- data/lib/cloudscale/store/charts/sendPacketsDroppedChart-vmnet8 +0 -0
- data/lib/cloudscale/store/charts/sendPacketsErrorChart-bridge0 +0 -0
- data/lib/cloudscale/store/charts/sendPacketsErrorChart-en0 +0 -0
- data/lib/cloudscale/store/charts/sendPacketsErrorChart-en1 +0 -0
- data/lib/cloudscale/store/charts/sendPacketsErrorChart-en2 +0 -0
- data/lib/cloudscale/store/charts/sendPacketsErrorChart-en4 +0 -0
- data/lib/cloudscale/store/charts/sendPacketsErrorChart-lo0 +0 -0
- data/lib/cloudscale/store/charts/sendPacketsErrorChart-p2p0 +0 -0
- data/lib/cloudscale/store/charts/sendPacketsErrorChart-vmnet1 +0 -0
- data/lib/cloudscale/store/charts/sendPacketsErrorChart-vmnet8 +0 -0
- data/lib/cloudscale/store/charts/swapFreeAreaChart +0 -0
- data/lib/cloudscale/store/charts/swapTotalAreaChart +0 -0
- data/lib/cloudscale/store/charts/swapUsedAreaChart +0 -0
- data/lib/cloudscale/store/data/agent_unit.store +21 -0
- data/lib/cloudscale/store/plugin/token +1 -0
- data/lib/cloudscale/store/plugin_components.store +268 -0
- data/lib/cloudscale/store/plugin_menu.store +80 -0
- data/lib/cloudscale/store/rest/settings.yml +3 -0
- data/lib/test/agent/init_test.rb +18 -0
- data/lib/test/dynamicops/test_dynamic_ops.rb +90 -0
- data/lib/test/dynamicops/test_static_ops.rb +81 -0
- data/lib/test/model/constants/agent_store_test.rb +20 -0
- data/lib/test/model/constants/agent_unit_store_test.rb +20 -0
- data/lib/test/model/constants/setup/display_unit_store_test.rb +22 -0
- data/lib/test/model/constants/statistic_store_test.rb +21 -0
- data/lib/test/model/measurement/settings/chart_settings_test.rb +33 -0
- data/lib/test/model/statistic/create_statistic_test.rb +28 -0
- data/lib/test/model/statistic/create_units_test.rb +49 -0
- data/lib/test/plugins/apache/apache2_server_status_test.rb +23 -0
- data/lib/test/plugins/java/jvm_status_test.rb +16 -0
- data/lib/test/plugins/mongo/mongo_db_stats.rb +17 -0
- data/lib/test/plugins/mongo/mongo_db_wrapper_test.rb +21 -0
- data/lib/test/plugins/mongo/mongo_server_replica_set.rb +17 -0
- data/lib/test/plugins/mongo/mongo_server_status_test.rb +37 -0
- data/lib/test/plugins/plugin_test.rb +74 -0
- data/lib/test/plugins/postgres/postgres_cluster_stats.rb +20 -0
- data/lib/test/plugins/postgres/postgres_wrapper_test.rb +20 -0
- data/lib/test/plugins/tomcat/tomcat_monitoring.rb +255 -0
- data/lib/test/rest/rest_client_test.rb +50 -0
- data/lib/test/sigar/sigar_test.rb +25 -0
- data/lib/test/stringUtils/common_test.rb +25 -0
- metadata +359 -0
@@ -0,0 +1,80 @@
|
|
1
|
+
---
|
2
|
+
cpu:
|
3
|
+
name: cpu
|
4
|
+
label: CPU
|
5
|
+
description: Details of CPU
|
6
|
+
order: 0
|
7
|
+
agentInstanceId:
|
8
|
+
subItems:
|
9
|
+
- menuId: generalInformation
|
10
|
+
label: CPU Information
|
11
|
+
description: General Information about CPU and their cores
|
12
|
+
order: 1
|
13
|
+
- menuId: cpuUsage
|
14
|
+
label: CPU Usage
|
15
|
+
description: General Information about CPU and their cores
|
16
|
+
order: 1
|
17
|
+
ram:
|
18
|
+
name: ram
|
19
|
+
label: RAM
|
20
|
+
description: Details of RAM
|
21
|
+
order: 1
|
22
|
+
agentInstanceId:
|
23
|
+
subItems:
|
24
|
+
- menuId: ramUsage
|
25
|
+
label: RAM Usage
|
26
|
+
description: TODO
|
27
|
+
order: 1
|
28
|
+
- menuId: swapUsage
|
29
|
+
label: Swap Usage
|
30
|
+
description: TODO
|
31
|
+
order: 1
|
32
|
+
disk:
|
33
|
+
name: disk
|
34
|
+
label: Disk
|
35
|
+
description: Details of Disk
|
36
|
+
order: 2
|
37
|
+
agentInstanceId:
|
38
|
+
subItems:
|
39
|
+
- menuId: diskUsage
|
40
|
+
label: Disk Usage
|
41
|
+
description: TODO
|
42
|
+
order: 1
|
43
|
+
- menuId: diskReadsWrites
|
44
|
+
label: Disk Reads and Writes
|
45
|
+
description: TODO
|
46
|
+
order: 1
|
47
|
+
- menuId: diskByteReadsAndWrite
|
48
|
+
label: Disk Byte Reads and Writes
|
49
|
+
description: TODO
|
50
|
+
order: 1
|
51
|
+
network:
|
52
|
+
name: net
|
53
|
+
label: Network
|
54
|
+
description: Details of the Network
|
55
|
+
order: 3
|
56
|
+
agentInstanceId:
|
57
|
+
subItems:
|
58
|
+
- menuId: packetStatistics
|
59
|
+
label: Packet Statistics
|
60
|
+
description: TODO
|
61
|
+
order: 1
|
62
|
+
- menuId: sendAndReceivedBytes
|
63
|
+
label: Send and Received bytes/second
|
64
|
+
description: TODO
|
65
|
+
order: 1
|
66
|
+
general:
|
67
|
+
name: general
|
68
|
+
label: General System Information
|
69
|
+
description: Details of the Network
|
70
|
+
order: 4
|
71
|
+
agentInstanceId:
|
72
|
+
subItems:
|
73
|
+
- menuId: osInformation
|
74
|
+
label: General System Information regarding OS
|
75
|
+
description: TODO
|
76
|
+
order: 1
|
77
|
+
- menuId: networkInformation
|
78
|
+
label: General Network Information Network
|
79
|
+
description: TODO
|
80
|
+
order: 1
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "test/unit"
|
2
|
+
require "#{File.dirname(__FILE__)}/../../lib/agent/init"
|
3
|
+
|
4
|
+
##
|
5
|
+
#
|
6
|
+
# @author Johannes Hiemer, cloudscale.
|
7
|
+
#
|
8
|
+
##
|
9
|
+
class InitTest < Test::Unit::TestCase
|
10
|
+
|
11
|
+
def test_load_agent
|
12
|
+
agentInit = Monitor::Init.new
|
13
|
+
agentInstanceId = agentInit.load_agent
|
14
|
+
|
15
|
+
assert_not_nil(agentInstanceId)
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
require "fsdb"
|
2
|
+
require "optparse"
|
3
|
+
require "singleton"
|
4
|
+
|
5
|
+
##
|
6
|
+
#
|
7
|
+
# @author Johannes Hiemer, cloudscale.
|
8
|
+
#
|
9
|
+
##
|
10
|
+
module TestDynamicOps
|
11
|
+
class Params
|
12
|
+
include Singleton
|
13
|
+
|
14
|
+
@plugin_settings_db = FSDB::Database.new("#{File.dirname(__FILE__)}/../../lib/store/plugin/")
|
15
|
+
|
16
|
+
@options = {
|
17
|
+
:host => {
|
18
|
+
:argument => "--host",
|
19
|
+
:description => "Host for your MongoDB Instance (e.g. host.mongodb.com)",
|
20
|
+
:required => true,
|
21
|
+
:value => nil
|
22
|
+
},
|
23
|
+
:port => {
|
24
|
+
:argument => "--port",
|
25
|
+
:description => "Port for your MongoDB Instance (Standard 27017)",
|
26
|
+
:required => false,
|
27
|
+
:value => 27017
|
28
|
+
},
|
29
|
+
:db => {
|
30
|
+
:argument => "--db",
|
31
|
+
:description => "Database of your MongoDB instance",
|
32
|
+
:required => true,
|
33
|
+
:value => nil
|
34
|
+
},
|
35
|
+
:ssl => {
|
36
|
+
:argument => "--ssl",
|
37
|
+
:description => "Usage SSL of your MongoDB instance",
|
38
|
+
:required => false,
|
39
|
+
:value => false
|
40
|
+
},
|
41
|
+
:username => {
|
42
|
+
:argument => "--username",
|
43
|
+
:description => "Username for your MongoDB instance",
|
44
|
+
:required => false,
|
45
|
+
:value => nil
|
46
|
+
},
|
47
|
+
:password => {
|
48
|
+
:argument => "--password",
|
49
|
+
:description => "Password for your MongoDB instance",
|
50
|
+
:required => false,
|
51
|
+
:value => nil
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
55
|
+
def self.options
|
56
|
+
@options
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.set_option_value(key, val)
|
60
|
+
@options[key.to_sym][:value] = val
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.get_option(key)
|
64
|
+
@options[key.to_sym]
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.get_option_value(key)
|
68
|
+
@options[key.to_sym][:value] #|| @plugin_settings_db[key.to_s]
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.init_options
|
72
|
+
@plugin_settings_db.fetch.each do | key |
|
73
|
+
@options[key.to_sym][:value] = @plugin_settings_db[key]
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.save_options
|
78
|
+
@options.each do | key, value |
|
79
|
+
@plugin_settings_db[key.to_s] = value[:value].to_s
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def self.clear_options
|
84
|
+
@plugin_settings_db.each do | element |
|
85
|
+
local_chart_db.delete(element)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require "optparse"
|
2
|
+
require "yaml"
|
3
|
+
require "#{File.dirname(__FILE__)}/test_dynamic_ops"
|
4
|
+
|
5
|
+
##
|
6
|
+
#
|
7
|
+
# @author Johannes Hiemer, cloudscale.
|
8
|
+
#
|
9
|
+
##
|
10
|
+
module TestStaticOps
|
11
|
+
|
12
|
+
options = {}
|
13
|
+
mandatory = Array.new
|
14
|
+
TestDynamicOps::Params.init_options
|
15
|
+
|
16
|
+
parser = OptionParser.new do | parser |
|
17
|
+
|
18
|
+
parser.banner = "Usage: monitoring COMMAND [OPTIONS]"
|
19
|
+
parser.separator ""
|
20
|
+
parser.separator "Commands"
|
21
|
+
parser.separator " start: Start cloudscale monitoring agent"
|
22
|
+
parser.separator " stop: Stop cloudscale monitoring agent"
|
23
|
+
parser.separator ""
|
24
|
+
parser.separator " reset: This resets the Chart, Table and Coredata specification settings.
|
25
|
+
WARNING: Please be aware, that all collected data will be lost in your management environment."
|
26
|
+
parser.separator " remove: This removes the complete cloudscale monitoring agent. WARNING: Please be aware, that all
|
27
|
+
collected data AND the agent will be lost in your management environment."
|
28
|
+
parser.separator "Options"
|
29
|
+
|
30
|
+
parser.on("-v", "--version", "Show version information about this program and quit.") do
|
31
|
+
puts "Cloudscale Monitoring " + VERSION
|
32
|
+
exit
|
33
|
+
end
|
34
|
+
|
35
|
+
parser.separator "\n"
|
36
|
+
parser.separator "Plugin specific Settings"
|
37
|
+
|
38
|
+
TestDynamicOps::Params.options.each do | key, value |
|
39
|
+
if (value[:required])
|
40
|
+
mandatory.push(key)
|
41
|
+
end
|
42
|
+
parser.on(value[:argument][1,2] + " n", value[:argument] + "=n", value[:description]) do | value |
|
43
|
+
TestDynamicOps::Params.set_option_value(key, value)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
begin
|
49
|
+
parser.parse!
|
50
|
+
missing = mandatory.select{ | param |
|
51
|
+
TestDynamicOps::Params.get_option_value(param).nil?
|
52
|
+
}
|
53
|
+
if not missing.empty?
|
54
|
+
puts "\n"
|
55
|
+
puts "Error during execution: "
|
56
|
+
puts " Missing options: #{missing.join(', ')}"
|
57
|
+
puts "\n"
|
58
|
+
puts parser
|
59
|
+
exit
|
60
|
+
else
|
61
|
+
TestDynamicOps::Params.save_options
|
62
|
+
end
|
63
|
+
rescue OptionParser::InvalidOption, OptionParser::MissingArgument
|
64
|
+
puts $!.to_s
|
65
|
+
puts parser
|
66
|
+
exit
|
67
|
+
end
|
68
|
+
|
69
|
+
case ARGV[0]
|
70
|
+
when "start"
|
71
|
+
when "reset"
|
72
|
+
puts "Starting cleanup process"
|
73
|
+
Plugins::Plugin.reset(agent_instance_id)
|
74
|
+
when "delete"
|
75
|
+
puts "Starting removal process"
|
76
|
+
Plugins::Plugin.remove(agent_instance_id)
|
77
|
+
else
|
78
|
+
puts parser
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require "#{File.dirname(__FILE__)}/../../../lib/model/constants/agent_unit_store"
|
2
|
+
require "test/unit"
|
3
|
+
|
4
|
+
##
|
5
|
+
#
|
6
|
+
# @author Johannes Hiemer, cloudscale.
|
7
|
+
#
|
8
|
+
##
|
9
|
+
class AgentUnitStoreTest < Test::Unit::TestCase
|
10
|
+
|
11
|
+
def test_create
|
12
|
+
unit = Constants::Agent.new
|
13
|
+
assert_equal(unit != nil, true)
|
14
|
+
assert_equal(unit.Byte != nil, true)
|
15
|
+
|
16
|
+
assert_equal(unit.Byte["id"], "B")
|
17
|
+
assert_equal(unit.Byte["name"], "Byte")
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require "#{File.dirname(__FILE__)}/../../../lib/model/constants/agent_unit_store"
|
2
|
+
require "test/unit"
|
3
|
+
|
4
|
+
##
|
5
|
+
#
|
6
|
+
# @author Johannes Hiemer, cloudscale.
|
7
|
+
#
|
8
|
+
##
|
9
|
+
class AgentUnitStoreTest < Test::Unit::TestCase
|
10
|
+
|
11
|
+
def test_unit
|
12
|
+
unit = Constants::AgentUnit.new
|
13
|
+
assert_equal(unit != nil, true)
|
14
|
+
assert_equal(unit.Byte != nil, true)
|
15
|
+
|
16
|
+
assert_equal(unit.Byte["id"], "B")
|
17
|
+
assert_equal(unit.Byte["name"], "Byte")
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require "#{File.dirname(__FILE__)}/../../../../lib/model/constants/display_unit_store"
|
2
|
+
require "test/unit"
|
3
|
+
|
4
|
+
##
|
5
|
+
#
|
6
|
+
# @author Johannes Hiemer, cloudscale.
|
7
|
+
#
|
8
|
+
##
|
9
|
+
class DisplayUnitStoreTest < Test::Unit::TestCase
|
10
|
+
|
11
|
+
def test_unit
|
12
|
+
unit = Constants::DisplayUnit.new
|
13
|
+
assert_equal(unit != nil, true)
|
14
|
+
|
15
|
+
assert_equal(unit.Kilobyte != nil, true)
|
16
|
+
|
17
|
+
assert_equal(unit.Kilobyte["label"], "kB")
|
18
|
+
assert_equal(unit.Kilobyte["name"], "Kilobyte")
|
19
|
+
assert_equal(unit.Kilobyte["precision"], 2)
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "#{File.dirname(__FILE__)}/../../../lib/model/constants/statistic_store"
|
2
|
+
require "test/unit"
|
3
|
+
|
4
|
+
##
|
5
|
+
#
|
6
|
+
# @author Johannes Hiemer, cloudscale.
|
7
|
+
#
|
8
|
+
##
|
9
|
+
class StatisticStoreTest < Test::Unit::TestCase
|
10
|
+
|
11
|
+
def test_statistic
|
12
|
+
statistic = Constants::Statistic.new
|
13
|
+
assert_equal(statistic != nil, true)
|
14
|
+
|
15
|
+
assert_equal(statistic.Max != nil, true)
|
16
|
+
|
17
|
+
assert_equal(statistic.Max["label"], "Maximum")
|
18
|
+
assert_equal(statistic.Max["value"], "max")
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require "test/unit"
|
2
|
+
require "#{File.dirname(__FILE__)}/../../../../../lib/model/measurement/settings/chart_settings"
|
3
|
+
require "#{File.dirname(__FILE__)}/../../../../../lib/model/measurement/chart"
|
4
|
+
|
5
|
+
##
|
6
|
+
#
|
7
|
+
# @author Johannes Hiemer, cloudscale.
|
8
|
+
#
|
9
|
+
##
|
10
|
+
class ChartSettingsTest < Test::Unit::TestCase
|
11
|
+
|
12
|
+
def setup
|
13
|
+
@chartSettings = Monitor::ChartSettings.instance
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_save_yaml
|
17
|
+
hash = ramTotalChart = Monitor::Chart.new("ramTotalAreaChart", "Total RAM Consumption",
|
18
|
+
"This chart represents the total RAM consumption of the Server", "areaChart", "Time", "MB RAM in GB")
|
19
|
+
|
20
|
+
@chartSettings.create_file("ramTotalAreaChart", hash.to_h)
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_load_yaml
|
24
|
+
hash = @chartSettings.load_file("ramTotalAreaChart")
|
25
|
+
|
26
|
+
assert_not_nil(hash)
|
27
|
+
|
28
|
+
puts hash
|
29
|
+
|
30
|
+
assert_not_nil(hash["chartId"])
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require "#{File.dirname(__FILE__)}/../../../../lib/model/constants/statistic_store"
|
2
|
+
require "#{File.dirname(__FILE__)}/../../../../lib/rest/rest_client"
|
3
|
+
require "test/unit"
|
4
|
+
|
5
|
+
##
|
6
|
+
#
|
7
|
+
# @author Johannes Hiemer, cloudscale.
|
8
|
+
#
|
9
|
+
##
|
10
|
+
class CreateStatisticTest < Test::Unit::TestCase
|
11
|
+
|
12
|
+
def test_statistic
|
13
|
+
statistic = Constants::Statistic.new
|
14
|
+
client = RestClientWrapper.new("http://localhost:8080/web", "benchmark", "jvioeijiovjriojrio")
|
15
|
+
client.post("statistics", statistic.Max())
|
16
|
+
client.post("statistics", statistic.Min())
|
17
|
+
client.post("statistics", statistic.Avg())
|
18
|
+
client.post("statistics", statistic.Sum())
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_delete_statistic
|
22
|
+
statistic = Constants::Statistic.new
|
23
|
+
client = RestClientWrapper.new("http://localhost:8080/web", "benchmark", "jvioeijiovjriojrio")
|
24
|
+
statistics = client.list("statistics")
|
25
|
+
puts statistics
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require "yaml"
|
2
|
+
require "#{File.dirname(__FILE__)}/../../../../lib/model/constants/display_unit_store"
|
3
|
+
require "#{File.dirname(__FILE__)}/../../../../lib/rest/rest_client"
|
4
|
+
require "test/unit"
|
5
|
+
|
6
|
+
##
|
7
|
+
#
|
8
|
+
# @author Johannes Hiemer, cloudscale.
|
9
|
+
#
|
10
|
+
##
|
11
|
+
class CreateUnitTest < Test::Unit::TestCase
|
12
|
+
|
13
|
+
def test_statistic
|
14
|
+
unit = Constants::DisplayUnit.new
|
15
|
+
client = RestClientWrapper.new("http://localhost:8080/web", "benchmark", "jvioeijiovjriojrio")
|
16
|
+
client.post("units", unit.Bit())
|
17
|
+
client.post("units", unit.Kilobit())
|
18
|
+
client.post("units", unit.Megabit())
|
19
|
+
client.post("units", unit.Gigabit())
|
20
|
+
client.post("units", unit.Terabit())
|
21
|
+
client.post("units", unit.Byte())
|
22
|
+
client.post("units", unit.Kilobyte())
|
23
|
+
client.post("units", unit.Megabyte())
|
24
|
+
client.post("units", unit.Gigabyte())
|
25
|
+
client.post("units", unit.Terabyte())
|
26
|
+
client.post("units", unit.Petabyte())
|
27
|
+
client.post("units", unit.Millisecond())
|
28
|
+
client.post("units", unit.Second())
|
29
|
+
client.post("units", unit.Minute())
|
30
|
+
client.post("units", unit.Hour())
|
31
|
+
client.post("units", unit.Day())
|
32
|
+
client.post("units", unit.Week())
|
33
|
+
client.post("units", unit.Month())
|
34
|
+
client.post("units", unit.Year())
|
35
|
+
client.post("units", unit.Count())
|
36
|
+
client.post("units", unit.Percent())
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_delete_statistic
|
40
|
+
client = RestClientWrapper.new("http://localhost:8080/web", "benchmark", "jvioeijiovjriojrio")
|
41
|
+
units = client.list("units")
|
42
|
+
assert_equal(units.is_a?(Base::Resources), true)
|
43
|
+
|
44
|
+
units.content.each { | unit |
|
45
|
+
client.delete("units", RestClientWrapper.load_entity_id(unit))
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|