Add stats dashboard screenshots #3
1
.env.example
Normal file
1
.env.example
Normal file
@ -0,0 +1 @@
|
|||||||
|
ES_TOKEN = ""
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,6 @@
|
|||||||
credentials.info
|
credentials.info
|
||||||
html/.htpasswd
|
html/.htpasswd
|
||||||
html/.htaccess
|
html/.htaccess
|
||||||
|
.env
|
||||||
|
geckodriver.log
|
||||||
|
html/ressources/stats
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<hr>
|
<hr>
|
||||||
<p id="menu"><a href="index.php" title="https://www.gnous.fr/">Accueil</a>
|
<p id="menu"><a href="index.php" title="https://www.gnous.fr/">Accueil</a>
|
||||||
| <a href="apropos.php" title="https://www.gnous.fr/apropos.php">À propos</a>
|
| <a href="apropos.php" title="https://www.gnous.fr/apropos.php">À propos</a>
|
||||||
|
| <a href="stats.php" title="https://www.gnous.fr/stats.php">Statistiques</a>
|
||||||
| <a href="https://mattermost.gnous.fr/" target="_blank" title="https://mattermost.gnous.fr/ (nouvel onglet)">Mattermost</a>
|
| <a href="https://mattermost.gnous.fr/" target="_blank" title="https://mattermost.gnous.fr/ (nouvel onglet)">Mattermost</a>
|
||||||
| <a href="https://cloud.gnous.fr/" target="_blank" title="https://cloud.gnous.fr/ (nouvel onglet)">Nextcloud</a>
|
| <a href="https://cloud.gnous.fr/" target="_blank" title="https://cloud.gnous.fr/ (nouvel onglet)">Nextcloud</a>
|
||||||
| <a href="https://travaux.gnous.fr/" target="_blank" title="https://travaux.gnous.fr/ (nouvel onglet)">Travaux</a>
|
| <a href="https://travaux.gnous.fr/" target="_blank" title="https://travaux.gnous.fr/ (nouvel onglet)">Travaux</a>
|
||||||
|
49
html/stats.php
Normal file
49
html/stats.php
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
$this_file = basename($_SERVER["SCRIPT_FILENAME"]);
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<HEAD>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Statistiques</title>
|
||||||
|
<link rel="SHORTCUT ICON" HREF="ressources/logo.svg">
|
||||||
|
<style>
|
||||||
|
img {
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</HEAD>
|
||||||
|
|
||||||
|
<BODY>
|
||||||
|
<CENTER>
|
||||||
|
<?php include 'includes/titre.php'; ?>
|
||||||
|
<i>Cette page vous donne les éléments nécessaires pour pouvoir entrer en contact avec GNOUS de manière sécurisée.</i><br><br>
|
||||||
|
<?php include 'includes/menu.php'; ?>
|
||||||
|
</CENTER>
|
||||||
|
<?php include 'includes/mtime.php'; ?>
|
||||||
|
|
||||||
|
<h2 id=mm>Mattermost</h2>
|
||||||
|
<h3>Dernières 24h</h3>
|
||||||
|
<a href="/ressources/stats/mm24h.png" target="_blank"><img src="ressources/stats/mm24h.png"></a><br>
|
||||||
|
<h3>Dernière semaine</h3>
|
||||||
|
<a href="/ressources/stats/mm7d.png" target="_blank"><img src="ressources/stats/mm7d.png"></a><br>
|
||||||
|
<h3>Dernier mois</h3>
|
||||||
|
<a href="/ressources/stats/mm1M.png" target="_blank"><img src="ressources/stats/mm1M.png"></a><br>
|
||||||
|
<h3>Dernière année</h3>
|
||||||
|
<a href="/ressources/stats/mm1y.png" target="_blank"><img src="ressources/stats/mm1y.png"></a><br>
|
||||||
|
|
||||||
|
<h2 id=nc>Nextcloud</h2>
|
||||||
|
<h3>Dernières 24h</h3>
|
||||||
|
<a href="/ressources/stats/nc24h.png" target="_blank"><img src="ressources/stats/nc24h.png"></a><br>
|
||||||
|
<h3>Dernière semaine</h3>
|
||||||
|
<a href="/ressources/stats/nc7d.png" target="_blank"><img src="ressources/stats/nc7d.png"></a><br>
|
||||||
|
<h3>Dernier mois</h3>
|
||||||
|
<a href="/ressources/stats/nc1M.png" target="_blank"><img src="ressources/stats/nc1M.png"></a><br>
|
||||||
|
<h3>Dernière année</h3>
|
||||||
|
<a href="/ressources/stats/nc1y.png" target="_blank"><img src="ressources/stats/nc1y.png"></a><br>
|
||||||
|
|
||||||
|
<?php include 'includes/footer.php'; ?>
|
||||||
|
</BODY>
|
||||||
|
</HTML>
|
33
print_stats.py
Executable file
33
print_stats.py
Executable file
@ -0,0 +1,33 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import os
|
||||||
|
from time import sleep
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
from seleniumwire import webdriver
|
||||||
|
from seleniumwire.webdriver import FirefoxOptions
|
||||||
|
|
||||||
|
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
opts = FirefoxOptions()
|
||||||
|
opts.add_argument("--headless")
|
||||||
|
browser = webdriver.Firefox(options=opts,executable_path="/usr/local/bin/geckodriver")
|
||||||
|
browser.set_window_size(3000, 1120)
|
||||||
|
|
||||||
|
def interceptor(request):
|
||||||
|
request.headers['Authorization'] = 'Basic '+os.environ["ES_TOKEN"]
|
||||||
|
browser.request_interceptor = interceptor
|
||||||
|
|
||||||
|
for duration in ["24h", "7d", "1M", "1y"]:
|
||||||
|
browser.get("https://mon.gnous.fr/app/dashboards#/view/380099d0-4944-11ec-81a9-95d7ffa23468?embed=true&_g=(filters%3A!()%2CrefreshInterval%3A(pause%3A!t%2Cvalue%3A0)%2Ctime%3A(from%3Anow-"+duration+"%2Cto%3Anow))&hide-filter-bar=true")
|
||||||
|
sleep(30)
|
||||||
|
if duration == "24h":
|
||||||
|
sleep(15)
|
||||||
|
browser.get_screenshot_as_file("html/ressources/stats/mm"+duration+".png")
|
||||||
|
|
||||||
|
for duration in ["24h", "7d", "1M", "1y"]:
|
||||||
|
browser.get("https://mon.gnous.fr/app/dashboards#/view/ef70de60-4947-11ec-81a9-95d7ffa23468?embed=true&_g=(filters%3A!()%2CrefreshInterval%3A(pause%3A!t%2Cvalue%3A0)%2Ctime%3A(from%3Anow-"+duration+"%2Cto%3Anow))&hide-filter-bar=true")
|
||||||
|
sleep(30)
|
||||||
|
browser.get_screenshot_as_file("html/ressources/stats/nc"+duration+".png")
|
||||||
|
|
||||||
|
print('done')
|
Loading…
Reference in New Issue
Block a user