Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit e132ff1b authored by Antoine Blanquet's avatar Antoine Blanquet
Browse files

Trying Sending mail without Sparkline working. Getting mail from file config

parent 3b3a3a99
......@@ -7,11 +7,14 @@
# Parse getaways and send reports to owners by email
# ------------------------------------------------
# DATA REPOSITORY
DATA_GAT_FOLDER="data/gateways/"
rm .mails.csv
GWIDS=$(jq --raw-output ".result | sort_by(.lastSeenAt, .id) | reverse [] | (.id)" .gateways.json)
for GWID in $GWIDS
do
node ./parse_gateway.js .gateway-${GWID}.json >> .mails.csv
node ./parse_gateway.js ${DATA_GAT_FOLDER}.gateway-${GWID}.json >> .mails.csv
done
......
......@@ -4,7 +4,6 @@ const fs = require('fs');
const moment = require('moment');
var now = new Date();
try {
const data = fs.readFileSync(argv[2], 'utf8');
......@@ -20,7 +19,7 @@ try {
var name = g.gateway.name;
var owner_email = g.gateway.tags.owner_email;
var owner_email_cc = d.device.tags.owner_email_cc;
var owner_email_cc = d.device.tags.owner_email_cc; //todo : get device (d doesn't exist)
var lastSeenAt = g.lastSeenAt;
......
......@@ -6,14 +6,16 @@
# crontab entry
# TODO /bin/bash
# TODO get TO for the .config.json
#TO="XX.XX@univ-grenoble-alpes.fr YY.YY@univ-grenoble-alpes.fr"
TO="kevyung24@gmail.com"
# DATA REPOSITORY
DATA_CONFIG_FOLDER="data/configuration/"
TO=$(jq --raw-output ".report_email_to" ${DATA_CONFIG_FOLDER}.config.json)
SUBJECT="Monitoring Report"
CONTENT_TYPE="Content-type: text/html"
#mail -a "$CONTENT_TYPE" -s "$SUBJECT" -u monitoring $TO <.gateways.html
#mail -a "$CONTENT_TYPE" -s "$SUBJECT" -u monitoring $TO <.devices.html
mail -a "$CONTENT_TYPE" -s "$SUBJECT" -u monitoring $TO <.gateways.html
mail -a "$CONTENT_TYPE" -s "$SUBJECT" -u monitoring $TO <.devices.html
# mailx -a "$CONTENT_TYPE" -s "$SUBJECT" <.gateways.html "$TO"
mailx -a "$CONTENT_TYPE" -s "$SUBJECT" <.gateways.html "$TO"
#mail -s "Test" kevyung24@gmail.com
\ No newline at end of file
echo "mail sended"
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment