MT_StartMonitoring

■Description

Start monitoring the hardware monitor (temperature).

■Synopsis

int MT_StartMonitoring(int fd, PMONITORPARAM pmonitor)

■Argument

int fd
  Please specify handle acquired by MT_Open function.

PMONITORPARAM pmonitor
  Specify settings for monitoring.
  The MONITORPARAM structure is as follows.

    typedef struct {
          unsigned char ucCPUth1;  //cpu temperature threshold 1
          unsigned char ucCPUth2;  //cpu temperature threshold 2
          unsigned char ucMBth1;   //M/B temperature threshold 1
          unsigned char ucMBth2;   //M/B temperature threshold 2
          long lScanIntervalHWM;   /*CPU, M/B Time interval to check Temporal
                                    interval specified in units of 1 ms
                                    (specified as 2000 - 60000 [ms]).*/
          bool bEventLog;          //Set whether to record the event log
          struct sockaddr_un sa;   //Unix domain socket used for sending messages
    } MONITORPARAM, *PMONITORPARAM;

■RETURN VALUE

If the function succeeds, NO_ERROR is returned.
If the function fails, a code other than NO_ERROR is returned.
The other errors : Error code details

■Note

It monitors with the specified time interval (long lScanIntervalHWM).

When bEventLog is set to true, a message is output to syslog when the temperature threshold is exceeded.

We use UNIX domain socket for message transmission when abnormality occurs in temperature monitoring.
For details on Unix domain socket, socket communication etc, please refer to relevant Linux document, books etc.
The sockaddr_un structure is shown below by reference.

  #define UNIX_PATH_MAX    108
  struct sockaddr_un {
      sa_family_t sun_family;               /* AF_UNIX */
      char        sun_path[UNIX_PATH_MAX];  /* pathname */
  };

If you do not want to send a message, please set so that the character string length of sun_path is 0.
If the character string length of sun_path is 0, message transmission is not performed.

The message issued when the setting threshold is exceeded is as follows.
The following definition values are stored in the received message, so you can check which error occurred. When multiple abnormalities occur, the logical sum of the definition values is stored.
Definition bit position Meaning
CPU_TH1 bit0 CPU temperature threshold 1 exceeded occurrence
CPU_TH2 bit1 CPU temperature threshold 2 exceeded occurrence
MB_TH1 bit2 M/B temperature threshold 1 exceeded occurrence
MB_TH2 bit3 M/B temperature threshold 2 exceeded occurrence



Function List