Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Projets-INFO4
20-21
18
chirpstack-monitoring
Commits
e132ff1b
Commit
e132ff1b
authored
Apr 05, 2021
by
Antoine Blanquet
Browse files
Trying Sending mail without Sparkline working. Getting mail from file config
parent
3b3a3a99
Changes
3
Hide whitespace changes
Inline
Side-by-side
reports/mail_to_gateways_owners.sh
View file @
e132ff1b
...
...
@@ -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
...
...
reports/parse_gateway.js
View file @
e132ff1b
...
...
@@ -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
;
...
...
reports/sendmail_reports.sh
View file @
e132ff1b
...
...
@@ -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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment