The "best" approach is a real monitoring system that attempts to connect to the FTP server (Nagios, OpenNMS, InterMapper, etc.) -- or a third party remote solution (there are lots of those too).
There's a historical question with answers that basically list a whole bunch of tools which might be useful, and if you pick one that looks like it meets your needs we can probably help you with any questions you may have about implementation details.
Your solution is certainly "Good Enough" as a fast fix -- I would prefer to check the return status of
lftp (see the man page for a list of possible return codes), but checking a log file is adequate too.
Two other suggestions to improve what you have:
- Remember to delete the log file, and check that it exists as part of your script
If the log file doesn't exist something failed spectacularly, which is a different problem than the server being down.
- Parse the log and include that info in your message.
Having the server be down is obviously a different problem than the username/password not working, and you probably want to handle it differently.