function get_carp_stats()
{
    global $g;
    global $config;
    if (is_array($config['virtualip']['vip'])) {
        $carpint = 0;
        $initcount = 0;
        $mastercount = 0;
        $backupcount = 0;
        foreach ($config['virtualip']['vip'] as $carp) {
            if ($carp['mode'] != "carp") {
                continue;
            }
            $ipaddress = $carp['subnet'];
            $password = $carp['password'];
            $netmask = $carp['subnet_bits'];
            $vhid = $carp['vhid'];
            $advskew = $carp['advskew'];
            $carp_int = find_carp_interface($ipaddress);
            $status = get_carp_interface_status($carp_int);
            switch ($status) {
                case "MASTER":
                    $mastercount++;
                    break;
                case "BACKUP":
                    $backupcount++;
                    break;
                case "INIT":
                    $initcount++;
                    break;
            }
        }
        $status = "M/B/I {$mastercount}/{$backupcount}/{$initcount}";
    } else {
        $status = "CARP Disabled";
    }
    return $status;
}
					<option value="disabled" <?php 
if (!isset($pconfig['carpdev'])) {
    echo "selected";
}
?>
>
						disabled
					</option>
				<?php 
if (is_array($config['virtualip']['vip'])) {
    foreach ($config['virtualip']['vip'] as $carp) {
        if ($carp['mode'] != "carp") {
            continue;
        }
        $ipaddress = $carp['subnet'];
        $carp_int = trim(find_carp_interface($ipaddress));
        ?>
					<option value="<?php 
        echo $carp_int;
        ?>
"
					 <?php 
        if (isset($pconfig['carpdev']) && $carp_int == $pconfig['carpdev']) {
            echo "selected";
        }
        ?>
>
						<?php 
        echo $carp_int;
        ?>
 (<?php 
function outputled_carp()
{
    /* Returns the status of CARP for the box. 
    		Assumes ALL CARP status are the same for all the intefaces.
    			-1 = CARP Disabled
    			0  = CARP on Backup 
    			1  = CARP on Master */
    global $g;
    global $config;
    if (is_array($config['virtualip']['vip'])) {
        $carpint = 0;
        foreach ($config['virtualip']['vip'] as $carp) {
            if ($carp['mode'] != "carp") {
                continue;
            }
            $carp_int = find_carp_interface($carp['subnet']);
            $status = get_carp_interface_status($carp_int);
            switch ($status) {
                case "MASTER":
                    return 1;
                    break;
                case "BACKUP":
                    return 0;
                    break;
            }
        }
    } else {
        return -1;
    }
}
Example #4
0
					<td class="listhdrr"><b><center>Sanal IP</center></b></td>
					<td class="listhdrr"><b><center>Durum</center></b></td>
				</tr>
<?php 
if (is_array($config['virtualip']['vip'])) {
    $carpint = 0;
    foreach ($config['virtualip']['vip'] as $carp) {
        if ($carp['mode'] != "carp") {
            continue;
        }
        $ipaddress = $carp['subnet'];
        $password = $carp['password'];
        $netmask = $carp['subnet_bits'];
        $vhid = $carp['vhid'];
        $advskew = $carp['advskew'];
        $carp_int = find_carp_interface($ipaddress);
        $status = get_carp_interface_status($carp_int);
        echo "<tr>";
        $align = "valign='middle'";
        if ($carp_enabled == false) {
            $icon = "<img {$align} src='/themes/" . $g['theme'] . "/images/icons/icon_block.gif'>";
            $status = "DISABLED";
            $carp_int = "carp" . $carpint;
        } else {
            if ($status == "MASTER") {
                $icon = "<img {$align} src='/themes/" . $g['theme'] . "/images/icons/icon_pass.gif'>";
            } else {
                if ($status == "BACKUP") {
                    $icon = "<img {$align} src='/themes/" . $g['theme'] . "/images/icons/icon_pass_d.gif'>";
                } else {
                    if ($status == "INIT") {