Skip to content

Commit

Permalink
Fix all scripts per issues reported in #88
Browse files Browse the repository at this point in the history
  • Loading branch information
vvuksan committed Oct 17, 2012
1 parent b085df4 commit f6689ee
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 26 deletions.
5 changes: 3 additions & 2 deletions apache_status/python_modules/apache_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
import urllib2
import traceback
import re
import copy

# global to store state for "total accesses"
METRICS = {
'time' : 0,
'data' : {}
}

LAST_METRICS = dict(METRICS)
LAST_METRICS = copy.deepcopy(METRICS)
METRICS_CACHE_MAX = 5

#Metric prefix
Expand Down Expand Up @@ -106,7 +107,7 @@ def get_metrics():
traceback.print_exc()


LAST_METRICS = dict(METRICS)
LAST_METRICS = copy.deepcopy(METRICS)
METRICS = {
'time': time.time(),
'data': metrics
Expand Down
5 changes: 3 additions & 2 deletions blueeyes_service/python_modules/blueeyes_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import os
import re
import time
import copy


PARAMS = {
Expand All @@ -43,7 +44,7 @@
'time' : 0,
'data' : {}
}
LAST_METRICS = dict(METRICS)
LAST_METRICS = copy.deepcopy(METRICS)
METRICS_CACHE_TTL = 1


Expand Down Expand Up @@ -84,7 +85,7 @@ def get_metrics():
metrics = {}

# update cache
LAST_METRICS = dict(METRICS)
LAST_METRICS = copy.deepcopy(METRICS)
METRICS = {
'time': time.time(),
'data': metrics
Expand Down
6 changes: 3 additions & 3 deletions mongodb/python_modules/mongodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import socket
import string
import time

import copy

NAME_PREFIX = 'mongodb_'
PARAMS = {
Expand All @@ -42,7 +42,7 @@
'time' : 0,
'data' : {}
}
LAST_METRICS = dict(METRICS)
LAST_METRICS = copy.deepcopy(METRICS)
METRICS_CACHE_TTL = 3


Expand Down Expand Up @@ -85,7 +85,7 @@ def get_metrics():
metrics = {}

# update cache
LAST_METRICS = dict(METRICS)
LAST_METRICS = copy.deepcopy(METRICS)
METRICS = {
'time': time.time(),
'data': metrics
Expand Down
6 changes: 3 additions & 3 deletions network/conntrack/python_modules/conntrack.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

import os
import time

import copy

NAME_PREFIX = 'conntrack_'
PARAMS = {
Expand All @@ -37,7 +37,7 @@
'time' : 0,
'data' : {}
}
LAST_METRICS = dict(METRICS)
LAST_METRICS = copy.deepcopy(METRICS)
METRICS_CACHE_MAX = 5

def create_desc(skel, prop):
Expand Down Expand Up @@ -67,7 +67,7 @@ def get_metrics():
metrics[values[0]] = 0

# update cache
LAST_METRICS = dict(METRICS)
LAST_METRICS = copy.deepcopy(METRICS)
METRICS = {
'time': time.time(),
'data': metrics
Expand Down
5 changes: 3 additions & 2 deletions network/multi_interface/python_modules/multi_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import time
import sys
import os
import copy

PARAMS = {}

Expand All @@ -11,7 +12,7 @@
'time' : 0,
'data' : {}
}
LAST_METRICS = dict(METRICS)
LAST_METRICS = copy.deepcopy(METRICS)
METRICS_CACHE_MAX = 5

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

# update cache
LAST_METRICS = dict(METRICS)
LAST_METRICS = copy.deepcopy(METRICS)
METRICS = {
'time': time.time(),
'data': metrics
Expand Down
5 changes: 3 additions & 2 deletions system/cpu_stats/python_modules/cpu_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import re
import time
import copy

METRICS = {
'time' : 0,
Expand All @@ -23,7 +24,7 @@
'rcu' : 10
}

LAST_METRICS = dict(METRICS)
LAST_METRICS = copy.deepcopy(METRICS)
METRICS_CACHE_MAX = 5


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

# update cache
LAST_METRICS = dict(METRICS)
LAST_METRICS = copy.deepcopy(METRICS)
METRICS = {
'time': time.time(),
'data': metrics
Expand Down
5 changes: 3 additions & 2 deletions system/mem_fragmentation/python_modules/mem_fragmentation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import sys
import re
import time
import copy

PARAMS = {}

Expand All @@ -15,7 +16,7 @@

buddyinfo_file = "/proc/buddyinfo"

LAST_METRICS = dict(METRICS)
LAST_METRICS = copy.deepcopy(METRICS)
METRICS_CACHE_MAX = 5

stats_pos = {}
Expand Down Expand Up @@ -82,7 +83,7 @@ def get_metrics():

file.close
# update cache
LAST_METRICS = dict(METRICS)
LAST_METRICS = copy.deepcopy(METRICS)
METRICS = {
'time': time.time(),
'data': values
Expand Down
7 changes: 3 additions & 4 deletions system/vm_stats/python_modules/vm_stats.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import sys
#import traceback
#import os
import re
import time
import copy

PARAMS = {}

Expand All @@ -12,7 +11,7 @@
'time' : 0,
'data' : {}
}
LAST_METRICS = dict(METRICS)
LAST_METRICS = copy.deepcopy(METRICS)
METRICS_CACHE_MAX = 5

###############################################################################
Expand Down Expand Up @@ -47,7 +46,7 @@ def get_metrics():
metrics[parts[0]] = parts[1]

# update cache
LAST_METRICS = dict(METRICS)
LAST_METRICS = copy.deepcopy(METRICS)
METRICS = {
'time': time.time(),
'data': metrics
Expand Down
6 changes: 3 additions & 3 deletions tokyo_tyrant/python_modules/tokyo_tyrant.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

import os
import time

import copy

NAME_PREFIX = 'tokyo_tyrant_'
PARAMS = {
Expand All @@ -37,7 +37,7 @@
'time' : 0,
'data' : {}
}
LAST_METRICS = dict(METRICS)
LAST_METRICS = copy.deepcopy(METRICS)
METRICS_CACHE_MAX = 1


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

# update cache
LAST_METRICS = dict(METRICS)
LAST_METRICS = copy.deepcopy(METRICS)
METRICS = {
'time': time.time(),
'data': metrics
Expand Down
6 changes: 3 additions & 3 deletions varnish/python_modules/varnish.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

import os
import time

import copy

NAME_PREFIX = 'varnish_'
PARAMS = {
Expand All @@ -37,7 +37,7 @@
'time' : 0,
'data' : {}
}
LAST_METRICS = dict(METRICS)
LAST_METRICS = copy.deepcopy(METRICS)
METRICS_CACHE_MAX = 5

def create_desc(skel, prop):
Expand Down Expand Up @@ -67,7 +67,7 @@ def get_metrics():
metrics[values[0]] = 0

# update cache
LAST_METRICS = dict(METRICS)
LAST_METRICS = copy.deepcopy(METRICS)
METRICS = {
'time': time.time(),
'data': metrics
Expand Down

0 comments on commit f6689ee

Please sign in to comment.