Exemple #1
0
static void
sensor_load(void)
{
#ifdef solaris2
    clock_t         t = time(NULL);
#else
    clock_t	t = clock();
#endif

    if (t > timestamp + 6) /* this may require some tuning - currently 6 seconds*/
        _sensor_load(t);

    return;
}
Exemple #2
0
static int
sensor_load(void)
{
    int rc = 0;
    time_t	   t = time(NULL);

    if (t > timestamp + 7) /* this may require some tuning - currently 7 seconds*/
    {
#ifndef solaris2
        free_sensor_arrays();
#endif
        rc = _sensor_load(t);
    }

    return rc;
}
Exemple #3
0
static int
sensor_init(void)
{
#ifdef solaris2
    clock_t         t = time(NULL);
#else
    int             res;
    char            filename[] = CONFIG_FILE_NAME;
    clock_t         t = clock();
    FILE           *fp = fopen(filename, "r");
    if (!fp)
        return 1;

    if (res = sensors_init(fp))
        return 2;

    _sensor_load(t); /* I'll let the linux people decide whether they want to load right away */
#endif
    return 0;
}
Exemple #4
0
static int
sensor_init(void)
{
    int             res;
#ifndef solaris2
    char            filename[] = CONFIG_FILE_NAME;
    time_t          t = time(NULL);
    FILE            *fp = fopen(filename, "r");
    int             i = 0;
  
    DEBUGMSG(("ucd-snmp/lmSensors", "=> sensor_init\n"));

    for (i = 0; i < N_TYPES; i++)
    {
        sensor_array[i].n = 0;
        sensor_array[i].current_len = 0;
        sensor_array[i].sensor = NULL;
    }

    if (!fp)
    {
        res = 1;
        goto leaving;
    }

    if (sensors_init(fp))
    {
        res = 2;
        goto leaving;
    }

    _sensor_load(t); /* I'll let the linux people decide whether they want to load right away */
leaving:
#endif /* not solaris2 */

    DEBUGMSG(("ucd-snmp/lmSensors", "<= sensor_init\n"));
    return res;
}
Exemple #5
0
/*
 * Wrapper routine for re-loading sensor statistics on demand
 */
int
netsnmp_sensor_load( netsnmp_cache *cache, void *data )
{
    return _sensor_load();
}
Exemple #6
0
/*
 * Wrapper routine for automatically updating sensor statistics
 */
void
_sensor_update_stats( unsigned int clientreg, void *data )
{
    _sensor_free();
    _sensor_load();
}