opstat-plugins 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/.gitlab-ci.yml +17 -0
  4. data/LICENSE +675 -0
  5. data/lib/app/models/apache2.rb +192 -0
  6. data/lib/app/models/bsdnet/bytes_in_out.rb +54 -0
  7. data/lib/app/models/bsdnet/current_entries.rb +34 -0
  8. data/lib/app/models/bsdnet.rb +12 -0
  9. data/lib/app/models/cpu.rb +86 -0
  10. data/lib/app/models/disk.rb +51 -0
  11. data/lib/app/models/disk_io.rb +53 -0
  12. data/lib/app/models/facts.rb +30 -0
  13. data/lib/app/models/fpm.rb +138 -0
  14. data/lib/app/models/haproxy.rb +57 -0
  15. data/lib/app/models/jvm.rb +51 -0
  16. data/lib/app/models/load.rb +99 -0
  17. data/lib/app/models/memory.rb +55 -0
  18. data/lib/app/models/nagios.rb +51 -0
  19. data/lib/app/models/network.rb +58 -0
  20. data/lib/app/models/oracle_fras_sizes.rb +41 -0
  21. data/lib/app/models/oracle_sessions.rb +43 -0
  22. data/lib/app/models/oracle_tablespaces_sizes.rb +51 -0
  23. data/lib/app/models/temper.rb +51 -0
  24. data/lib/app/models/webobjects.rb +83 -0
  25. data/lib/app/models/xen.rb +99 -0
  26. data/lib/data/hp_pdu.yml +191 -0
  27. data/lib/logging.rb +29 -0
  28. data/lib/opstat-plugins.rb +44 -0
  29. data/lib/parsers/apache2.rb +19 -0
  30. data/lib/parsers/bsdnet.rb +29 -0
  31. data/lib/parsers/cpu.rb +42 -0
  32. data/lib/parsers/disk.rb +49 -0
  33. data/lib/parsers/facts.rb +12 -0
  34. data/lib/parsers/fpm.rb +31 -0
  35. data/lib/parsers/freeswitch_fifos.rb +63 -0
  36. data/lib/parsers/haproxy.rb +34 -0
  37. data/lib/parsers/haproxy_tables.rb +25 -0
  38. data/lib/parsers/hp_pdu.rb +36 -0
  39. data/lib/parsers/jvm.rb +22 -0
  40. data/lib/parsers/load.rb +20 -0
  41. data/lib/parsers/memory.rb +29 -0
  42. data/lib/parsers/nagios.rb +39 -0
  43. data/lib/parsers/network.rb +37 -0
  44. data/lib/parsers/oracle_fras_sizes.rb +25 -0
  45. data/lib/parsers/oracle_sessions.rb +20 -0
  46. data/lib/parsers/oracle_tablespaces_sizes.rb +22 -0
  47. data/lib/parsers/temper.rb +17 -0
  48. data/lib/parsers/webobjects.rb +33 -0
  49. data/lib/parsers/xen.rb +39 -0
  50. data/lib/plugins/apache2.rb +76 -0
  51. data/lib/plugins/bsdnet.rb +13 -0
  52. data/lib/plugins/cpu.rb +13 -0
  53. data/lib/plugins/custom_sql_statement.rb +24 -0
  54. data/lib/plugins/disk.rb +31 -0
  55. data/lib/plugins/facts.rb +30 -0
  56. data/lib/plugins/fpm.rb +33 -0
  57. data/lib/plugins/freeswitch_fifos.rb +27 -0
  58. data/lib/plugins/haproxy.rb +24 -0
  59. data/lib/plugins/haproxy_tables.rb +28 -0
  60. data/lib/plugins/hp_pdu.rb +28 -0
  61. data/lib/plugins/jvm.rb +23 -0
  62. data/lib/plugins/load.rb +20 -0
  63. data/lib/plugins/memory.rb +18 -0
  64. data/lib/plugins/nagios.rb +39 -0
  65. data/lib/plugins/network.rb +21 -0
  66. data/lib/plugins/oracle_fras_sizes.rb +48 -0
  67. data/lib/plugins/oracle_sessions.rb +47 -0
  68. data/lib/plugins/oracle_tablespaces_sizes.rb +59 -0
  69. data/lib/plugins/temper.rb +21 -0
  70. data/lib/plugins/webobjects.rb +42 -0
  71. data/lib/plugins/xen.rb +22 -0
  72. data/opstat-plugins.gemspec +20 -0
  73. data/spec/cpu_spec.rb +39 -0
  74. data/spec/disk_io_spec.rb +31 -0
  75. data/spec/disk_spec.rb +31 -0
  76. data/spec/fixtures/parser_cpu_16_core.txt +24 -0
  77. data/spec/fixtures/parser_cpu_16_core_corrupted.txt +24 -0
  78. data/spec/fixtures/parser_cpu_single_core.txt +10 -0
  79. data/spec/fixtures/parser_cpu_single_core_corrupted.txt +9 -0
  80. data/spec/fixtures/parser_disk_3_mounts.txt +9 -0
  81. data/spec/fixtures/parser_disk_corrupted.txt +9 -0
  82. data/spec/fixtures/parser_disk_io.txt +2 -0
  83. data/spec/fixtures/parser_disk_io_corrupted.txt +2 -0
  84. data/spec/fixtures/parser_haproxy_correct.txt +2 -0
  85. data/spec/fixtures/parser_haproxy_corrupted.txt +2 -0
  86. data/spec/fixtures/parser_haproxy_many_frontend_many_backend.txt +6 -0
  87. data/spec/fixtures/parser_haproxy_single_frontend_single_backend_with_single_svname.txt +5 -0
  88. data/spec/fixtures/parser_load.txt +1 -0
  89. data/spec/fixtures/parser_load_corrupted.txt +2 -0
  90. data/spec/fixtures/parser_memory.txt +43 -0
  91. data/spec/fixtures/parser_memory_corrupted.txt +43 -0
  92. data/spec/fixtures/parser_network.txt +5 -0
  93. data/spec/fixtures/parser_network_corrupted.txt +5 -0
  94. data/spec/fixtures/parser_webobjects_many_apps_many_instances.result.yml +590 -0
  95. data/spec/fixtures/parser_webobjects_many_apps_many_instances.txt +2 -0
  96. data/spec/fixtures/parser_webobjects_one_app_many_instances.result.yml +305 -0
  97. data/spec/fixtures/parser_webobjects_one_app_many_instances.txt +395 -0
  98. data/spec/haproxy_spec.rb +68 -0
  99. data/spec/load_spec.rb +21 -0
  100. data/spec/memory_spec.rb +21 -0
  101. data/spec/network_spec.rb +21 -0
  102. data/spec/spec_helper.rb +102 -0
  103. data/spec/webobjects_spec.rb +28 -0
  104. metadata +189 -0
