temp statistics for SAS drives

This commit is contained in:
Gerold Gruber
2023-10-12 12:37:32 +02:00
parent 47112c4de2
commit 68a6002ff1
3 changed files with 50 additions and 3 deletions

View File

@@ -110,6 +110,28 @@ int nwipe_get_scsi_temperature( nwipe_context_t* c )
if( scsi_get_temperature( dsk ) == GETTEMP_SUCCESS )
{
c->temp1_input = dsk->value;
if( c->temp1_max == NO_TEMPERATURE_DATA )
{
c->temp1_max = c->temp1_input;
}
else
{
if( c->temp1_input > c->temp1_max )
{
c->temp1_max = c->temp1_input;
}
}
if( c->temp1_min == NO_TEMPERATURE_DATA )
{
c->temp1_min = c->temp1_input;
}
else
{
if( c->temp1_input < c->temp1_min )
{
c->temp1_min = c->temp1_input;
}
}
}
else
{

View File

@@ -99,11 +99,27 @@ int scsi_get_temperature(struct disk *dsk) {
return GETTEMP_ERROR;
}
dsk->value = buffer[9];
if( (int)buffer[7] == 2 ) /* PARAMETER LENGTH */
{
dsk->value = buffer[9];
}
else
{
snprintf(dsk->errormsg, MAX_ERRORMSG_SIZE, _("parameter length unexpected: %d"), (int)buffer[7] );
return GETTEMP_UNKNOWN;
}
dsk->refvalue = buffer[15];
if( (int)buffer[13] == 2 ) /* PARAMETER LENGTH */
{
dsk->refvalue = buffer[15];
}
else
{
snprintf(dsk->errormsg, MAX_ERRORMSG_SIZE, _("parameter ref length unexpected: %d"), (int)buffer[13] );
return GETTEMP_UNKNOWN;
}
return GETTEMP_SUCCESS;
} else {
return GETTEMP_NOSENSOR;
}
}

View File

@@ -291,7 +291,16 @@ void nwipe_update_temperature( nwipe_context_t* c )
{
if( c->templ_has_scsitemp_data == 1 )
{
nwipe_log( NWIPE_LOG_NOTICE, "hddtemp: get temperature for %s", c->device_name );
if( nwipe_options.verbose )
{
nwipe_log( NWIPE_LOG_NOTICE, "hddtemp: %s temp1_crit %dC", c->device_name, c->temp1_crit );
nwipe_log( NWIPE_LOG_NOTICE, "hddtemp: %s temp1_highest %dC", c->device_name, c->temp1_highest );
nwipe_log( NWIPE_LOG_NOTICE, "hddtemp: %s temp1_input %dC", c->device_name, c->temp1_input );
nwipe_log( NWIPE_LOG_NOTICE, "hddtemp: %s temp1_lcrit %dC", c->device_name, c->temp1_lcrit );
nwipe_log( NWIPE_LOG_NOTICE, "hddtemp: %s temp1_lowest %dC", c->device_name, c->temp1_lowest );
nwipe_log( NWIPE_LOG_NOTICE, "hddtemp: %s temp1_max %dC", c->device_name, c->temp1_max );
nwipe_log( NWIPE_LOG_NOTICE, "hddtemp: %s temp1_min %dC", c->device_name, c->temp1_min );
}
if( nwipe_get_scsi_temperature( c ) != 0 )
{
nwipe_log( NWIPE_LOG_ERROR, "get_scsi_temperature error" );