-
Notifications
You must be signed in to change notification settings - Fork 8
System status #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
vineeshah
wants to merge
16
commits into
master
Choose a base branch
from
system_status
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
System status #32
Changes from 15 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
8cb8591
everything for system status
vineeshah 6b63399
without coin-api
vineeshah 68b44dd
refined code for required promurl
vineeshah da578d9
everything for system status
vineeshah 315cf9e
without coin-api
vineeshah a0acfc5
refined code for required promurl
vineeshah 452d3b6
Merge branch 'system_status' of https://github.com/SCE-Development/mo…
vineeshah b69aa26
combined docker-compose
vineeshah 70e0689
prom container clean-up and common docker file
vineeshah a8eadba
cleaning up and renaming
vineeshah 6597cf7
python formatter applied
vineeshah 37b12c1
used proper logging and other improvements per suggestions
vineeshah 94a8d78
in mondo we trust
vineeshah d24ab57
updated status("success") checking
vineeshah 324ebae
using more .get() to make it safer
vineeshah 80f8533
python fixes
vineeshah File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # filepath: /Users/vineet/Projects/sce_system_status/prom/Dockerfile.scraper | ||
| FROM python:3.9-slim | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| COPY ./status/requirements.txt . | ||
|
|
||
| RUN pip3 install -r requirements.txt | ||
|
|
||
| COPY ./status/flags.py . | ||
|
|
||
| COPY ./status/scraper.py . | ||
|
|
||
| COPY ./status/health.html /app/health.html | ||
|
|
||
| ENTRYPOINT ["python3", "scraper.py"] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| <!DOCTYPE html> | ||
| <html> | ||
| <head> | ||
| <title>Prometheus Metrics</title> | ||
| <style> | ||
| body { | ||
| font-family: 'Roboto', Arial, sans-serif; | ||
| margin: 0; | ||
| padding: 0; | ||
| background-color: #f3f4f6; | ||
| color: #333; | ||
| } | ||
| h1 { | ||
| color: #222; | ||
| font-size: 28px; | ||
| text-align: center; | ||
| margin: 20px 0; | ||
| } | ||
| p { | ||
| text-align: center; | ||
| font-size: 16px; | ||
| color: #555; | ||
| margin-bottom: 20px; | ||
| } | ||
| table { | ||
| border-collapse: collapse; | ||
| width: 90%; | ||
| margin: 0 auto; | ||
| box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1); | ||
| background-color: #fff; | ||
| border-radius: 8px; | ||
| overflow: hidden; | ||
| } | ||
| th, td { | ||
| border: 1px solid #ddd; | ||
| padding: 15px; | ||
| text-align: center; | ||
| } | ||
| th { | ||
| background-color: #007BFF; | ||
| color: white; | ||
| font-size: 18px; | ||
| text-transform: uppercase; | ||
| } | ||
| td { | ||
| font-size: 16px; | ||
| } | ||
| .healthy { | ||
| color: #28a745; | ||
| font-weight: bold; | ||
| } | ||
| .unhealthy { | ||
| color: #dc3545; | ||
| font-weight: bold; | ||
| } | ||
| .tie { | ||
| color: #17a2b8; | ||
| font-weight: bold; | ||
| } | ||
| tr:nth-child(even) { | ||
| background-color: #f8f9fa; | ||
| } | ||
| tr:hover { | ||
| background-color: #e9ecef; | ||
| cursor: pointer; | ||
| } | ||
| footer { | ||
| text-align: center; | ||
| margin-top: 20px; | ||
| font-size: 14px; | ||
| color: #666; | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <h1>Prometheus Metrics</h1> | ||
| <p>Last updated: {{ timestamp }}</p> | ||
| <table> | ||
| <tr> | ||
| <th>Job</th> | ||
| <th>Status</th> | ||
| </tr> | ||
| {% for item in metrics %} | ||
| <tr> | ||
| <td>{{ item.job }}</td> | ||
| <td class="{% if item.status == 'Healthy' %}healthy{% else %}unhealthy{% endif %}"> | ||
| {{ item.status }} | ||
| </td> | ||
| </tr> | ||
| {% endfor %} | ||
| </table> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| [ | ||
| { | ||
| "job-id": "prometheus-aggregation", | ||
| "query": "up" | ||
| } | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| http { | ||
| # Define cache path and parameters | ||
| proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=html_cache:10m max_size=100m inactive=60m; | ||
| proxy_temp_path /var/cache/nginx/temp; | ||
|
|
||
| #for http://localhost/status | ||
| server{ | ||
| listen 80; | ||
| server_name _; | ||
|
|
||
| # Enable caching | ||
| proxy_cache html_cache; | ||
| proxy_cache_valid 200 302 30s; | ||
| proxy_cache_valid 404 30s; | ||
|
|
||
| location /{ | ||
| proxy_pass http://scraper:8000; | ||
|
|
||
| # Cache HTML files | ||
| location ~* \.html$ { | ||
| proxy_pass http://scraper:8000; | ||
| proxy_cache html_cache; | ||
| proxy_cache_min_uses 1; | ||
| proxy_cache_lock on; | ||
| add_header X-Cache-Status $upstream_cache_status; | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| events{ } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| fastapi==0.84.0 | ||
| uvicorn==0.18.3 | ||
| Jinja2==3.0.2 | ||
| py-grpc-prometheus==0.7.0 | ||
| prometheus_api_client==0.4.0 | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.