The VisAO Camera
sysmonD.h
Go to the documentation of this file.
1 /************************************************************
2 * sysmonD.h
3 *
4 * Author: Jared R. Males (jrmales@email.arizona.edu)
5 *
6 * Declarations for the sysmonD system monitor
7 *
8 * Developed as part of the Magellan Adaptive Optics system.
9 ************************************************************/
10 
11 /** \file sysmonD.h
12  * \author Jared R. Males
13  * \brief Declarations for the sysmonD system monitor
14  *
15  * The VisAO sysmonD monitors system parameters (temperatures, memory usage, raid status).
16  *
17  * This is a standalone VisAOApp, doesn't depend on MsgD.
18 */
19 
20 
21 #ifndef __sysmonD_h__
22 #define __sysmonD_h__
23 
24 
25 #include "VisAOApp_standalone.h"
26 #include "libvisao.h"
27 
28 #include <fstream>
29 
30 #include "QTITempProbe.h"
31 
32 namespace VisAO
33 {
34 
35 ///The VisAO system monitor
36 /** Periodically queries various system temperatures and other parameters. Makes use of some shell scripts to parse
37  * various /cat/proc and utility program outputs. Temperatures are written to a TELEMETRY log.
38  *
39  * See \ref VisAOApp_standalone for command line arguments. There are no additional command line arguments for sysmonD.
40  *
41  * This is a standalone VisAOApp, so it doesn't depend on MsgD. In addition to the optional standard config options inherited from \ref VisAOApp_standalone this class has the following also optional config parameters:
42  * - <b>airTemp_serial_no</b> <tt>string</tt> - the serial number of the QTI temperature probe monitoring VisAO box air temp.
43  * - <b>joe47Temp_serial_no</b> <tt>string</tt> - the serial number of the QTI temperature probe monitoring little joe 47
44  * exhaust temp.
45  * - <b>qtiAmbSerialNo</b> <tt>string</tt> - the serial number of the QTI temperature probe monitoring ambient temp.
46  *
47  *
48  *
49  */
50 
52 {
53  public:
54  /// Command line constructor.
55  sysmonD(int argc, char **argv) throw (AOException);
56 
57  /// Config file constructor.
58  sysmonD(std::string name, const std::string &conffile) throw (AOException);
59 
60  void init_sysmonD();
61 
62  protected:
63  double core_temps[SYS_N_CORES];
64  double core_max[SYS_N_CORES];
65  double core_idle[SYS_N_VCORES];
66 
67  char raid_stat[SYS_N_LOGDRV];
68 
69  size_t mem_tot;
70  size_t mem_used;
71  size_t mem_free;
72  size_t mem_shared;
73  size_t mem_buff;
74  size_t mem_cached;
75 
76  size_t swap_tot;
77  size_t swap_used;
78  size_t swap_free;
79 
80  size_t dfroot_size;
81  size_t dfroot_used;
82  size_t dfroot_avail;
83 
84  int GPUTemp;
85  int GPUMemUsage;
86 
87  ifstream fin;
88  int get_sysstat();
89  int get_GPUstat();
90  int get_HDDstat();
91 
92  int HDDTemp_a;
93  int HDDTemp_b;
94 
95  QTITempProbe * qtiProbes;
96  int nprobes;
97 
98  bool haveQTIAir;
99  int qtiAirIndex;
100  std::string qtiAirSerialNo;
101 
102  bool haveQTIJoe47;
103  int qtiJoe47Index;
104  std::string qtiJoe47SerialNo;
105 
106  bool haveQTIAmb;
107  int qtiAmbIndex;
108  std::string qtiAmbSerialNo;
109 
110  double airTemp;
111  double joe47Temp;
112  double ambTemp;
113 
114  int setupQTI();
115 
116  ///Temperature logger
117  Logger *_tempsLogger;
118 
119  double core_temp_warn;
120  double core_temp_limit;
121  double hdd_used_warn;
122  double hdd_used_limit;
123  double hdd_temp_warn;
124  double hdd_temp_limit;
125  double gpu_temp_warn;
126  double gpu_temp_limit;
127  double air_temp_warn;
128  double air_temp_limit;
129  double joe_temp_warn;
130  double joe_temp_limit;
131 
132 
133 public:
134  void qtiTimeout();
135 protected:
136 
137  int get_QTITemps();
138 
139  /// The main loop.
140  /** Just installs the kill handler and starts pausing and updating.
141  */
142  virtual int Run();
143 
144  public:
145  virtual int update_statusboard();
146 
147 };//class sysmonD
148 
149 }//namespace VisAO
150 
151 #endif //__sysmonD_h__
virtual int Run()
The main loop.
Definition: sysmonD.cpp:431
The standalone VisAO application, does not interface with the AO Supervisor.
Declarations for the standalone VisAO application.
VisAO software utilitites, declarations.
The VisAO system monitor.
Definition: sysmonD.h:51
#define SYS_N_VCORES
Number of virtual processors in the system.
Definition: libvisao.h:48
Logger * _tempsLogger
Temperature logger.
Definition: sysmonD.h:117
sysmonD(int argc, char **argv)
Command line constructor.
Definition: sysmonD.cpp:25
virtual int update_statusboard()
Update the status board.
Definition: sysmonD.cpp:471
#define SYS_N_LOGDRV
Number of logical drives in the system.
Definition: libvisao.h:54
The namespace of VisAO software.
#define SYS_N_CORES
Number of physical processors in the system.
Definition: libvisao.h:45