How do I setup auto monitoring for my software raid in Linux

cleverhandle

Diamond Member
Dec 17, 2001
3,566
3
81
I have no experience with mdadm, but Debian-based distros should work this way...

If you've installed the package containing mdadm, then there should be a boot script that checks to see whether to run it or not at boot time. It's probably checking a flag in a file in /etc somewhere, most likely in /etc/sysconfig/defaults. You just need to flip that switch from "off" to "on". You can most likely do this by running dpkg-reconfigure mdadm (or whatever the name of the package is) and seeing if it asks you a question like "Do you want to monitor a RAID array?". If that doesn't get you anywhere, find the boot script in /etc/init.d/ that handles mdadm (probably /etc/init.d/mdadm or something very similar) and see if you can figure out what the script is looking for.

Or wait around for someone who's solved this particular problem on that particular system. But that's the general process...
 

cleverhandle

Diamond Member
Dec 17, 2001
3,566
3
81
Originally posted by: fyleow
Maybe I could write a script that executes on startup that runs that but I have no idea how to do it.
What I'm saying is that it's 99% likely that a script like that is already on the machine, you just need to find the switch to turn it on. If you haven't learned anything about bash scripting yet, now would be a great time to do it. Just look for the mdadm script in /etc/init.d and figure out how it works.

I just tried simulating a drive failure and I'm rebuilding now, but it seems like the drive is being added on as a spare drive and not an active one??
No idea about that part. Could be that the failed device will stay marked as a spare until it's fully rebuilt. But again, I've never really used the Linux md stuff very much.

 

drag

Elite Member
Jul 4, 2002
8,708
0
0
Sorry I wish I could give more help, mail stuff I am very weak at.

But there are monitoring tools that are pretty snazy you can setup for a server. For isntance were I work we use 'Big Brother' which is used to monitor service aviability and such. We use it to monitor everything.. server email space, database stuff, firewalls, windows stuff, Linux stuff, hardware temp monitors, I bet they have something in their to monitor mdadm stuff.

Also in the mdadm.conf there is entries you could put for email alerts and such. Have you looked at that?
man mdadm.conf

Not to helpfull.

Otherwise my initial instinct would be just to setup a cron job to grep the /proc/mdstat file and send a email if a drive goes down, or something like that. Not to helpfull to be sure.
 

cleverhandle

Diamond Member
Dec 17, 2001
3,566
3
81
@Drag - The mailing stuff is built in to mdadm. All the OP needs to know is the Ubuntu/Debian proper way to start mdadm as a daemon at boot time. I'm sure there's a flag for it somewhere, probably set by debconf, but I don't have any experience with the package.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
The next prompt asks me for my email address and if I want to start the automatic monitoring service. I said yes, but I'm not sure if it will run automaticall on startup. I'll try rebooting once my RAID array is done rebuilding.

There's no need to reboot, just make sure that the mdadm service is set to start on bootup and that it does start when you run '/etc/init.d/mdadm start'.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
When I run /etc/init.d/mdadm start it works fine. How do I know or set the mdadm service to start up on bootup?

Most likely the package set it to start up for you, but if you want to verify that it depends on what runlevel you've got the machine booting into. By default Debian (and it's derivatives) boot to runlevel 2 by default, you can verify this by typing '/sbin/runlevel'. Then you look in /etc/rcX.d where X is the runlevel you're in there should be a symlink in there called SXXmdadm pointing to ../init.d/mdadm. The S means start and the XX number is for ordering the scripts.
 

cleverhandle

Diamond Member
Dec 17, 2001
3,566
3
81
Yeah, sounds like it should all be working. Reboot and do a "pgrep mdadm" and you should get a number (the PID) back, showing you that it's running.
 

cleverhandle

Diamond Member
Dec 17, 2001
3,566
3
81
Originally posted by: fyleow
Is it possible to login to a gnome session through console?
The question doesn't really make sense to me. "Console" means a text session and GNOME is a graphical environment. So no, you can't have "GNOME through a console".
I'm going to be running the Linux box headless and I don't want to have to bring a keyboard down there everytime I reboot.
It sounds like what you're really asking is "Can I operate the machine remotely?" That's what SSH is generally used for.
I need to be in gnome so I can have Azureus and other apps running.
If your hosting torrents or something, you should probably use a torrent program that isn't built to be used in an X session. BT used to include a "headless" variant for just that sort of thing.
I tried VNC but you need to login first before it works.
I don't see the problem. You login once via SSH or whatever and start the VNC server.

You could also enable XDMCP on the machine and use another machine's X server to operate. But if you're talking remote management, you should really learn to do things the right way and use SSH.