grufocom / vee-mail Goto Github PK
View Code? Open in Web Editor NEWSimple Script to get Mails from Free Veeam Agent for Linux
License: GNU Affero General Public License v3.0
Simple Script to get Mails from Free Veeam Agent for Linux
License: GNU Affero General Public License v3.0
root@xyz:/# /opt/vee-mail/vee-mail.sh
sed: -e Ausdruck #28, Zeichen 25: Nicht beendeter »s«-Befehl
Is it possible this script could be modified to work with healthchecks or similar APIs that take a HTTP request, as they are useful in ensuring that an email was sent. Healthchecks works with emails as well but doing it through CURL remains the email element.
System:
Debian 10.11
I´m using msmtp for sending mails with vee-mail after a veeam Backup Job. The Mail gets transmitted, but there ist no Text inside the Mail. The subject of the Mail is correct. I placed all the downloaded Files on /root/vee-mail. Do I have to place the Template somewhere else? or maybe msmtp is not supported?
Dependencies are all installed.
Hello.
More of a suggestion than an issue.
I found this: https://github.com/st3root/VeeamFreeAgentDashboard
Could it (rewritten maybe) be an addon to vee-mail?
Or maybe a dual mode for vee-mail (sending mail like it does today vs writing to a central API/DB to display results on a web page)?
Hello, i tried to add more than one address into the EMAILTO var but its not working. I tried to do a workaround cloning vee-mail.sh and vee-mail.config and changing the EMAILTO var for the second script. Next, i create a script "main" to execute both .sh sequentially like:
vee-mail.sh && vee-mail2.sh
this works sometimes and sometimes not. And don't know why. Any ideas?
Hi,
I need to send the mail directly to an internal SMTP server.
I've found that curl can send mail directly using the same file format you implemented.
I replaced the sendmail call by this line :
curl --url 'smtp://192.168.X.X:25' --mail-from $EMAILFROM --mail-rcpt $EMAILTO --upload-file $TEMPFILE
--ssl-reqd
option allows usage of TLS
--user 'username:password'
option allows authentication
etc
Do you still want to keep sendmail? If yes, are you interested in a Pull Request with a configuration allowing usage of curl instead of sendmail?
Hi, I find vee-mail to be a great tool to augment Veeam on Linux. I noticed though that for some reason once in a while the script fails. Then I get a warning in Veeam log (as post-script failed to execute) and no email to even know about it. It is most likely some intermittent issue either with SMTP server or something else as I can get the email just fine if I rerun the script manually later.
So I though it would be great if the script would support retries to deal with intermittent issues. Something like specifying number of retries and delay between retries in the config, and then the script attempts to do exactly the same thing as it does now, but if it fails for any reason it will retry a few times as per config.
Maybe you can help.
Backup fails with executing the script:
Executing post-job script
11:52:11 [error] Failed to perform backup
11:52:11 [error] * Line 1, Column 1 Syntax error: Malformed token
11:52:11 [error] Processing finished with errors at 2023-03-17 10:52:11 UTC
The config file has no field to specify SMTP server, which is essential to be able to send mail on systems where sendmail is not installed. Anonymous on port 25 would be a good start. If it's possible to add that it would be a life saver for those of us who are under a company policy to not have sendmail on any system.
Hi, i generate random password for smb user but special character seems block, when i regenerate another one to test, thats work how can i add support of all special character.
For your information i had these : \ + # ^ ; .
During curl implementation, I did my tests using smtp4dev server to check and debug.
I'm trying to deploy it to my first machine and send mail to outlook.com.
Mails arrives but body is empty.
I've found similar case here : https://curl.se/mail/archive-2017-06/0022.html
It seems that the generated file doesn't respect RFC and need some CRLF
After upgrading veeam from v5.0.2.4567 to v6.0.0.1060 the script produces the following error:
Error: in prepare, no such column: start_time (1)
/data/scripts/vee-mail.sh: line 193: [: -gt: unary operator expected
/data/scripts/vee-mail.sh: line 209: [: : integer expression expected
/data/scripts/vee-mail.sh: line 212: [: : integer expression expected
/data/scripts/vee-mail.sh: line 215: [: : integer expression expected
/data/scripts/vee-mail.sh: line 218: [: : integer expression expected
date: invalid date ‘@’
date: invalid date ‘@’
date: invalid date ‘@’
date: invalid date ‘@’
Failed to convert [023-02-1] to UUID.
Hello,
I would really appreciate a feature where i can specify the log level for notification mails. (e.g only send mail on error or warning log level and not on success log level)
Regards
I recently re-installed an Ubuntu machine that had backups taken by veeam Agent and the status emails were sent by vee-mail -worked like a charm. However, after reinstalling, the vee-mail script always gives the following error message and sends an empty email:
sed: -e expression #27, char 21: unterminated `s' command
The dependencies are installed, the script is run with sudo and the debug output is as follows:
user@ubuntu:/opt/vee-mail$ sudo ./vee-mail.sh -bg
STARTTIME: 1606398767, ENDTIME: 1606398771, STATE: 6, JOBID: {00000000-0000-0000-0000-000000000000}
DETAILS: <ProgressDetails total_size="0" total_used_size="0" processed_data_size_bytes="0" read_data_size_bytes="0" transferred_data_size_bytes="0" processing_speed="0" source_read_load="0" source_processing_load="0" network_load="0" target_write_load="0" network_throttling_enabled="false" repository_throttling_enabled="false" />
TARGET: , FST: , LOGIN: , DOMAIN:
PROCESSED: 0 GB, READ: 0 GB, TRANSFERRED: 0
SPEED: 0, SOURCELOAD: 0, NETLOAD: 0, TARGETLOAD: 0
DURATION: 00:00:04, START: Thursday, 26 November 2020 13:52:47, END: Thursday, 26.11.2020 13:52:51, STIME: 13:52:47, ETIME: 13:52:51
ERRLOG:
HN: UBUNTU
STAT: Success
BGCOLOR: #00B050
START: Thursday, 26 November 2020 13:52:47
SUCCESS: 1
ERROR: 0
WARNING: 0
STIME: 13:52:47
ETIME: 13:52:51
READ: 0 GB
TRANSFERRED: 0 MB
DURATION: 00:00:04
PROCESSED: 0 GB
BOTTLENECK:
ERRLOG:
SPEED: 0
TARGET:
FST:
LOGIN:
DOMAIN:
DEVUSEP: Use%
0%
1%
25%
0%
0%
0%
100%
100%
100%
100%
100%
100%
100%
9%
69%
7%
4%
7%
13%
25%
25%
25%
25%
25%
25%
25%
25%
25%
25%
0%
0%
sed: -e expression #27, char 21: unterminated `s' command
The last backup jobs have not in fact taken 4 seconds as indicated above but ~5 minutes as indicated by ´sudo veeam´. Also, it terminated with ´State: Warning´ instead of Success
as listed here.
Any idea what could cause this? Using 0.5.26 by the way.
Beim Speichern auf einem SMB-Share wird der Speicherplatz nicht angezeigt (0.5.27). Der Debug-Modus zeigt, dass $FST den Wert "smb" und nicht "cifs" enthält.
IMHO, if debug is enabled, the script should not go into background (line 125).
Also, with current code, the last debug display (lines 199 to 202) won't work, because script goes in backgound.
Suggested solution is to add a test line 125.
Before : if [ ! "$1" == "--bg" ]; then
After : if [ ! "$1" == "--bg" ] && [ $DEBUG == 0 ]; then
With debug enabled, CLI result before:
STARTTIME: 1598712674, ENDTIME: 1598717672, STATE: 6, JOBID: {ff36576d-82e8-4ce9-bfb3-6a851d325f80}
DETAILS: <ProgressDetails total_size="171793088000" total_used_size="123613915136" processed_data_size_bytes="125104893952" read_data_size_bytes="124324413440" transferred_data_size_bytes="60974703532" processing_speed="27753283" source_read_load="87" source_processing_load="19" network_load="0" target_write_load="12" network_throttling_enabled="false" repository_throttling_enabled="false" />
TARGET: 192.168.XXX.YYY:/mnt/Backup/server.domain.tld, FST: nfs, LOGIN: , DOMAIN:
After:
STARTTIME: 1598712674, ENDTIME: 1598717672, STATE: 6, JOBID: {ff36576d-82e8-4ce9-bfb3-6a851d325f80}
DETAILS: <ProgressDetails total_size="171793088000" total_used_size="123613915136" processed_data_size_bytes="125104893952" read_data_size_bytes="124324413440" transferred_data_size_bytes="60974703532" processing_speed="27753283" source_read_load="87" source_processing_load="19" network_load="0" target_write_load="12" network_throttling_enabled="false" repository_throttling_enabled="false" />
TARGET: 192.168.XXX.YYY:/mnt/Backup/server.domain.tld, FST: nfs, LOGIN: , DOMAIN:
PROCESSED: 116.5 GB, READ: 115.7 GB, TRANSFERRED: 60974703532
SPEED: 26.4, SOURCELOAD: 87, NETLOAD: 0, TARGETLOAD: 12
DURATION: 01:23:18, START: Saturday, 29 August 2020 16:51:14, END: Saturday, 29.08.2020 18:14:32, STIME: 16:51:14, ETIME: 18:14:32
ERRLOG:
HN: server.domain.tld
STAT: Success
BGCOLOR: #00B050
START: Saturday, 29 August 2020 16:51:14
SUCCESS: 1
ERROR: 0
WARNING: 0
STIME: 16:51:14
ETIME: 18:14:32
READ: 115.7 GB
TRANSFERRED: 56.7 GB
DURATION: 01:23:18
PROCESSED: 116.5 GB
BOTTLENECK: Source
ERRLOG:
SPEED: 26.4
TARGET: 192.168.XXX.YYY:/mnt/Backup/server.domain.tld
FST: nfs
LOGIN:
DOMAIN:
sed: -e expression #30, char 19: unknown option to `s'
The last line (that ends up with a blank email except the headers) is explained in #3
I would like to run vee-mail from a veeam post-job script with command 'sh /opt/vee-mail/vee-mail.sh' at 1st line (sh is symlinked to bash shell)
but seems that job infos are not catched correctly:
vee-mail: DURATION: , START: Friday, 13 May 2022 09:09:06, END: Thursday, 01.01.1970 01:00:00, STIME: 09:09:06, ETIME: 01:00:00
I always get 1/1/1970 end date and e-mail is not sent.
If i run vee-mail directly as a post-job script it runs fine.
thanks a lot
Hin und wieder habe ich das Problem, das keine Mails versendet werden. In unregelmäßigen, regelmäßigen Abständen erfolgt kein E-Mail Versand, obwohl das Backup gelaufen ist, mittlerweile kann ich schon fast sagen, zwei Backups läuft alles wie gehabt, spätestens beim vierten lief das Backup zwar, aber es wurde keine Mail rausgeschickt. In dem Skript gibt es die Variable
SENDM=0
die an unterschiedlichen Stellen auf 1 gesetzt wird. Ich habe sie zum Testen global auf eins gesetzt und bekomme jetzt immer eine Benachrichtigung per E-Mail. Allerdings wird manchmal nur das Template, ohne weitere Werte, versendet, daß werden wahrscheinlich die sein Zustände sein, wo sonst keine Mail verschickt wird. Schaue ich in das Backup rein, lief es durch.
Hat jemand eine Idee, woran das liegen könnte?
Hello, me again 8)
I've tried vee-mail with CentOS6 and I had issues.
The first one is about sqlite: needed version is 3.7 while the OS version is 3.6.
Maybe you could add is in the readme file?
Work around is simple: download sqlite3.7 and set it up.
What I did:
yum -y install glibc.i686 zlib.i686
Second issue is about the template: I'm getting a blank mail (but headers).
After digging in debug mode (see #4), I ended up with finding a sed error: sed: -e expression #30, char 19: unknown option to
s'`
It's about the last expression, it seems to be related to sed 4.2.1 and expression (because of the percentage in the remplacement).
I don't have a work around (yet) for this.
If you remove the last expression, the email is OK except the Disk Use% (not replaced).
Plain SMTP without auth and encryption in many cases impossible and not secure, so to send mail need to handle something like this:
if [ $SENDM -eq 1 ]; then
$SENDEMAIL -f $SMTPUSR -xu $SMTPUSR -xp $SMTPPWD -s $SMTPSRV:$SMTPPRT -u "[$STAT] $HN - $START" -t $EMAILTO -o tls=$SMTPTLS < $TEMPFILE
fi
in this case need adjust also build email to zero at start:
# build email
echo "" > $TEMPFILE
sendemail
not installed out of the box so bash script missing install of it, as well addition dependency: libio-socket-ssl-perl
to handle StartTLS, and of course adjust config template with new variables.
Hi, hab auf Linux Mint 21.1 veeam frisch installiert und würde gerne dein Skript nutzen für Mail Benachrichtigungen.
Veeam ist installiert und funktioniert, leider kommt beim Aufruf der vee-mail.sh nur folgende ausgabe:
stefan@Stefan-Mint:~$ sudo sh /opt/vee-mail/vee-mail.sh
[sudo] Passwort für stefan:
/opt/vee-mail/vee-mail.sh: 15: [[: not found
/opt/vee-mail/vee-mail.sh: 24: [: unexpected operator
/opt/vee-mail/vee-mail.sh: 95: Bad substitution
Hallo,
nachdem ich das Skript erfolgreich ausführen kann, erhalte ich leider keine Mail. Ich nutze Curl.
Ich habe im Skript die Curl Zeile durch geprüft und die Mail kommt an, solange ich als "-upload-file" eine test.txt nutze.
Sobald die $TEMPFILE Variable ins Spiel kommt, erhalte ich keine Mail mehr.
Wenn ich im Skript echo $TEMPFILE ausgeben lasse und das "rm $TEMPFILE" entferne, erhalte ich einen Pfad "/tmp/tmp.4tvRKnyZQF"
Hier ist auch der E-Mail Body hinterlegt der gut aussieht.
Hier die Datei - für den Upload hier habe ich .TXT ergänzt
tmp.4tvRKnyZQF.TXT
Hier die Ausgabe des Terminals inkl. Debug aktiviert.
stefan@Stefan-Mint:~$ cd /opt/vee-mail/
stefan@Stefan-Mint:/opt/vee-mail$ sudo bash vee-mail.sh
[sudo] Passwort für stefan:
STARTTIME: 1685903412, ENDTIME: 1685904231, STATE: 6, JOBID: {ca22e6d0-4633-4e77-adb3-1fdf55b9c687}, JOBNAME: Stefan-Mint-Veeam-Backup
DETAILS:
TARGET: 192.168.9.91/backup, FST: smb, LOGIN: Backup, DOMAIN: nas1
PROCESSED: 52.9 GB, READ: 52.9 GB, TRANSFERRED: 9107451712
SPEED: 91.7, SOURCELOAD: 0, NETLOAD: 0, TARGETLOAD: 79
DURATION: 0:13:39, START: Sonntag, 04 Juni 2023 20:30:12, END: Sonntag, 04.06.2023 20:43:51, STIME: 20:30:12, ETIME: 20:43:51
ERRLOG:
HN: STEFAN-MINT
STAT: Success
BGCOLOR: #00B050
START: Sonntag, 04 Juni 2023 20:30:12
SUCCESS: 1
ERROR: 0
WARNING: 0
STIME: 20:30:12
ETIME: 20:43:51
READ: 52.9 GB
TRANSFERRED: 8.5 GB
DURATION: 0:13:39
PROCESSED: 52.9 GB
BOTTLENECK: Target
ERRLOG:
SPEED: 91.7
TARGET: 192.168.9.91/backup
FST: smb
LOGIN: Backup
DOMAIN: nas1
DEVUSEP: 38%
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 218k 0 0 100 218k 0 473k --:--:-- --:--:-- --:--:-- 474k
/tmp/tmp.4tvRKnyZQF
Hello !
i configured the script on my Debian Strech. I configured Exim4 and email are send without any error but when i execute the script, i have just that :
root@PTCDEB-PROXY:/opt/vee-mail# bash vee-mail.sh STARTTIME: 1597870801, ENDTIME: 1597870862, STATE: 6, JOBID: {a0a3cd38-1b39-4b28-86ef-95b7231cf62d} DETAILS: <ProgressDetails total_size="17176723456" total_used_size="5232717824" processed_data_size_bytes="5232717824" read_data_size_bytes="4972347392" transferred_data_size_bytes="26472492" processing_speed="114856033" source_read_load="78" source_processing_load="88" network_load="0" target_write_load="88" network_throttling_enabled="false" repository_throttling_enabled="false" /> TARGET: 192.168.0.100/home, FST: cifs, LOGIN: veeam, DOMAIN: root@PTCDEB-PROXY:/opt/vee-mail#
What's wrong? Seems that it can read data from the job but after that, nothing.
I modified DEBUG to 1 in config and in the vee-mail.sh but i don't have more information.
All script is copied in /opt/vee-mail/
Thank you!
I have 5 NAS based on OMV (OpenMediaVault) with the latest version of Veeam Agent installed.
With the new release of vee-mail (0.5.46) i have a strange issue.
With 2 NAS all works perfectly; after every backup one mail is sent with the results.
With 3 NAS no mail is sent.
The configuration of the script in the 5 NAS is exactly the same; same mail but different "JOBNAME"
With "/opt/vee-mail/vee-mail.sh" from terminal, i receive a mail from every NAS without problems.
Removing e reinstalling the Veeam Agent doesn't resolve.
Is not a permission issue; alla NAS has the same configuration and the same version of OMV installed.
Any ideas?
Good afternoon.
I am running the latest version of veeam on ubuntu lts. I have configured the script to use Curl to send which it is working when i test with the following sudo ./vee-mail.sh
However it will not send using post in Veeam.
please assist in any way
Thank you.
I get this notification at the end of every mail, even though I am running a newer version.
Any ideas why this happens?
If have updated to version 0.5.38. Now I always get the following message as last line in the e-mail: "Veeam Agent for Linux v5.0.2.4567, Vee-Mail Version 0.5.38 (new Vee-Mail version 0.5.38 available)".
Since 0.5.38 ist the latest version this seems to be wrong.
Mail are not sent with utf-8 support, so mail reader will not be able to display some caracter.
Here is a small diff file of what i do for everything's working
vee-mail-utf8.txt
In email, duration's time is wrong when it is bigger than 24h.
I've updated from 0.5.12 to 0.5.17 and found that for my NFS backup target the fields Disk used, Disk avail, and Disk used % are empty. This used to work with 0.5.12.
Also the update check says "Vee-Mail Version 0.5.17 (new Veeam-Mail version 0.5.16 available)", which is purely cosmetic, obviously.
Running on Debian Buster 10.5 (2 Proxmox PVE Servers)
Regards,
Alex
Hello.
I've made a quick try of the script on an Ubuntu 18.04 server.
Veeam Agent was setup to backup to /veeam, that is an NFS mount to another server.
It was setup to a "Local destination" not to a "Shared folder".
It seems the scripts sees the NFS mount and tries to mount it (as a tmp folder).
This gives an error:
mount.nfs: remote share not in 'host:dir' format
umount: /tmp/tmp.7aXngP8vHa: not mounted.
It tries to mount the target (/veeam) as a source for the tmp-mount.
This doesn't work, hence the error.
After changing the configuration of the backup (to a shared folder) in the configuration, no more error.
Backup is scheduled for tonight, I'll check if it still works correctly (with the shared folder) and if I'm getting the whole stats.
Hello,
i configured Veeam ton execute the script at the end of the backup but in this case, it's not complete with color, success message
If i launch the vee-mail.sh manually :
I tried using the cron but never work and i think it's better to launch it from veam to have the report directly at the end.
Any idea? Thank you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.