Line 186... |
Line 186... |
186 |
} else {
|
186 |
} else {
|
187 |
$this->machineName = $this->report['system']['hostname'];
|
187 |
$this->machineName = $this->report['system']['hostname'];
|
188 |
}
|
188 |
}
|
189 |
$this->FATAL = ! empty( $this->messages );
|
189 |
$this->FATAL = ! empty( $this->messages );
|
190 |
|
190 |
|
- |
|
191 |
/* removed for the time being.
|
191 |
// serial number is fairly new, so it is not a critical error
|
192 |
// serial number is fairly new, so it is not a critical error
|
192 |
// it will be set in getMachineID if we have it here, but not there
|
193 |
// it will be set in getMachineID if we have it here, but not there
|
193 |
if ( empty ( $this->report['system']['serial'] ) ) {
|
194 |
if ( empty ( $this->report['system']['serial'] ) ) {
|
194 |
$this->messages[] = 'No Serial Number';
|
195 |
$this->messages[] = 'No Serial Number';
|
195 |
} else {
|
196 |
} else {
|
196 |
$this->serialNumber = $this->report['system']['serial'];
|
197 |
$this->serialNumber = $this->report['system']['serial'];
|
197 |
}
|
198 |
}
|
- |
|
199 |
*/
|
198 |
|
200 |
|
199 |
} // function validateReport
|
201 |
} // function validateReport
|
200 |
|
202 |
|
201 |
|
203 |
|
202 |
/*
|
204 |
/*
|
Line 356... |
Line 358... |
356 |
}
|
358 |
}
|
357 |
queryDatabaseExtended( "insert into device_operating_system( device_id,operating_system_id,added_date) values ($this->machineID,$osID,'$this->reportDateSQL')");
|
359 |
queryDatabaseExtended( "insert into device_operating_system( device_id,operating_system_id,added_date) values ($this->machineID,$osID,'$this->reportDateSQL')");
|
358 |
}
|
360 |
}
|
359 |
}
|
361 |
}
|
360 |
|
362 |
|
361 |
# every time we get a report, we need to see if the computer was rebooted
|
363 |
/* every time we get a report, we need to see if the computer was rebooted
|
- |
|
364 |
* There is some slop in the last reboot date, so we assume if it is less than
|
362 |
# if last reboot date is not the same as what our report shows, we will
|
365 |
* $fuzzyRebootTimes, it was not rebooted. $fuzzyRebootTimes is calculated in
|
- |
|
366 |
* seconds. Since most of our machines take a minimum of 5 minutes to reboot
|
- |
|
367 |
* we'll go with that (300), though it would be just as good to go with a day
|
- |
|
368 |
* (86400) since we only run this report daily
|
363 |
# remove the existing entry, then add a new one
|
369 |
* When one is found, we remove the old report and add a new one.
|
- |
|
370 |
*/
|
364 |
private function updateBootTime() {
|
371 |
private function updateBootTime() {
|
- |
|
372 |
$fuzzyRebootTimes = 300; // this allows slop of this many seconds before we assume a machine has been rebooted, ie
|
365 |
$lastReboot;
|
373 |
$lastReboot;
|
366 |
if ( isset( $this->report['system']['last_boot'] ) ) {
|
374 |
if ( isset( $this->report['system']['last_boot'] ) ) {
|
367 |
$lastReboot = strftime( '%F %T',$this->report['system']['last_boot'] ); // convert unix timestamp to sql value
|
375 |
$lastReboot = strftime( '%F %T',$this->report['system']['last_boot'] ); // convert unix timestamp to sql value
|
368 |
if ( isset( $lastReboot ) ) {
|
376 |
if ( isset( $lastReboot ) ) {
|
369 |
if ( ! getOneDBValue( "select computer_uptime_id from computer_uptime where device_id = $this->machineID and last_reboot = '$lastReboot'" ) ) {
|
377 |
//if ( ! getOneDBValue( "select computer_uptime_id from computer_uptime where device_id = $this->machineID and last_reboot = '$lastReboot'" ) ) {
|
- |
|
378 |
if ( ! getOneDBValue( "select computer_uptime_id from computer_uptime where abs(TIME_TO_SEC(timediff( last_reboot, '$lastReboot' ))) < 3600 and device_id = $this->machineID" ) ) {
|
370 |
$this->messages[] = "Computer was rebooted at $lastReboot";
|
379 |
$this->messages[] = "Computer was rebooted at $lastReboot";
|
371 |
queryDatabaseExtended( "update computer_uptime set removed_date = '$this->reportDateSQL' where device_id = $this->machineID and removed_date is null" );
|
380 |
queryDatabaseExtended( "update computer_uptime set removed_date = '$this->reportDateSQL' where device_id = $this->machineID and removed_date is null" );
|
372 |
queryDatabaseExtended( "insert into computer_uptime (device_id,added_date,last_reboot) values ($this->machineID,'$this->reportDateSQL','$lastReboot')");
|
381 |
queryDatabaseExtended( "insert into computer_uptime (device_id,added_date,last_reboot) values ($this->machineID,'$this->reportDateSQL','$lastReboot')");
|
373 |
}
|
382 |
}
|
374 |
} else {
|
383 |
} else {
|