Ad Widget

Collapse

Not a patch but suggestion: Zabbixw32.exe disktotal

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Wolfgang
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified Specialist
    • Apr 2005
    • 116

    #1

    Not a patch but suggestion: Zabbixw32.exe disktotal

    Checked with Zabbixw32.exe version v1.1-b4 in sysinfo.cpp.
    Refers to items disktotal, diskfree, diskusage:

    If there is a typo in cmd, it seems the agent will return the "disktotal" value instead of SYSINFO_RC_NOTSUPPORTED.

    Code:
    static LONG H_DiskInfo(char *cmd,char *arg,double *value)
    {
       char path[MAX_PATH];
       ULARGE_INTEGER freeBytes,totalBytes;
    
    
    
       GetParameterInstance(cmd,path,MAX_PATH-1);
       if (!GetDiskFreeSpaceEx(path,&freeBytes,&totalBytes,NULL))
          return SYSINFO_RC_NOTSUPPORTED;
    
       if (!memcmp(cmd,"diskfree[",9))
          *value=(double)((__int64)freeBytes.QuadPart);
       else if (!memcmp(cmd,"diskused[",9))
          *value=(double)((__int64)totalBytes.QuadPart-(__int64)freeBytes.QuadPart);
       else
          *value=(double)((__int64)totalBytes.QuadPart);
       return SYSINFO_RC_SUCCESS;
    }
    Last edited by Wolfgang; 16-12-2005, 11:17.
    http://www.intellitrend.de
    Specialised in monitoring large environments and Zabbix API programming.
Working...