Skip to content

Fix typo, indentation issues and issue in documentation #2

@andreaskaris

Description

@andreaskaris
[akaris@linux ocp]$ git diff
diff --git a/ocp/README.md b/ocp/README.md
index 3efaf6d..4851060 100644
--- a/ocp/README.md
+++ b/ocp/README.md
@@ -6,7 +6,7 @@ If you do not have a graphite instance already running, this is how you can get
 # sudo as port 80 is a protected port
 sudo podman run -d  --name graphite \
  --restart=always \
- -v ./storage-schemas.conf \
+ -v /tmp/storage-schemas.conf:/opt/graphite/conf/storage-schemas.conf:z \
  -p 80:80 \
  -p 2003-2004:2003-2004 \
  -p 2023-2024:2023-2024 \
diff --git a/ocp/export_node_metrics.py b/ocp/export_node_metrics.py
index 2a00e05..f0ad90e 100644
--- a/ocp/export_node_metrics.py
+++ b/ocp/export_node_metrics.py
@@ -117,7 +117,7 @@ for metricName in metricNames:
     if metricName[0:4] != 'node':
         continue
     # note(mmethot): the double curly brackets is to escape those otherwise format tries to interpret
-    print("INFO: Qerying - {}".format('{metric}{{instance="{host}"}}{t}'.format(metric=metricName, host=select_host, t=timeRange)))
+    print("INFO: Querying - {}".format('{metric}{{instance="{host}"}}{t}'.format(metric=metricName, host=select_host, t=timeRange)))
     response = requests.get('{0}/api/v1/query'.format(url), verify=False, headers=HEADERS,
             params={'query': '{metric}{{instance="{host}"}}{t}'.format(metric=metricName, host=select_host, t=timeRange)})
 
diff --git a/ocp/import_metrics_to_graphite.py b/ocp/import_metrics_to_graphite.py
index f9da5b6..b6db6a5 100644
--- a/ocp/import_metrics_to_graphite.py
+++ b/ocp/import_metrics_to_graphite.py
@@ -37,28 +37,28 @@ for f in os.listdir(dataDir):
     if f[len(f)-8:] != '.json.gz':
         continue
     else:
+        print("Loading file: {}".format(f))
         lines = gzip.open('{rootDir}/{jsonFile}'.format(rootDir=dataDir, jsonFile=f), 'r').readlines()
         # Note(mmethot): Assuming there will always only one line
         data = json.loads(lines[0])
 
-
-# For graphite dot entries we'll want something unique
-uniques = []
-for d in data['data']['result']:
-    for i in d['metric']:
-        uniques.append((i, d['metric'][i].replace('/', '_')))
-
-entries = set(uniques)
-
-for e in entries:
-    counter = uniques.count(e)
-    if counter > 1:
-        for i in range(counter):
-            uniques.remove(e)
-
-serverName = dataDir[dataDir.find('_')+1:dataDir.rfind('_')].replace('.', '_')
-# TODO: Multithread this step otherwise it takes very long on large sets
-for d in data['data']['result']:
-    for v in d['values']:
-        sendMsg('{}.{}.{} {} {}\n'.format(serverName, uniques[0][0], d['metric'][uniques[0][0]], v[1], int(v[0])))
-        sleep(DELAY)
+        # For graphite dot entries we'll want something unique
+        uniques = []
+        for d in data['data']['result']:
+            for i in d['metric']:
+                uniques.append((i, d['metric'][i].replace('/', '_')))
+        
+        entries = set(uniques)
+        
+        for e in entries:
+            counter = uniques.count(e)
+            if counter > 1:
+                for i in range(counter):
+                    uniques.remove(e)
+        
+        serverName = dataDir[dataDir.find('_')+1:dataDir.rfind('_')].replace('.', '_')
+        # TODO: Multithread this step otherwise it takes very long on large sets
+        for d in data['data']['result']:
+            for v in d['values']:
+                sendMsg('{}.{}.{} {} {}\n'.format(serverName, uniques[0][0], d['metric'][uniques[0][0]], v[1], int(v[0])))
+                sleep(DELAY)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions