Skip to content

Commit

Permalink
update to latest
Browse files Browse the repository at this point in the history
Signed-off-by: Scott Trent <[email protected]>
  • Loading branch information
trent-s committed Oct 28, 2024
1 parent 1d4fc7a commit 3a98ae1
Show file tree
Hide file tree
Showing 14 changed files with 80 additions and 30 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ temp-prometheus.yaml
c3-susql-config.yaml
nohup.out
.env
node_modules
4 changes: 2 additions & 2 deletions samples/impact-framework/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Using SusQL with the Green Software Foundation's Impact Framework

A large design point in using SusQL data with the Green Software Foundation's
Impact Framework is whether to run in a container ON the cluster, or run on a machine
external to the cluster.
Impact Framework is whether to run in a container ON the cluster with SusQL, or run
on a machine external to the cluster.

This directory contains two directories with experiments into both approaches:

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
experimentation...
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: prometheus importer test
description: simple susql demo invoking prometheus-importer plugin
tags: null
initialize:
plugins:
prometheus-importer:
method: PrometheusImporter
path: 'https://github.com/Shivani-G/prometheus-importer'
global-config:
step: '1h'
start: '2024-09-16T23:50:30.000Z'
end: '2024-10-16T00:00:30.000Z'
query: 'rate(susql_container_joules_total)[1m])'
metricLabels:
- name
metricName: 'energy'
defaultLabels:
duration: 3600
cloud/vendor: 'ibm'
cloud/instance-type: 'medium'
outputs:
- yaml
tree:
children:
child:
pipeline:
- prometheus-importer
inputs:
20 changes: 20 additions & 0 deletions samples/impact-framework/offClusterApproach/.trent/pi1/steps.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# in this directory
npm init -y
npm install -g husky
npm install -g @grnsft/if
# npm remove -g "https://github.com/trent-s/prometheus-importer"
npm remove -g prometheus-importer
npm remove prometheus-importer
npm install -g "https://github.com/Shivani-G/prometheus-importer"
npm update
echo "BEARER_TOKEN="$(oc whoami -t) >.env
echo HOST=https://$(oc get routes -n openshift-monitoring thanos-querier -o jsonpath='{.status.ingress[0].host}') >>.env
if-run --manifest pi1test.yaml --debug




## troubleshootign
# npm cache verify
# npm install npm@latest -g

15 changes: 11 additions & 4 deletions samples/impact-framework/offClusterApproach/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
# Using SusQL with the Green Software Foundation's Impact Framework

This particular experiment was performed using a recent RHEL 9 x86 machine,
however, any OS that supports a sufficiently recent version of nodejs should
however, any OS that supports a sufficiently recent version of `nodejs` should
work in principle.

The key to importing data from SusQL is a Prometheus Importer Plugin for the GSF Impact Framework.
Currently there are two such plugins described in the (IF Explorer)[https://explorer.if.greensoftware.foundation]:
- (`Prometheus Importer`)[https://github.com/andreic94/if-prometheus-importer/blob/main/README.md] by `andreic94`, et al.
- (`prometheus-importer`)[https://github.com/Shivani-G/prometheus-importer/blob/main/README.md] by `Shibani-G`.

The following is an approach using the later plugin:

### steps
- Ensure that you are logged into your cluster and can use the `oc` (or `kubectl` command).
- Make sure that a recent version of `node` is installed. (This test used v22.9.0)
- Install Impact Framework
- `npm install -g @grnsft/if`
- Install Prometheus Importer
- `npm install -g "https://github.com/trent-s/prometheus-importer"`
- Update, just to be sure:
- `npm install -g "https://github.com/Shivani-G/prometheus-importer"`
- Update, just to be sure: (Starting from the directory that contains this README...)
- `cd test; npm update; cd -`

- Create required credential file, and attempt to use prometheus-importer:
- Create required credential file, and attempt to use prometheus-importer: (Starting from the directory that contains this README...)
```
cd test
echo "BEARER_TOKEN="$(oc whoami -t) >.env
Expand Down
2 changes: 1 addition & 1 deletion samples/impact-framework/offClusterApproach/ptest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ initialize:
plugins:
prometheus-importer:
method: PrometheusImporter
path: 'https://github.com/trent-s/prometheus-importer'
path: 'https://github.com/Shivani-G/prometheus-importer'
config:
step: '1h'
start: '2024-09-16T23:50:30.000Z'
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"license": "ISC",
"description": "",
"dependencies": {
"prometheus-importer": "github:trent-s/prometheus-importer"
"prometheus-importer": "github:Shivani-G/prometheus-importer"
}
}
18 changes: 2 additions & 16 deletions samples/impact-framework/onClusterApproach/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,6 @@ npm install -g [email protected] && \
echo " --- Finished node update" && \
npm install -g typescript rimraf husky @grnsft/if && \
echo " --- Finished if install" && \
# npm install -g @types/node && \
# echo " --- Finished @types/node install" && \
# git clone https://github.com/Green-Software-Foundation/if.git && cd if && npm install -g && npm install && npm link && cd - && \
# echo " --- Finished IF npm link" && \
# npm install -g "https://github.com/trent-s/prometheus-importer" && \
# echo " --- Finished PI install" && \
# git clone https://github.com/trent-s/prometheus-importer.git && cd prometheus-importer && \
# npm install --save-dev @types/node && npm run build && npm install -g && npm install && npm link && cd - && \
# echo " --- Finished cloning PI" && \
# npm install -g "https://github.com/trent-s/hello-plugin" && \
# git clone https://github.com/trent-s/hello-plugin.git && cd hello-plugin && \
# npm install --save-dev @types/node && npm run build && npm install -g && npm install && npm link && cd - && \
# cd if && npm link hello-plugin && cd - && \
# echo " --- Finished cloning and initializing hello-plugin" && \
# cd if && npm link prometheus-importer && cd - && \
# echo " --- Finished last link " && \
npm install -g "https://github.com/Shivani-G/prometheus-importer" && \
echo " --- Finished PI install" && \
chown -R 1000:1000 /work /usr/local/
9 changes: 8 additions & 1 deletion samples/impact-framework/onClusterApproach/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ Green Software Foundation's Impact Framework using a slightly modified version
of the PrometheusImporter plugin. The fundamental focus of this particular
approach is to run entirely on Cluster, and is based on OpenShift.

The key to importing data from SusQL is a Prometheus Importer Plugin for the GSF Impact Framework.
Currently there are two such plugins described in the (IF Explorer)[https://explorer.if.greensoftware.foundation]:
- (`Prometheus Importer`)[https://github.com/andreic94/if-prometheus-importer/blob/main/README.md] by `andreic94`, et al.
- (`prometheus-importer`)[https://github.com/Shivani-G/prometheus-importer/blob/main/README.md] by `Shibani-G`.

This approach uses the later plugin.

However, this is a work in progress related to an apparent limitation
in the use of certain required nodejs functionality within a container.
in the use of certain required global`nodejs` functionality within a container.

### Using prebuilt container image:
- Ensure that you are logged into your cluster, then start the Impact Framework container: `oc apply -f impact-framework.yaml`
Expand Down
2 changes: 1 addition & 1 deletion samples/impact-framework/onClusterApproach/ptest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ initialize:
plugins:
prometheus-importer:
method: PrometheusImporter
path: 'https://github.com/trent-s/prometheus-importer'
path: 'https://github.com/Shivani-G/prometheus-importer'
config:
step: '1h'
start: '2024-09-16T23:50:30.000Z'
Expand Down

0 comments on commit 3a98ae1

Please sign in to comment.