NAUbackup / VmBackup

XenServer simple backup script
228 stars 62 forks source link

Impossible to send email notification #71

Closed Romu007 closed 6 years ago

Romu007 commented 6 years ago

Hello all,

i recently downloaded your script to backup my VMs and thanks a lot for your work.

But when I'm trying to configure the mail notification, i have this error at the end of the script :

Exception: socket.error - (97, 'Address family not supported by protocol')

Do you have any idea please ?

Thanks a lot for your help Romu

Romu007 commented 6 years ago

le output log :

Exception: socket.error - (97, 'Address family not supported by protocol') Exception: socket.error - (97, 'Address family not supported by protocol') ^C 2018-04-21-(11:00:27) - ERROR EXCEPTION - exceptions.KeyboardInterrupt 2018-04-21-(11:00:27) - ERROR NOTE: see VmBackup output for details Traceback (most recent call last): File "/home/XenServer-SDK/XenServerPython/backup_test.py", line 1495, in ? main(session) File "/home/XenServer-SDK/XenServerPython/backup_test.py", line 490, in main send_email(MAIL_TO_ADDR,'WARNING VmBackup.py', status_log) File "/home/XenServer-SDK/XenServerPython/backup_test.py", line 877, in send_email s = smtplib.SMTP(MAIL_SMTP_SERVER) File "/usr/lib/python2.4/smtplib.py", line 244, in init (code, msg) = self.connect(host, port) File "/usr/lib/python2.4/smtplib.py", line 297, in connect self.sock.connect(sa) File "", line 1, in connect KeyboardInterrupt

NAUbackup commented 6 years ago

Hi, Romu... Did you look at the README file as to an example of how and where to define the SMPT mail server? What have you put in? Is that mail server even reachable from your XenServer host (you can try to telnet to port 25 of it as a test)? Regards, --Tobias

VARGA-Peter commented 6 years ago

Does this help you?

MCVE for email check

Romu007 commented 6 years ago

Hello guys,

it seems that i can't use SSL with the version of my python

python

Python 2.4.3 (#1, Sep 21 2011, 20:06:00) [GCC 4.1.2 20080704 (Red Hat 4.1.2-51)] on linux2

i have to update the python's version .

Do you have any other idea ?

Also, Albundy, i have an error when i'm trying to send with your link :

python testmailromu.py Traceback (most recent call last): File "testmailromu.py", line 94, in ? send_email('romuald.bouvard@hotmail.fr', 'Test-Email VmBackup.py', status_log) File "testmailromu.py", line 90, in send_email print("Exception: SMTPException - %s" %e.message) AttributeError: SMTPServerDisconnected instance has no attribute 'message'

NAUbackup commented 6 years ago

There should be a much newer version on your XenServer -- 2.7.5 on XS 7.X which runs the Linux kernel 4.4.0. What version of XenServer is this? Before early version of XS 6.X, this script is not going to work as it requires a reasonable new version of python to run, so your suspicion is probably correct.

VARGA-Peter commented 6 years ago

Look Romu007,

I am not a Python programmer. I extracted the test script from the existing VmBackup.py in order I can find out very convenient the correct SMTP settings for my Exchange server and test, if it does accept the relay.

Now, it is your task to play around and sort everything out. The script works and when you get errors you have to comment/uncomment/edit the 4 lines until you receive an email. Sorry, I can't do more for you.

NAUbackup commented 6 years ago

There is a section in the code that explains how to do the modifications for making it possible to do TLS connections. Note that Exchange is a beast when it comes to using it to relay email and that -- as Peter says above -- is well beyond the scope of the forum and applies to any utility that needs to be customized to connect to an email server, no matter what kind of email server it is. This is a local configuration issue. It took me a long time, for example, just to figure out how to get the Thunderbird email client to work with exchange, and this is really no different. Finally, very old version of XenServer will likely not work because python is to old and those older version of XenServer will not be supported. Early XS 6.X versions are already end-of-lifed.

--Tobias

NAUbackup commented 6 years ago

I am closing this thread.