forked from opendcim/openDCIM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CabinetTemps.class.php
54 lines (40 loc) · 1.48 KB
/
CabinetTemps.class.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/*
openDCIM
This is the main class library for the openDCIM application, which
is a PHP/Web based data center infrastructure management system.
This application was originally written by Scott A. Milliken while
employed at Vanderbilt University in Nashville, TN, as the
Data Center Manager, and released under the GNU GPL.
Copyright (C) 2011 Scott A. Milliken
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation, version 3.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
For further details on the license, see http://www.gnu.org/licenses
*/
class CabinetTemps {
/* CabinetTemps: Temperature sensor readings from intelligent, SNMP readable temperature sensors */
var $CabinetID;
var $LastRead;
var $Temp;
var $Humidity;
function GetReading() {
global $dbh;
$sql = sprintf( "select * from fac_CabinetTemps where CabinetID=%d", $this->CabinetID );
if ( $row = $dbh->query( $sql )->fetch() ) {
$this->LastRead = date( "m-d-Y H:i:s", strtotime($row["LastRead"]) );
$Temp = $row["Temp"];
$Humidity = $row["Humidity"];
} else {
$info = $dbh->errorInfo();
error_log( "PDO Error: " . $info[2] . " SQL=" . $sql );
return false;
}
return;
}
}
?>