Ejemplo n.º 1
0
void MonDiskGatherData(double *cf_this)
{
    char accesslog[CF_BUFSIZE];
    char errorlog[CF_BUFSIZE];
    char syslog[CF_BUFSIZE];
    char messages[CF_BUFSIZE];

    CfOut(cf_verbose, "", "Gathering disk data\n");
    cf_this[ob_diskfree] = GetDiskUsage("/", cfpercent);
    CfOut(cf_verbose, "", "Disk free = %.0lf%%\n", cf_this[ob_diskfree]);

/* Here would should have some detection based on OS type VSYSTEMHARDCLASS */

    switch (VSYSTEMHARDCLASS)
    {
    default:
        strcpy(accesslog, "/var/log/apache2/access_log");
        strcpy(errorlog, "/var/log/apache2/error_log");
        strcpy(syslog, "/var/log/syslog");
        strcpy(messages, "/var/log/messages");
    }

    cf_this[ob_webaccess] = GetFileGrowth(accesslog, ob_webaccess);
    CfOut(cf_verbose, "", "Webaccess = %.2lf%%\n", cf_this[ob_webaccess]);
    cf_this[ob_weberrors] = GetFileGrowth(errorlog, ob_weberrors);
    CfOut(cf_verbose, "", "Web error = %.2lf%%\n", cf_this[ob_weberrors]);
    cf_this[ob_syslog] = GetFileGrowth(syslog, ob_syslog);
    CfOut(cf_verbose, "", "Syslog = %.2lf%%\n", cf_this[ob_syslog]);
    cf_this[ob_messages] = GetFileGrowth(messages, ob_messages);
    CfOut(cf_verbose, "", "Messages = %.2lf%%\n", cf_this[ob_messages]);
}
Ejemplo n.º 2
0
void MonDiskGatherData(double *cf_this)
{
    char accesslog[CF_BUFSIZE];
    char errorlog[CF_BUFSIZE];
    char syslog[CF_BUFSIZE];
    char messages[CF_BUFSIZE];

    cf_this[ob_diskfree] = GetDiskUsage("/", CF_SIZE_PERCENT);
    Log(LOG_LEVEL_VERBOSE, "[1] Disk free = %.0lf%%", cf_this[ob_diskfree]);

/* Here would should have some detection based on OS type VSYSTEMHARDCLASS */

    strcpy(accesslog, "/var/log/apache2/access_log");
    strcpy(errorlog, "/var/log/apache2/error_log");
    strcpy(syslog, "/var/log/syslog");
    strcpy(messages, "/var/log/messages");

    cf_this[ob_webaccess] = GetFileGrowth(accesslog, ob_webaccess);
    Log(LOG_LEVEL_VERBOSE, "[2] Webaccess = %.2lf%%", cf_this[ob_webaccess]);
    cf_this[ob_weberrors] = GetFileGrowth(errorlog, ob_weberrors);
    Log(LOG_LEVEL_VERBOSE, "[3] Web error = %.2lf%%", cf_this[ob_weberrors]);
    cf_this[ob_syslog] = GetFileGrowth(syslog, ob_syslog);
    Log(LOG_LEVEL_VERBOSE, "[4] Syslog = %.2lf%%", cf_this[ob_syslog]);
    cf_this[ob_messages] = GetFileGrowth(messages, ob_messages);
    Log(LOG_LEVEL_VERBOSE, "[5] Messages = %.2lf%%", cf_this[ob_messages]);
}