@@ -0,0 +1,395 @@
1
+ [{"name": "ifirma", "id": "101", "host": "ifirmaapp01", "port": "2101",
2
+ "state": "DEAD", "deaths": "0", "refusingNewSessions": false, "scheduled":
3
+ false, "schedulingHourlyStartTime": 3, "schedulingDailyStartTime": 3,
4
+ "schedulingWeeklyStartTime": 3, "schedulingType": "DAILY",
5
+ "schedulingStartDay": 1, "schedulingInterval": 12, "transactions": "0",
6
+ "activeSessions": "0", "averageIdlePeriod": "0", "avgTransactionTime":
7
+ "0","autoRecover": "false"}, {"name": "ifirma", "id": "102", "host":
8
+ "ifirmaapp01", "port": "2102", "state": "DEAD", "deaths": "0",
9
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
10
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
11
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
12
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
13
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
14
+ "103", "host": "ifirmaapp01", "port": "2103", "state": "DEAD", "deaths": "0",
15
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
16
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
17
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
18
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
19
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
20
+ "104", "host": "ifirmaapp01", "port": "2104", "state": "DEAD", "deaths": "0",
21
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
22
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
23
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
24
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
25
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
26
+ "111", "host": "ifirmaapp02", "port": "2111", "state": "DEAD", "deaths": "0",
27
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
28
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
29
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
30
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
31
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
32
+ "112", "host": "ifirmaapp02", "port": "2112", "state": "DEAD", "deaths": "0",
33
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
34
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
35
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
36
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
37
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
38
+ "113", "host": "ifirmaapp02", "port": "2113", "state": "DEAD", "deaths": "0",
39
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
40
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
41
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
42
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
43
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
44
+ "114", "host": "ifirmaapp02", "port": "2114", "state": "DEAD", "deaths": "0",
45
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
46
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
47
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
48
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
49
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
50
+ "121", "host": "ifirmaapp03", "port": "2121", "state": "DEAD", "deaths": "0",
51
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
52
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
53
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
54
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
55
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
56
+ "122", "host": "ifirmaapp03", "port": "2122", "state": "DEAD", "deaths": "0",
57
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
58
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
59
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
60
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
61
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
62
+ "123", "host": "ifirmaapp03", "port": "2123", "state": "DEAD", "deaths": "0",
63
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
64
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
65
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
66
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
67
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
68
+ "124", "host": "ifirmaapp03", "port": "2124", "state": "DEAD", "deaths": "0",
69
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
70
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
71
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
72
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
73
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
74
+ "131", "host": "ifirmaapp04", "port": "2131", "state": "DEAD", "deaths": "0",
75
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
76
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
77
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
78
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
79
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
80
+ "132", "host": "ifirmaapp04", "port": "2132", "state": "DEAD", "deaths": "0",
81
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
82
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
83
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
84
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
85
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
86
+ "133", "host": "ifirmaapp04", "port": "2133", "state": "DEAD", "deaths": "0",
87
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
88
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
89
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
90
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
91
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
92
+ "134", "host": "ifirmaapp04", "port": "2134", "state": "DEAD", "deaths": "0",
93
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
94
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
95
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
96
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
97
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
98
+ "141", "host": "ifirmaapp05", "port": "2141", "state": "DEAD", "deaths": "0",
99
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
100
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
101
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
102
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
103
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
104
+ "142", "host": "ifirmaapp05", "port": "2142", "state": "DEAD", "deaths": "0",
105
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
106
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
107
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
108
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
109
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
110
+ "143", "host": "ifirmaapp05", "port": "2143", "state": "DEAD", "deaths": "0",
111
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
112
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
113
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
114
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
115
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
116
+ "144", "host": "ifirmaapp05", "port": "2144", "state": "DEAD", "deaths": "0",
117
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
118
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
119
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
120
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
121
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
122
+ "151", "host": "ifirmaapp06", "port": "2151", "state": "DEAD", "deaths": "0",
123
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
124
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
125
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
126
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
127
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
128
+ "152", "host": "ifirmaapp06", "port": "2152", "state": "DEAD", "deaths": "0",
129
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
130
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
131
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
132
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
133
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
134
+ "153", "host": "ifirmaapp06", "port": "2153", "state": "DEAD", "deaths": "0",
135
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
136
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
137
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
138
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
139
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
140
+ "154", "host": "ifirmaapp06", "port": "2154", "state": "DEAD", "deaths": "0",
141
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
142
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
143
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
144
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
145
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
146
+ "161", "host": "ifirmaapp07", "port": "2161", "state": "DEAD", "deaths": "0",
147
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
148
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
149
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
150
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
151
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
152
+ "162", "host": "ifirmaapp07", "port": "2162", "state": "DEAD", "deaths": "0",
153
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
154
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
155
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
156
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
157
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
158
+ "163", "host": "ifirmaapp07", "port": "2163", "state": "DEAD", "deaths": "0",
159
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
160
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
161
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
162
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
163
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
164
+ "164", "host": "ifirmaapp07", "port": "2164", "state": "DEAD", "deaths": "0",
165
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
166
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
167
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
168
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
169
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
170
+ "201", "host": "ifirmaapp01", "port": "2201", "state": "ALIVE", "deaths": "0",
171
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
172
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
173
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
174
+ "transactions": "331111", "activeSessions": "104", "averageIdlePeriod":
175
+ "0.602", "avgTransactionTime": "0.05","autoRecover": "true"}, {"name":
176
+ "ifirma", "id": "202", "host": "ifirmaapp01", "port": "2202", "state":
177
+ "ALIVE", "deaths": "0", "refusingNewSessions": false, "scheduled": false,
178
+ "schedulingHourlyStartTime": 3, "schedulingDailyStartTime": 3,
179
+ "schedulingWeeklyStartTime": 3, "schedulingType": "DAILY",
180
+ "schedulingStartDay": 1, "schedulingInterval": 12, "transactions": "356468",
181
+ "activeSessions": "162", "averageIdlePeriod": "0.6", "avgTransactionTime":
182
+ "0.046","autoRecover": "true"}, {"name": "ifirma", "id": "203", "host":
183
+ "ifirmaapp01", "port": "2203", "state": "DEAD", "deaths": "0",
184
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
185
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
186
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
187
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
188
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
189
+ "204", "host": "ifirmaapp01", "port": "2204", "state": "DEAD", "deaths": "0",
190
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
191
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
192
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
193
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
194
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
195
+ "211", "host": "ifirmaapp02", "port": "2211", "state": "ALIVE", "deaths": "0",
196
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
197
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
198
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
199
+ "transactions": "403779", "activeSessions": "167", "averageIdlePeriod":
200
+ "0.541", "avgTransactionTime": "0.039","autoRecover": "true"}, {"name":
201
+ "ifirma", "id": "212", "host": "ifirmaapp02", "port": "2212", "state":
202
+ "ALIVE", "deaths": "0", "refusingNewSessions": false, "scheduled": false,
203
+ "schedulingHourlyStartTime": 3, "schedulingDailyStartTime": 3,
204
+ "schedulingWeeklyStartTime": 3, "schedulingType": "DAILY",
205
+ "schedulingStartDay": 1, "schedulingInterval": 12, "transactions": "341086",
206
+ "activeSessions": "153", "averageIdlePeriod": "0.569", "avgTransactionTime":
207
+ "0.044","autoRecover": "true"}, {"name": "ifirma", "id": "213", "host":
208
+ "ifirmaapp02", "port": "2213", "state": "DEAD", "deaths": "0",
209
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
210
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
211
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
212
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
213
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
214
+ "214", "host": "ifirmaapp02", "port": "2214", "state": "DEAD", "deaths": "0",
215
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
216
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
217
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
218
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
219
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
220
+ "221", "host": "ifirmaapp03", "port": "2221", "state": "ALIVE", "deaths": "0",
221
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
222
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
223
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
224
+ "transactions": "311936", "activeSessions": "172", "averageIdlePeriod":
225
+ "0.617", "avgTransactionTime": "0.049","autoRecover": "true"}, {"name":
226
+ "ifirma", "id": "222", "host": "ifirmaapp03", "port": "2222", "state":
227
+ "ALIVE", "deaths": "0", "refusingNewSessions": false, "scheduled": false,
228
+ "schedulingHourlyStartTime": 3, "schedulingDailyStartTime": 3,
229
+ "schedulingWeeklyStartTime": 3, "schedulingType": "DAILY",
230
+ "schedulingStartDay": 1, "schedulingInterval": 12, "transactions": "556180",
231
+ "activeSessions": "150", "averageIdlePeriod": "0.66", "avgTransactionTime":
232
+ "0.037","autoRecover": "true"}, {"name": "ifirma", "id": "223", "host":
233
+ "ifirmaapp03", "port": "2223", "state": "DEAD", "deaths": "0",
234
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
235
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
236
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
237
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
238
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
239
+ "224", "host": "ifirmaapp03", "port": "2224", "state": "DEAD", "deaths": "0",
240
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
241
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
242
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
243
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
244
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
245
+ "231", "host": "ifirmaapp04", "port": "2231", "state": "ALIVE", "deaths": "0",
246
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
247
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
248
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
249
+ "transactions": "855089", "activeSessions": "153", "averageIdlePeriod":
250
+ "0.756", "avgTransactionTime": "0.044","autoRecover": "true"}, {"name":
251
+ "ifirma", "id": "232", "host": "ifirmaapp04", "port": "2232", "state":
252
+ "ALIVE", "deaths": "0", "refusingNewSessions": false, "scheduled": false,
253
+ "schedulingHourlyStartTime": 3, "schedulingDailyStartTime": 3,
254
+ "schedulingWeeklyStartTime": 3, "schedulingType": "DAILY",
255
+ "schedulingStartDay": 1, "schedulingInterval": 12, "transactions": "1010924",
256
+ "activeSessions": "163", "averageIdlePeriod": "0.71", "avgTransactionTime":
257
+ "0.038","autoRecover": "true"}, {"name": "ifirma", "id": "233", "host":
258
+ "ifirmaapp04", "port": "2233", "state": "DEAD", "deaths": "0",
259
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
260
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
261
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
262
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
263
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
264
+ "234", "host": "ifirmaapp04", "port": "2234", "state": "DEAD", "deaths": "0",
265
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
266
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
267
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
268
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
269
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
270
+ "241", "host": "ifirmaapp05", "port": "2241", "state": "ALIVE", "deaths": "0",
271
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
272
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
273
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
274
+ "transactions": "983630", "activeSessions": "147", "averageIdlePeriod":
275
+ "0.664", "avgTransactionTime": "0.036","autoRecover": "true"}, {"name":
276
+ "ifirma", "id": "242", "host": "ifirmaapp05", "port": "2242", "state":
277
+ "ALIVE", "deaths": "0", "refusingNewSessions": false, "scheduled": false,
278
+ "schedulingHourlyStartTime": 3, "schedulingDailyStartTime": 3,
279
+ "schedulingWeeklyStartTime": 3, "schedulingType": "DAILY",
280
+ "schedulingStartDay": 1, "schedulingInterval": 12, "transactions": "28314",
281
+ "activeSessions": "162", "averageIdlePeriod": "0.596", "avgTransactionTime":
282
+ "0.072","autoRecover": "true"}, {"name": "ifirma", "id": "243", "host":
283
+ "ifirmaapp05", "port": "2243", "state": "DEAD", "deaths": "0",
284
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
285
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
286
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
287
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
288
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
289
+ "244", "host": "ifirmaapp05", "port": "2244", "state": "DEAD", "deaths": "0",
290
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
291
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
292
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
293
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
294
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
295
+ "251", "host": "ifirmaapp06", "port": "2251", "state": "ALIVE", "deaths": "0",
296
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
297
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
298
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
299
+ "transactions": "351796", "activeSessions": "165", "averageIdlePeriod":
300
+ "0.558", "avgTransactionTime": "0.04","autoRecover": "true"}, {"name":
301
+ "ifirma", "id": "252", "host": "ifirmaapp06", "port": "2252", "state":
302
+ "ALIVE", "deaths": "0", "refusingNewSessions": false, "scheduled": false,
303
+ "schedulingHourlyStartTime": 3, "schedulingDailyStartTime": 3,
304
+ "schedulingWeeklyStartTime": 3, "schedulingType": "DAILY",
305
+ "schedulingStartDay": 1, "schedulingInterval": 12, "transactions": "287528",
306
+ "activeSessions": "121", "averageIdlePeriod": "0.613", "avgTransactionTime":
307
+ "0.048","autoRecover": "true"}, {"name": "ifirma", "id": "253", "host":
308
+ "ifirmaapp06", "port": "2253", "state": "DEAD", "deaths": "0",
309
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
310
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
311
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
312
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
313
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
314
+ "254", "host": "ifirmaapp06", "port": "2254", "state": "DEAD", "deaths": "0",
315
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
316
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
317
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
318
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
319
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
320
+ "261", "host": "ifirmaapp07", "port": "2261", "state": "ALIVE", "deaths": "0",
321
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
322
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
323
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
324
+ "transactions": "518810", "activeSessions": "190", "averageIdlePeriod":
325
+ "0.901", "avgTransactionTime": "0.049","autoRecover": "true"}, {"name":
326
+ "ifirma", "id": "262", "host": "ifirmaapp07", "port": "2262", "state":
327
+ "ALIVE", "deaths": "0", "refusingNewSessions": false, "scheduled": false,
328
+ "schedulingHourlyStartTime": 3, "schedulingDailyStartTime": 3,
329
+ "schedulingWeeklyStartTime": 3, "schedulingType": "DAILY",
330
+ "schedulingStartDay": 1, "schedulingInterval": 12, "transactions": "597894",
331
+ "activeSessions": "127", "averageIdlePeriod": "0.791", "avgTransactionTime":
332
+ "0.04","autoRecover": "true"}, {"name": "ifirma", "id": "263", "host":
333
+ "ifirmaapp07", "port": "2263", "state": "DEAD", "deaths": "0",
334
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
335
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
336
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
337
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
338
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
339
+ "264", "host": "ifirmaapp07", "port": "2264", "state": "DEAD", "deaths": "0",
340
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
341
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
342
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
343
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
344
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
345
+ "171", "host": "ifirmaapp08", "port": "2171", "state": "DEAD", "deaths": "0",
346
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
347
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
348
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
349
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
350
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
351
+ "172", "host": "ifirmaapp08", "port": "2172", "state": "DEAD", "deaths": "0",
352
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
353
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
354
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
355
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
356
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
357
+ "173", "host": "ifirmaapp08", "port": "2173", "state": "DEAD", "deaths": "0",
358
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
359
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
360
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
361
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
362
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
363
+ "174", "host": "ifirmaapp08", "port": "2174", "state": "DEAD", "deaths": "0",
364
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
365
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
366
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
367
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
368
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
369
+ "271", "host": "ifirmaapp08", "port": "2271", "state": "ALIVE", "deaths": "0",
370
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
371
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
372
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
373
+ "transactions": "349186", "activeSessions": "117", "averageIdlePeriod":
374
+ "0.601", "avgTransactionTime": "0.04","autoRecover": "true"}, {"name":
375
+ "ifirma", "id": "272", "host": "ifirmaapp08", "port": "2272", "state":
376
+ "ALIVE", "deaths": "0", "refusingNewSessions": false, "scheduled": false,
377
+ "schedulingHourlyStartTime": 3, "schedulingDailyStartTime": 3,
378
+ "schedulingWeeklyStartTime": 3, "schedulingType": "DAILY",
379
+ "schedulingStartDay": 1, "schedulingInterval": 12, "transactions": "358909",
380
+ "activeSessions": "182", "averageIdlePeriod": "0.563", "avgTransactionTime":
381
+ "0.041","autoRecover": "true"}, {"name": "ifirma", "id": "273", "host":
382
+ "ifirmaapp08", "port": "2273", "state": "DEAD", "deaths": "0",
383
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
384
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
385
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
386
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
387
+ "avgTransactionTime": "0","autoRecover": "false"}, {"name": "ifirma", "id":
388
+ "274", "host": "ifirmaapp08", "port": "2274", "state": "DEAD", "deaths": "0",
389
+ "refusingNewSessions": false, "scheduled": false, "schedulingHourlyStartTime":
390
+ 3, "schedulingDailyStartTime": 3, "schedulingWeeklyStartTime": 3,
391
+ "schedulingType": "DAILY", "schedulingStartDay": 1, "schedulingInterval": 12,
392
+ "transactions": "0", "activeSessions": "0", "averageIdlePeriod": "0",
393
+ "avgTransactionTime": "0","autoRecover": "false"}]
394
+
395
+
@@ -0,0 +1,68 @@
1
+ describe 'Haproxy' do
2
+ describe 'Parsers' do
3
+ describe 'haproxy parser' do
4
+ before :each do
5
+ Opstat::Plugins.load_parser("haproxy")
6
+ @haproxy_parser = Opstat::Parsers::Haproxy.new
7
+ end
8
+
9
+ it 'returns report for many frontend and many backend with one svname' do
10
+ haproxy_data = File.readlines('./spec/fixtures/parser_haproxy_many_frontend_many_backend.txt')
11
+ result_expected = [{
12
+ :stats_type => :frontend,
13
+ :name => 'frontend-http',
14
+ :summary => { :svname=>"FRONTEND", :qcur=>nil, :qmax=>nil, :scur=>0, :smax=>3, :slim=>1000, :stot=>1117, :bin=>234633, :bout=>28452829, :hrsp_1xx=>0, :hrsp_2xx=>2, :hrsp_3xx=>57, :hrsp_4xx=>2, :hrsp_5xx=>0, :hrsp_other=>0, :req_tot=>61, :conn_tot=>22}
15
+ }, { :stats_type => :frontend,
16
+ :name => 'frontend-https',
17
+ :summary => { :svname=>"FRONTEND", :qcur=>nil, :qmax=>nil, :scur=>0, :smax=>3, :slim=>1000, :stot=>1117, :bin=>234633, :bout=>28452829, :hrsp_1xx=>0, :hrsp_2xx=>2, :hrsp_3xx=>57, :hrsp_4xx=>2, :hrsp_5xx=>0, :hrsp_other=>0, :req_tot=>61, :conn_tot=>22}
18
+ },
19
+ {
20
+ :stats_type => :backend,
21
+ :name => 'backend-varnish-ifirma',
22
+ :details => [{ :svname=>"varnishpm02-staging", :qcur=>0, :qmax=>0, :scur=>0, :smax=>2, :slim=>nil, :stot=>1149, :bin=>507182, :bout=>4138662, :hrsp_1xx=>0, :hrsp_2xx=>541, :hrsp_3xx=>31, :hrsp_4xx=>577, :hrsp_5xx=>0, :hrsp_other=>0, :req_tot=>nil, :conn_tot=>nil}],
23
+ :summary => { :svname=>"BACKEND", :qcur=>0, :qmax=>0, :scur=>0, :smax=>4, :slim=>500, :stot=>2301, :bin=>1041031, :bout=>8319027, :hrsp_1xx=>0, :hrsp_2xx=>1096, :hrsp_3xx=>58, :hrsp_4xx=>1147, :hrsp_5xx=>0, :hrsp_other=>0, :req_tot=>2301, :conn_tot=>nil}
24
+ }, {
25
+ :stats_type => :backend,
26
+ :name => 'backend-varnish',
27
+ :summary => { :svname=>"BACKEND", :qcur=>0, :qmax=>0, :scur=>0, :smax=>4, :slim=>500, :stot=>2301, :bin=>1041031, :bout=>8319027, :hrsp_1xx=>0, :hrsp_2xx=>1096, :hrsp_3xx=>58, :hrsp_4xx=>1147, :hrsp_5xx=>0, :hrsp_other=>0, :req_tot=>2301, :conn_tot=>nil}
28
+ }
29
+ ]
30
+ expect(@haproxy_parser.parse_data(haproxy_data)).to eq result_expected
31
+ end
32
+
33
+ it 'returns report for single frontend and single backend with one svname' do
34
+ haproxy_data = File.readlines('./spec/fixtures/parser_haproxy_single_frontend_single_backend_with_single_svname.txt')
35
+ result_expected = [{
36
+ :stats_type => :frontend,
37
+ :name => 'frontend-http',
38
+ :summary => { :svname=>"FRONTEND", :qcur=>nil, :qmax=>nil, :scur=>0, :smax=>3, :slim=>1000, :stot=>1117, :bin=>234633, :bout=>28452829, :hrsp_1xx=>0, :hrsp_2xx=>2, :hrsp_3xx=>57, :hrsp_4xx=>2, :hrsp_5xx=>0, :hrsp_other=>0, :req_tot=>61, :conn_tot=>22}
39
+ },
40
+ {
41
+ :stats_type => :backend,
42
+ :name => 'backend-varnish-ifirma',
43
+ :details => [{ :svname=>"varnishpm02-staging", :qcur=>0, :qmax=>0, :scur=>0, :smax=>2, :slim=>nil, :stot=>1149, :bin=>507182, :bout=>4138662, :hrsp_1xx=>0, :hrsp_2xx=>541, :hrsp_3xx=>31, :hrsp_4xx=>577, :hrsp_5xx=>0, :hrsp_other=>0, :req_tot=>nil, :conn_tot=>nil}],
44
+ },
45
+ ]
46
+ expect(@haproxy_parser.parse_data(haproxy_data)).to eq result_expected
47
+ end
48
+
49
+ it 'returns report for correct data' do
50
+ haproxy_data = File.readlines('./spec/fixtures/parser_haproxy_correct.txt')
51
+ result_expected = [{
52
+ :stats_type => :backend,
53
+ :name => 'backend-varnish',
54
+ :summary => { :svname=>"BACKEND", :qcur=>0, :qmax=>0, :scur=>0, :smax=>4, :slim=>500, :stot=>2301, :bin=>1041031, :bout=>8319027, :hrsp_1xx=>0, :hrsp_2xx=>1096, :hrsp_3xx=>58, :hrsp_4xx=>1147, :hrsp_5xx=>0, :hrsp_other=>0, :req_tot=>2301, :conn_tot=>nil}
55
+ },
56
+ ]
57
+ expect(@haproxy_parser.parse_data(haproxy_data)).to eq result_expected
58
+ end
59
+
60
+ it 'return empty array where input data are corrupted' do
61
+ haproxy_data = File.readlines('./spec/fixtures/parser_haproxy_corrupted.txt')
62
+ empty = Hash.new
63
+ expect(@haproxy_parser.parse_data(haproxy_data)).to eq empty = []
64
+ end
65
+ end
66
+ end
67
+ end
68
+
data/spec/load_spec.rb ADDED
@@ -0,0 +1,21 @@
1
+ describe 'Load' do
2
+ describe 'Parsers' do
3
+ describe 'load parser' do
4
+ before :each do
5
+ Opstat::Plugins.load_parser("load")
6
+ @parser = Opstat::Parsers::Load.new
7
+ end
8
+
9
+ it 'returns report with all parsed params when input data are correct' do
10
+ data = File.readlines('./spec/fixtures/parser_load.txt')
11
+ result_expected = [{:load_1m=>0.0, :load_5m=>0.01, :load_15m=>0.05, :threads_running=>1, :threads=>167}]
12
+ expect(@parser.parse_data(data)).to eq result_expected
13
+ end
14
+
15
+ it 'returns empty array for where input data are corrupted' do
16
+ data = File.readlines('./spec/fixtures/parser_load_corrupted.txt')
17
+ expect(@parser.parse_data(data)).to eq []
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ describe 'Memory' do
2
+ describe 'Parsers' do
3
+ describe 'memory parser' do
4
+ before :each do
5
+ Opstat::Plugins.load_parser("memory")
6
+ @parser = Opstat::Parsers::Memory.new
7
+ end
8
+
9
+ it 'returns report with all parsed params when input data are correct' do
10
+ data = File.readlines('./spec/fixtures/parser_memory.txt')
11
+ result_expected = [{:total=>4110504, :free=>202828, :used=>378472, :cached=>3202196, :buffers=>327008, :swap_total=>0, :swap_free=>0, :swap_used=>0}]
12
+ expect(@parser.parse_data(data)).to eq result_expected
13
+ end
14
+
15
+ it 'returns empty array for where input data are corrupted' do
16
+ data = File.readlines('./spec/fixtures/parser_memory_corrupted.txt')
17
+ expect(@parser.parse_data(data)).to eq []
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ describe 'Network' do
2
+ describe 'Parsers' do
3
+ describe 'network parser' do
4
+ before :each do
5
+ Opstat::Plugins.load_parser("network")
6
+ @parser = Opstat::Parsers::Network.new
7
+ end
8
+
9
+ it 'returns report with all parsed params when input data are correct' do
10
+ data = File.readlines('./spec/fixtures/parser_network.txt')
11
+ result_expected = [{:interface=>"eth0", :bytes_receive=>9358089715, :packets_receive=>14775397, :errors_receive=>0, :drop_receive=>0, :fifo_receive=>0, :frame_receive=>0, :compressed_receive=>0, :multicast_receive=>0, :bytes_transmit=>6464020954, :packets_transmit=>9992120, :errors_transmit=>0, :drop_transmit=>0, :fifo_transmit=>0, :frame_transmit=>0, :compressed_transmit=>0, :multicast_transmit=>0}, {:interface=>"docker0", :bytes_receive=>18218158, :packets_receive=>109291, :errors_receive=>0, :drop_receive=>0, :fifo_receive=>0, :frame_receive=>0, :compressed_receive=>0, :multicast_receive=>0, :bytes_transmit=>367125883, :packets_transmit=>110865, :errors_transmit=>0, :drop_transmit=>0, :fifo_transmit=>0, :frame_transmit=>0, :compressed_transmit=>0, :multicast_transmit=>0}, {:interface=>"lo", :bytes_receive=>4991778180, :packets_receive=>4308431, :errors_receive=>0, :drop_receive=>0, :fifo_receive=>0, :frame_receive=>0, :compressed_receive=>0, :multicast_receive=>0, :bytes_transmit=>4991778180, :packets_transmit=>4308431, :errors_transmit=>0, :drop_transmit=>0, :fifo_transmit=>0, :frame_transmit=>0, :compressed_transmit=>0, :multicast_transmit=>0}]
12
+ expect(@parser.parse_data(data)).to eq result_expected
13
+ end
14
+
15
+ it 'returns empty array for where input data are corrupted' do
16
+ data = File.readlines('./spec/fixtures/parser_network_corrupted.txt')
17
+ expect(@parser.parse_data(data)).to eq []
18
+ end
19
+ end
20
+ end
21
+ end