This commit is contained in:
parent
83f71b3f81
commit
a5d3b13629
@ -7,22 +7,7 @@ IMAGE_NAME=numberimage
|
||||
docker build --progress=plain -t $IMAGE_NAME .
|
||||
|
||||
|
||||
SECRETS=`mktemp`
|
||||
gpg --decrypt --passphrase $GPG_PASSPHRASE --yes --batch --output $SECRETS ./deployment/secrets.asc
|
||||
. $SECRETS
|
||||
rm $SECRETS
|
||||
|
||||
DB_NAMESPACE=database1
|
||||
DB_DEPLOYNAME=database
|
||||
|
||||
REDIS_NAMESPACE=redis
|
||||
REDIS_SERVICE_NAME=redis
|
||||
|
||||
PGHOST=`kubectl get services $DB_DEPLOYNAME -n $DB_NAMESPACE -o jsonpath="{.status.loadBalancer.ingress[0].ip}"`
|
||||
REDISHOST=`kubectl get services $REDIS_SERVICE_NAME -n $REDIS_NAMESPACE -o jsonpath="{.status.loadBalancer.ingress[0].ip}"`
|
||||
|
||||
REDIS_URL=redis://$REDISHOST:6379/4
|
||||
|
||||
. load-debug-env
|
||||
|
||||
docker run \
|
||||
-it \
|
||||
|
15
load-debug-env
Normal file
15
load-debug-env
Normal file
@ -0,0 +1,15 @@
|
||||
SECRETS=`mktemp`
|
||||
gpg --decrypt --passphrase $GPG_PASSPHRASE --yes --batch --output $SECRETS ./deployment/secrets.asc
|
||||
. $SECRETS
|
||||
rm $SECRETS
|
||||
|
||||
DB_NAMESPACE=database1
|
||||
DB_DEPLOYNAME=database
|
||||
|
||||
REDIS_NAMESPACE=redis
|
||||
REDIS_SERVICE_NAME=redis
|
||||
|
||||
PGHOST=`kubectl get services $DB_DEPLOYNAME -n $DB_NAMESPACE -o jsonpath="{.status.loadBalancer.ingress[0].ip}"`
|
||||
REDISHOST=`kubectl get services $REDIS_SERVICE_NAME -n $REDIS_NAMESPACE -o jsonpath="{.status.loadBalancer.ingress[0].ip}"`
|
||||
|
||||
REDIS_URL=redis://$REDISHOST:6379/4
|
@ -4,6 +4,8 @@ import json
|
||||
import plotly.express as px
|
||||
import plotly.graph_objects as po
|
||||
import matplotlib.pyplot as plt
|
||||
import matplotlib.dates as mdates
|
||||
from matplotlib.ticker import ScalarFormatter
|
||||
import pandas as pd
|
||||
import psycopg
|
||||
import sqlalchemy
|
||||
@ -131,13 +133,16 @@ def plot_png():
|
||||
max(cast(values->'stratum'->>'value' as int)) as stratum
|
||||
from measurements
|
||||
where time >= date_trunc('day', now()) AND time < date_trunc('day', now()) + '1 day'::interval and
|
||||
application = 'TSM' and attributes->>'Label' = 'david'
|
||||
application = 'SNMP' and attributes->>'Label' = 'harrison'
|
||||
group by bucket, device
|
||||
order by bucket, device
|
||||
"""
|
||||
df = pd.read_sql(query, con=engine)
|
||||
df['rootdisp'] = df['rootdisp'] / 1e6
|
||||
|
||||
fig, ax1 = plt.subplots()
|
||||
plot_date = df['bucket'].dt.date.iloc[0] if not df.empty else "Unknown Date"
|
||||
|
||||
fig, ax1 = plt.subplots(figsize=(10,5))
|
||||
|
||||
ax1.plot(df['bucket'], df['rootdisp'], 'r-', label='Root Dispersion')
|
||||
ax1.set_xlabel('Time')
|
||||
@ -150,9 +155,12 @@ def plot_png():
|
||||
ax2.tick_params(axis='y', labelcolor='b')
|
||||
ax2.set_yticks(range(int(df['stratum'].min()), int(df['stratum'].max()) + 1))
|
||||
|
||||
fig.suptitle('NTP Server Numbers')
|
||||
fig.suptitle(f"harrison - {plot_date}")
|
||||
fig.tight_layout()
|
||||
|
||||
ax1.xaxis.set_major_formatter(mdates.DateFormatter('%H:%M'))
|
||||
fig.autofmt_xdate(rotation=45)
|
||||
|
||||
img_io = io.BytesIO()
|
||||
plt.savefig(img_io, format='png')
|
||||
img_io.seek(0)
|
||||
|
@ -10,7 +10,7 @@ import ntp_routes
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(port=8080)
|
||||
app.run(host='0.0.0.0', port=8080)
|
||||
else:
|
||||
exposed_app = ProxyFix(app, x_for=1, x_host=1)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user