#!/usr/local/bin/perl # index.cgi # Display all RAID devices require './raid-lib.pl'; # Check if raid is installed if (!-r $config{'mdstat'}) { &error_exit(&text('index_emdstat', "$config{'mdstat'}")); } if (&has_command("mdadm")) { # Using mdadm commands $raid_mode = "mdadm"; } elsif (&has_command('mkraid') && &has_command('raidstart')) { # Using raid tools commands $raid_mode = "raidtools"; } else { &error_exit($text{'index_eprogs'}); } &open_tempfile(MODE, ">$module_config_directory/mode"); &print_tempfile(MODE, $raid_mode,"\n"); &close_tempfile(MODE); &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1, 0, &help_search_link("raid", "man", "doc"), undef, undef, &text('index_'.$raid_mode)); # Display configured raid devices $conf = &get_raidtab(); if (@$conf) { print &ui_columns_start([ $text{'index_name'}, $text{'index_active'}, $text{'index_level'}, $text{'index_members'} ]); foreach $c (@$conf) { $lvl = &find_value('raid-level', $c->{'members'}); @mems = ( ); foreach $d (&find('device', $c->{'members'})) { if (&find('raid-disk', $d->{'members'}) || &find('parity-disk', $d->{'members'})) { push(@mems, $d->{'value'}); } } print &ui_columns_row([ "". &html_escape($c->{'value'})."", $c->{'active'} ? "$text{'yes'}" : "$text{'no'}", $lvl eq 'linear' ? $text{'linear'} : $text{'raid'.$lvl}, join(" ", @mems), ]); } print &ui_columns_end(); } else { print "
$text{'index_none'}
\n"; } &show_button(); # Form for mdadm monitoring options if ($raid_mode eq "mdadm") { $notif = &get_mdadm_notifications(); print "
",@_,"
\n"; &ui_print_footer("/", $text{'index'}); exit; }