Answer the question
In order to leave comments, you need to log in
Separation of the "request" and the web page - what is it about?
Hello,
Need more philosophical advice to understand what is at stake. As probably many of those who answered my other questions already understood - I am at an early stage of development in the field of understanding SNMP protocols and computer science in general .. In addition to snmp, I had to start learning PHP as best I could - as a dz I had to write a script that displays the status of a hard disk - how much free space is left and a warning if the percentage of free space exceeds a certain number.
That's what I wrote - everything is fine,
<?php
snmp_set_quick_print(TRUE);
$host='127.0.0.1';
$community='public';
$hddtotal=snmpget($host,$community,'.1.3.6.1.4.1.2021.9.1.6.1');
$hddavail=snmpget($host,$community,'.1.3.6.1.4.1.2021.9.1.7.1');
$hddused=snmpget($host,$community,'.1.3.6.1.4.1.2021.9.1.8.1');
echo "TOTAL size of the disk (in kBytes): ".$hddtotal;
echo "</br>";
echo "Available space on the disk: ".$hddavail;
echo "</br>";
echo "Used space on the disk: ".$hddused;
echo "</br>";
$percentage=round($hddused*100/$hddtotal);
echo "Your machine is currently using about <b>". $percentage."</b>% of total disk space";
echo "<hr>";
$diskleft=100-$percentage;
if ($percentage > 3) {echo "<p> <font color=red>Warning!</font></p> You have only ". $diskleft."% of disk space left!";}
else {echo "Your disk space isn't critical";}
?>
Answer the question
In order to leave comments, you need to log in
Apparently a separate function for requesting input data, a separate SNMP receive function, a separate HTML output function, and a separate function for calling the first, second and third.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question