Skip to content

Commit f6689ee

Browse files
committed
Fix all scripts per issues reported in ganglia#88
1 parent b085df4 commit f6689ee

10 files changed

Lines changed: 30 additions & 26 deletions

File tree

apache_status/python_modules/apache_status.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@
77
import urllib2
88
import traceback
99
import re
10+
import copy
1011

1112
# global to store state for "total accesses"
1213
METRICS = {
1314
'time' : 0,
1415
'data' : {}
1516
}
1617

17-
LAST_METRICS = dict(METRICS)
18+
LAST_METRICS = copy.deepcopy(METRICS)
1819
METRICS_CACHE_MAX = 5
1920

2021
#Metric prefix
@@ -106,7 +107,7 @@ def get_metrics():
106107
traceback.print_exc()
107108

108109

109-
LAST_METRICS = dict(METRICS)
110+
LAST_METRICS = copy.deepcopy(METRICS)
110111
METRICS = {
111112
'time': time.time(),
112113
'data': metrics

blueeyes_service/python_modules/blueeyes_service.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import os
3131
import re
3232
import time
33+
import copy
3334

3435

3536
PARAMS = {
@@ -43,7 +44,7 @@
4344
'time' : 0,
4445
'data' : {}
4546
}
46-
LAST_METRICS = dict(METRICS)
47+
LAST_METRICS = copy.deepcopy(METRICS)
4748
METRICS_CACHE_TTL = 1
4849

4950

@@ -84,7 +85,7 @@ def get_metrics():
8485
metrics = {}
8586

8687
# update cache
87-
LAST_METRICS = dict(METRICS)
88+
LAST_METRICS = copy.deepcopy(METRICS)
8889
METRICS = {
8990
'time': time.time(),
9091
'data': metrics

mongodb/python_modules/mongodb.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import socket
3232
import string
3333
import time
34-
34+
import copy
3535

3636
NAME_PREFIX = 'mongodb_'
3737
PARAMS = {
@@ -42,7 +42,7 @@
4242
'time' : 0,
4343
'data' : {}
4444
}
45-
LAST_METRICS = dict(METRICS)
45+
LAST_METRICS = copy.deepcopy(METRICS)
4646
METRICS_CACHE_TTL = 3
4747

4848

@@ -85,7 +85,7 @@ def get_metrics():
8585
metrics = {}
8686

8787
# update cache
88-
LAST_METRICS = dict(METRICS)
88+
LAST_METRICS = copy.deepcopy(METRICS)
8989
METRICS = {
9090
'time': time.time(),
9191
'data': metrics

network/conntrack/python_modules/conntrack.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
import os
2929
import time
30-
30+
import copy
3131

3232
NAME_PREFIX = 'conntrack_'
3333
PARAMS = {
@@ -37,7 +37,7 @@
3737
'time' : 0,
3838
'data' : {}
3939
}
40-
LAST_METRICS = dict(METRICS)
40+
LAST_METRICS = copy.deepcopy(METRICS)
4141
METRICS_CACHE_MAX = 5
4242

4343
def create_desc(skel, prop):
@@ -67,7 +67,7 @@ def get_metrics():
6767
metrics[values[0]] = 0
6868

6969
# update cache
70-
LAST_METRICS = dict(METRICS)
70+
LAST_METRICS = copy.deepcopy(METRICS)
7171
METRICS = {
7272
'time': time.time(),
7373
'data': metrics

network/multi_interface/python_modules/multi_interface.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import time
33
import sys
44
import os
5+
import copy
56

67
PARAMS = {}
78

@@ -11,7 +12,7 @@
1112
'time' : 0,
1213
'data' : {}
1314
}
14-
LAST_METRICS = dict(METRICS)
15+
LAST_METRICS = copy.deepcopy(METRICS)
1516
METRICS_CACHE_MAX = 5
1617

1718
INTERFACES = []
@@ -153,7 +154,7 @@ def get_metrics():
153154
metrics[dev_name] = re.split("\s+", a[1].lstrip())
154155

155156
# update cache
156-
LAST_METRICS = dict(METRICS)
157+
LAST_METRICS = copy.deepcopy(METRICS)
157158
METRICS = {
158159
'time': time.time(),
159160
'data': metrics

system/cpu_stats/python_modules/cpu_stats.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44
import re
55
import time
6+
import copy
67

78
METRICS = {
89
'time' : 0,
@@ -23,7 +24,7 @@
2324
'rcu' : 10
2425
}
2526

26-
LAST_METRICS = dict(METRICS)
27+
LAST_METRICS = copy.deepcopy(METRICS)
2728
METRICS_CACHE_MAX = 5
2829

2930

@@ -53,7 +54,7 @@ def get_metrics():
5354
metrics[parts[0]] = list(parts[1:])
5455

5556
# update cache
56-
LAST_METRICS = dict(METRICS)
57+
LAST_METRICS = copy.deepcopy(METRICS)
5758
METRICS = {
5859
'time': time.time(),
5960
'data': metrics

system/mem_fragmentation/python_modules/mem_fragmentation.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import sys
22
import re
33
import time
4+
import copy
45

56
PARAMS = {}
67

@@ -15,7 +16,7 @@
1516

1617
buddyinfo_file = "/proc/buddyinfo"
1718

18-
LAST_METRICS = dict(METRICS)
19+
LAST_METRICS = copy.deepcopy(METRICS)
1920
METRICS_CACHE_MAX = 5
2021

2122
stats_pos = {}
@@ -82,7 +83,7 @@ def get_metrics():
8283

8384
file.close
8485
# update cache
85-
LAST_METRICS = dict(METRICS)
86+
LAST_METRICS = copy.deepcopy(METRICS)
8687
METRICS = {
8788
'time': time.time(),
8889
'data': values

system/vm_stats/python_modules/vm_stats.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import sys
2-
#import traceback
3-
#import os
42
import re
53
import time
4+
import copy
65

76
PARAMS = {}
87

@@ -12,7 +11,7 @@
1211
'time' : 0,
1312
'data' : {}
1413
}
15-
LAST_METRICS = dict(METRICS)
14+
LAST_METRICS = copy.deepcopy(METRICS)
1615
METRICS_CACHE_MAX = 5
1716

1817
###############################################################################
@@ -47,7 +46,7 @@ def get_metrics():
4746
metrics[parts[0]] = parts[1]
4847

4948
# update cache
50-
LAST_METRICS = dict(METRICS)
49+
LAST_METRICS = copy.deepcopy(METRICS)
5150
METRICS = {
5251
'time': time.time(),
5352
'data': metrics

tokyo_tyrant/python_modules/tokyo_tyrant.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
import os
2929
import time
30-
30+
import copy
3131

3232
NAME_PREFIX = 'tokyo_tyrant_'
3333
PARAMS = {
@@ -37,7 +37,7 @@
3737
'time' : 0,
3838
'data' : {}
3939
}
40-
LAST_METRICS = dict(METRICS)
40+
LAST_METRICS = copy.deepcopy(METRICS)
4141
METRICS_CACHE_MAX = 1
4242

4343

@@ -61,7 +61,7 @@ def get_metrics():
6161
metrics[values[0]] = values[1]
6262

6363
# update cache
64-
LAST_METRICS = dict(METRICS)
64+
LAST_METRICS = copy.deepcopy(METRICS)
6565
METRICS = {
6666
'time': time.time(),
6767
'data': metrics

varnish/python_modules/varnish.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
import os
2929
import time
30-
30+
import copy
3131

3232
NAME_PREFIX = 'varnish_'
3333
PARAMS = {
@@ -37,7 +37,7 @@
3737
'time' : 0,
3838
'data' : {}
3939
}
40-
LAST_METRICS = dict(METRICS)
40+
LAST_METRICS = copy.deepcopy(METRICS)
4141
METRICS_CACHE_MAX = 5
4242

4343
def create_desc(skel, prop):
@@ -67,7 +67,7 @@ def get_metrics():
6767
metrics[values[0]] = 0
6868

6969
# update cache
70-
LAST_METRICS = dict(METRICS)
70+
LAST_METRICS = copy.deepcopy(METRICS)
7171
METRICS = {
7272
'time': time.time(),
7373
'data': metrics

0 commit comments

Comments
 (0)