How to Warn Via Email Whenever Virtualbox VM Takes a Dump?
I have an Apache Mirror running on a VirtualBox VM and it occasionally stops serving web pages and stops updating its content via rsync. I know this because I get an e-mail from Apache telling me the content of the mirror is 3 days old and then I type up the address of my web site and it fails to load.
On the web server I type: #service httpd status #httpd is dead ***I'm typing that response from memory, but there's more to it and I'll edit this to correct when I see it next-- something extremely brief about being dead but still having children or threads or subprocesses... Why this is happening I have my suspicions and will wait til later to pursue. For now, I need a method of knowing more quickly (same day, within minutes, preferably) when my web server is down, not after 3 days. I would like to handle this warning internally, without reliance on anyone else. Ideally, I'd like the host to see that the VM shut down, and immediately send me an e-mail. Better yet, have the VM recognize that httpd just died and initialize a script to restart httpd? How do I get the VM to see httpd is dead and initiate a daemon restart? Or is an e-mail the best I can hope for? Bonus points if the answer involves my writing a script in Python, which I'm trying to learn right now. |
Quote:
Quote:
|
unSpawn has a food suggestion. I've done something similar with Webmin monitoring and alerting me of issues as well as restarting services.
|
Quote:
I understand what you're saying but how to uncover other symptoms that would point to a cause. The VM seems fine, it's just that httpd dies. My logs in /var/log/httpd only go up to 2/11/13. I also have email logs from Logwatch, but neither is saying anything I recognize as a clue. Are there particular things I should grep for in the logs? Where else should I look? I'm setting up Monit now. |
Quote:
In the case of I.) You've got three major leads: 0) the Virtual Box server and client log files on the Virtual Box host, 1) the guest system and log files and 2) whatever configuration and logs its web stack has or produces. If the Virtual Box server and client logs don't hold any clues you could make it log more (debug mode if possible) in the hope it could reveal something. If over time these (after all you said it happens occasionally) logs don't show anything worthy of investigation you could then draw the conclusion the "outer layer" is OK. Then you would move on to the VB guest and start assessing like you would any regular system: is all software (including whatever runs in the web stack) up to date? Is file system integrity intact? Any unwanted subsystems or processes running? Does it run (any form of) SAR to produce resource usage stats over time? (If you don't run that you should, I described a few tools tersely here.) In what way does its (web stack) configuration deviate from the standard and for what reason? And the same goes here: if log files don't hold clues make it log more so you can draw the conclusion it's OK or not. In the case of II.) you could for example start by checking for the (approximate) first time you experienced outage and look at what software or system / service configuration changed around that time. (I keep a time stamped admin log so I can read back major changes and I have all configuration under revision control so I can revert back for diagnostics or in case of error) Or you could start with the process itself: Quote:
Quote:
Quote:
|
Today upon arriving home I found that the VM state is 'aborted.' I haven't looked through logs yet-- will post more when I have a chance to do so.
Restarted the VM and httpd started up just fine on its own. Web site is accessible again. Here are two concerns about VirtualBox: (1) There's an update available but yum fails to update (yes, I shut down VirtualBox when I tried to update) (2) There's a warning about the filesystem format (ext4) which may cause problems for VirtualBox I tried to update VirtualBox manually, using: rpm -ivh VirtualBox... .rpm "File [ ... ] conflicts with [ ... ] It fails to update from 4.1.4... to 4.2.4... Right now I am creating a clone of my Apache Mirror VM file and will uninstall VirtualBox and reinstall per https://forums.virtualbox.org/viewtopic.php?f=7&t=52605 which suggests I have a fork and to fix the update problem like thus. Will update when finished cloning, uninstalling and reinstalling VirtualBox. |
That certainly sounds like VirtualBox issue if the status of the VM was "Aborted"
|
Quote:
I know what I'm saying sounds contradictory, i.e., VM is fine, process dies, then I typed that the VM was down, 'aborted' state-- but that's the reality of the symptoms, which may indicate multiple causes or a changing problem. |
I'm trying to uninstall VirtualBox so that I can install a newer version, as this might be what's causing the problem. Unfortunately I can't locate the uninstall file mentioned in the VirtualBox manual. Manual uninstall is not explained in the manual/not applicable, so any suggestions of how to remove VirtualBox would be greatly appreciated as I try to track down the steps elsewhere.
I wanted to download a tar.gz for the version I have installed in the hopes that I can extract the uninstaller file from it, but there are only rpms available... Synopsis: When I try to install the latest version of VirtualBox, I get many "conflicts with ..." errors between my installed version and the new version. Where to go from here? |
How was VB installed originally? If by the package manager then use the package manager to remove, the same goes for an RPM package if installed via RPM you should be able to remove it via the package manager as well.
|
Before you update or remove I would list the contents of the package and the %scripts section because I vaguely remember long time ago when I installed Virtual Box it needed mess with kernel modules. If there are no stock ones for your kernel it may compile them and then they won't be removed when you update the package and with the listings you can check that. Else just post the stdout / stderr your upgrade causes preferably in vBB code tags?
|
I didn't recall how VB was installed, so I typed:
Code:
#yum remove VirtualBox |
(Side Note:)
Quote:
Code:
The virtual machine execution may run into an error condition as described below. We suggest that you take an appropriate action to avert the error. Quote:
Quote:
Quote:
Quote:
Quote:
Apache tells me on 2-12-13 warning mirror content is 3 days old--- last successful probe 2-10-13 3:48. 2-10-13 16:29 I see a tag Romanian Black Hat calling itself ZmEu after a Romanian mythological figure that kidnaps and rapes young girls... that spells issues with primary caregiver(s.) All I see are rudimentary exploit attempts involving phpmyadmin, which I don't use anyway. Apache is still serving pages until 2-11-13 22:55, and I don't see anything unusual outside of the Romanian rapist(s). Quote:
|
No failure of the web server and/or the VM yet... meanwhile I'll start a separate thread w/other questions semi-related to the above
|
Quote:
*The benefit of running a capable SAR is that you will be able to determine the effect of some of the tuning you do. Don't change configuration, sysctls or turn other knobs because some (misinformed, outdated) web log says so: to measure is to know and IMHO that's the only reasonable approach. Quote:
Quote:
Quote:
|
All times are GMT -5. The time now is 01:00 AM. |