I'm not sure. Using the "Test" button you should be getting something
like:
 
[/]: 0.33GB of 0.98GB (33.5%) || [/boot]: 0.02GB of 0.12GB (13.7%) ||
[/home]: 0.00GB of 0.09GB (4.2%) || [/opt]: 0.53GB of 2.95GB (17.9%) ||
[/oracle]: 0.03GB of 0.98GB (3.2%) || [/stage]: 0.03GB of 1.97GB (1.6%)
|| [/u]: 0.03GB of 4.81GB (0.7%) || [/usr]: 0.99GB of 1.97GB (50.3%) ||
[/var]: 0.10GB of 1.97GB (5.2%)
 
You are getting "[false]" where I'm getting the drive names. 
 
Check the instances at 1.3.6.1.2.1.25.2.3.1.3 to see if they are the
same as the script. Hmm.,.. Maybe I have a mib installed that you don't
have. Actually, I'll bet that's what the problem is. :(      See if you
have
.iso.org.dod.internet.mgmt.mib-2.host.hrStorage.hrStorageTable.hrStorage
Entry (1.3.6.1.2.1.25.2.3). If not, I'm not sure what the mib is. I have
some notes that show that I've installed 10892.mib, RFC1158-MIB, and
RFC-1212 but I don't know if they are the missing link or even if my
notes are up-to-date with what mib's have been installed.

________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Wednesday, October 29, 2008 12:24 PM
To: [email protected]
Subject: RE: [WhatsUp Forum] Active Script Monitor for Linux Drive Space
in Percentage



I tried this, but all I'm getting is: 

[false]: 0.00GB of 0.00GB (NaN%) || [false]: 0.00GB of 0.00GB (NaN%) ||
[false]: 0.00GB of 0.00GB (NaN%) || [false]: 0.00GB of 0.00GB (NaN%) ||
[false]: 0.00GB of 0.00GB (NaN%) || [false]: 0.00GB of 0.00GB (NaN%) ||
[false]: 0.00GB of 0.00GB (NaN%) || [false]: 0.00GB of 0.00GB (NaN%) 


Ideas??  I verified that the SNMP values for the storageDescr, etc., all
match.


________________________________


Pat Smith
System Administrator
Perceptive Software, Inc.

[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 
www.imagenow.com <http://www.imagenow.com/> 

+1 913 422 7525 corporate
+1 913 667 8809 direct
+1 913 422 3820 fax
+1 800 941 7460 toll-free

Be informed. Be connected. Be inspired.

NOTICE: If received in error, please destroy the message and notify
sender. Sender does not waive confidentiality or privilege, and use is
prohibited. 



"Rothfuss, Gregory" <[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED] 

10/29/2008 08:16 AM 
Please respond to
[email protected]


To
[email protected] 
cc
Subject
RE: [WhatsUp Forum] Active Script Monitor for Linux Drive Space in
Percentage

        




We changed this slightly to report more accurate drive information
(hrStoreageSize or hrStorageUsed * hrStorageAllocationUnits gives size
in bytes). 
  
-------------------- 
//JScript
//Assumption: All instances between the first and last are valid
(continuity)
//[EMAIL PROTECTED] and [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>  
  
var oSnmpRqst =  new ActiveXObject("CoreAsp.SnmpRqst"); 
var nDeviceID = Context.GetProperty("DeviceID");
var oResult = oSnmpRqst.Initialize(nDeviceID);
if (oResult.Failed)
{
Context.SetResult(1, "Initialization error " );
} 
else
{
var sReturn = ""; //Good string to return
var sBadReturn = ""; //Bad string to return
var shrStorageDescr = "1.3.6.1.2.1.25.2.3.1.3."; //hrStorageDescr
var shrStorageAllocationUnits = "1.3.6.1.2.1.25.2.3.1.4.";
//hrStorageAllocationUnits
var shrStorageSize = "1.3.6.1.2.1.25.2.3.1.5."; //hrStorageSize
var shrStorageUsed = "1.3.6.1.2.1.25.2.3.1.6."; //hrStorageUsed
var i = 1; //First instance
while(true) //Continue until we reach a non-existant instance
{
 var shrDescr = oSnmpRqst.Get(shrStorageDescr + i); //hrStorageDescr per
instance
 var shrAUnits = oSnmpRqst.Get(shrStorageAllocationUnits + i);
//hrStorageAllocationUnitse per instance
 var shrSize = oSnmpRqst.Get(shrStorageSize + i); //hrStorageSize per
instance
 var shrUsed = oSnmpRqst.Get(shrStorageUsed + i); //hrStorageUsed per
instance
 if (shrDescr.Failed) //We hit an instance that doesn't exist, time to
return a string
 {
  if(sBadReturn == "") //If there was no error
  {
   //Get the Open DB connection from the Context NameSpace
   var oDb = Context.GetDB;
   var sSql = "UPDATE Device SET sNote = '' WHERE nDeviceID = " +
nDeviceID; //Clear the notes
   var oRs = oDb.Execute(sSql);
   Context.SetResult(0, sReturn); //Return our good string
  }
  else //Something went wrong
  {
   // Get the Open DB connection from the Context NameSpace
   var oDb = Context.GetDB;
   var sSql = "UPDATE Device SET sNote = '" + sBadReturn + "' WHERE
nDeviceID = " + nDeviceID; //Note all bad drives
   var oRs = oDb.Execute(sSql);
   Context.SetResult(1, sBadReturn); //Return our bad string and notify
What'sUp Gold
  }
  break; //Exit the loop
 }
 else //There are still instances
 {
  //hrStoreageSize or hrStorageUsed * hrStorageAllocationUnits gives
size in bytes
  iPercent = (parseInt(shrUsed) / parseInt(shrSize)) * 100; //Calculate
the % of drive space
  shrUsed = (shrUsed * shrAUnits) / 1073741824; //bytes to GB (shrUsed *
shrAUnits) / (1024 * 1024 * 1024)
  shrSize = (shrSize * shrAUnits) / 1073741824; //bytes to GB (shrSize *
shrAUnits) / (1024 * 1024 * 1024)
  if(iPercent >= 90) //Set the drive space percentage here (90 = 90%)
  {
   if(sBadReturn != "") //Formatting
    sBadReturn = sBadReturn + " || "; //Formatting
   sBadReturn = sBadReturn + "[" + shrDescr + "]: " + shrUsed.toFixed(2)
+ "GB of " + shrSize.toFixed(2) + "GB (" + iPercent.toFixed(1) + "%)";
  }
  if(sReturn != "") //Formatting
   sReturn = sReturn + " || "; //Formatting
  sReturn = sReturn + "[" + shrDescr + "]: " + shrUsed.toFixed(2) + "GB
of " + shrSize.toFixed(2) + "GB (" + iPercent.toFixed(1) + "%)";
  i++; //Move on to next instance
 }
}
} 
  
Semper-Fi 

   

<<ATT9080986.gif>>

Reply via email to