2024. December 22, Vasárnap, Zéno
Főoldal | Hardver | Szoftver | Tudástár | Árlista | Partnerek | Kapcsolat

Tudástár
 
TERMINAL
Meghajtónév Típus Kapacitás Használt Használt% Szabad
A:\ RemovableDisk 0  MBytes 0  MBytes
   
N/A 0  MBytes
C:\ Label: Serial Number 4c8b68e7 FixedDisk 4 092  MBytes 3 618  MBytes
   
88.42% 474  MBytes
D:\ Label:DATA Serial Number 8cfd08c0 FixedDisk 13 264  MBytes 12 782  MBytes
   
96.37% 482  MBytes
E:\ CompactDisc 0  MBytes 0  MBytes
   
N/A 0  MBytes
F:\ Label:My Disk Serial Number 483bd4 CompactDisc 547  MBytes 547  MBytes
   
100.00% 0  MBytes
G:\ CompactDisc 0  MBytes 0  MBytes
   
N/A 0  MBytes
Virtual Memory VirtualMemory 3 185  MBytes 1 228  MBytes
   
38.55% 1 957  MBytes

 


function sysuptime($ip='10.1.12.2')
{
    $result = str_replace('Timeticks: ','',snmpget($ip,'public','1.3.6.1.2.1.1.3.0'));
    $pos=strpos($result,')');
    $result=substr($result,$pos+1);
    return $result;
}

function freespace($ip='10.1.12.2')
{
    $storageindexes = str_replace('INTEGER: ','',snmpwalk($ip,'public','1.3.6.1.2.1.25.2.3.1.1'));
    $numofdrives=count($storageindexes);
    $result = snmpwalk($ip,'public','1.3.6.1.2.1.25.2.3.1');
   
    foreach ($storageindexes as $act_index)
    {
 // FOLYTATNI
 $asdfg=snmprealwalk($ip,'public','1.3.6.1.2.1.25.2.3.1.2.'.$act_index);
 $drive[$act_index][storagetype]=str_replace('STRING: ','',snmpget($ip,'public','1.3.6.1.2.1.25.2.3.1.3.'.$act_index));
 $drive[$act_index][unit]=str_replace('INTEGER: ','',snmpget($ip,'public','1.3.6.1.2.1.25.2.3.1.4.'.$act_index,10000000,10));
 $drive[$act_index][type]=str_replace('','',snmpget($ip,'public','1.3.6.1.2.1.25.2.3.1.2.'.$act_index,1000000000,10));
     if (strpos( $drive[$act_index][type],'FixedDisk')) $drive[$act_index][type]="FixedDisk";
     if (strpos( $drive[$act_index][type],'RemovableDisk')) $drive[$act_index][type]="RemovableDisk";
     if (strpos( $drive[$act_index][type],'CompactDisc')) $drive[$act_index][type]="CompactDisc";
     if (strpos( $drive[$act_index][type],'VirtualMemory')) $drive[$act_index][type]="VirtualMemory";
     //echo $act_data[type];

 
 
 $drive[$act_index][capacity]=str_replace('INTEGER: ','',snmpget($ip,'public','1.3.6.1.2.1.25.2.3.1.5.'.$act_index));
 $drive[$act_index][usage]=str_replace('INTEGER: ','',snmpget($ip,'public','1.3.6.1.2.1.25.2.3.1.6.'.$act_index));
 if ($drive[$act_index][capacity]) $drive[$act_index][usage_percent]=number_format(($drive[$act_index][usage]/$drive[$act_index][capacity])*100,2,'.',' ')."%";
 else $drive[$act_index][usage_percent]='N/A';
 $drive[$act_index][free]=$drive[$act_index][capacity]-$drive[$act_index][usage];
    }
    return $drive;
   
}

function cpuload($ip='10.1.12.2')
{
    $result = str_replace('INTEGER: ','',snmpwalk($ip,'public','1.3.6.1.2.1.25.3.3.1.2'));
    return $result;
}

function draw_drives($hely,$nm)
{
    echo "<table cellspacing='1' cellpadding='0' style='{ background-color: #aaaaaa; }'>";
 echo "<tr><td class='th' colspan='7' align='center'><b>".$nm."</b></td></tr>";
 echo "<tr>";
     echo "<td width='300' align='center'><b>Meghajtónév</b></td>";
     echo "<td align='center'><b>Típus</b></td>";
     echo "<td align='center'><b>Kapacitás</b></td>";
     echo "<td align='center'><b>Használt</b></td>";
     echo "<td width='200' align='center' colspan='2'><b>Használt%</b></td>";
     echo "<td align='center'><b>Szabad</b></td>";
 echo "</tr>";
    foreach ($hely as $act_index => $act_data)
    {
 echo "<tr>";
 echo "<td>".$act_data[storagetype]."</td>";
 echo "<td>".$act_data[type]."</td>";
 echo "<td align='right'>".number_format(($act_data[capacity]*$act_data[unit])/(1024*1024),0,'.',' ')."&nbsp; MBytes</td>";
 echo "<td align='right'>".number_format(($act_data[usage]*$act_data[unit])/(1024*1024),0,'.',' ')."&nbsp; MBytes</td>";
 echo "<td width='200' style='{ white-space: no-wrap;}'>";
     echo "<table width='100%' cellpadding='0' cellspacing='0'><tr><td width='".$act_data[usage_percent]."' style='{ ";
     if (str_replace('%','',$act_data[usage_percent])>90 && $act_data[type]=='FixedDisk') echo " background-color: red;";
     else  echo " background-color: green;";
     echo "}'>&nbsp;</td><td width='".(100-str_replace('%','',$act_data[usage_percent]))."%'>&nbsp;</td></tr></table>";
     echo "</td><td>".$act_data[usage_percent]."</td>";
        echo "<td align='right'";
 if (($act_data[free]*$act_data[unit])/(1024*1024)<300 && $act_data[capacity]!=0 && $act_data[type]=='FixedDisk') echo " style='{ color: red; font-weight: bold;}'";
 echo ">".number_format(($act_data[free]*$act_data[unit])/(1024*1024),0,'.',' ')."&nbsp; MBytes</td>";
        echo "</tr>";
    }
    echo "</table>";
}