Mango Emailing System Log Files
-
Hi,
I'm having my Ubuntu system do a remote backup of my tomcat directory and am wondering if there is a way to have Mango email the log file that is created after the backup is complete?
Thanks,
Joel. -
Hi
How are you doing the back up?
I was using the timed events but as these only have a 15 sec time out they are not well suited to backups.
I run a cron job every 1am to do some system maintainence (delete tomcat logs, backup etc)
You can then get Cron to email you the log file
I do use mango to monitor the number of log files etc to make sure that the job is running (if we get more than 30 then it the job probably has failed)
by the way I use www.spideroak.com as the backup - free (2GB), easy and simple
Just back up a couple of key files (DERBY for example)
Francis
-
I'm using a cron job and rsync to back up to rsync.net but I'm thinking about changing this and use a scheduled event in mango to start the process.
I'd love it if you could share some specifics on how you have a cron job email the report. do you have a mail server set up on the server or are you using an external smtp server?
Also, I'd love to know how mango can monitor the number of log files, that is a really good idea.
Thanks,
Joel. -
HI
For Cron read: http://www.unixgeeks.org/security/newbie/unix/cron-1.html
For monitoring the system I have created a couple of JSPs called & processed by mango retreiver
Disk space
<%@ page import="java.io.*" %> <HTML> <BODY> <% Process proc=Runtime.getRuntime().exec("df -h "); proc.waitFor(); String str=null ; BufferedReader read=new BufferedReader(new InputStreamReader(proc.getInputStream())); while(read.ready()) { str=(read.readLine()); if (str.startsWith("/dev")) {out.println(str); } } %> </BODY> </HTML>
Log file count
<%@ page import="java.io.*" %> <HTML> <BODY> <% Process proc=Runtime.getRuntime().exec("ls /usr/local/tomcat/logs -al "); proc.waitFor(); Integer i =0; BufferedReader read=new BufferedReader(new InputStreamReader(proc.getInputStream())); while(read.ready()) { i = i + 1 ; read.readLine(); } out.println("Files=" + i + "x"); %> </BODY> </HTML>
-
Hi Francis,
I'll read through that info on cron but it looks like the best I've seen so far.
I don't mean to sound stupid but where do you place the code you posted here? I may have some learning to do on this but it sounds like some important things for me to know.
Thanks again,
Joel.
-
So, I think i understand that you make a file like disk.jsp with the code you posed below. They you put that file onto the server and use the http receiver to get the data it displays.
So now my question is: where on the server is the best place to put the file and what do you put into the URL on the retriever? or correct me if this is all wrong. :)
Thanks,
Joel. -
Hi
you have most of it right :D
I created a directory unde ther mango app on tomcat called "FrancisScripts" and placed them in there
Make sure you have a backup of it in case when you do a Mango upgrade you forget and delete the whole of the Mango app
Francis
-
Thanks, I'm running linux and always forget to check the permissions. I just needed to give the right read/write properties to the file and it works perfect.
Thanks,
Joel.