# monitoring JBOD enclosure with sg_ses command from sg3_utils



## wszczep (Apr 2, 2014)

Hi All,

I am trying to fetch some vital data of JBOD enclosure like: voltage, temperature or fans speed, and put it into nagios check script. So far after installing sysutils/sg3_utils port I have managed to get some long listing by using command `sg_ses --page=es /dev/ses0`

But I cannot find a shorter solution to just output a value of e.g. temperature, so far I have tried something like
`sg_ses --page=es --descriptor=TempSenseFP --get=(STR) /dev/ses0` where (STR) was substituted with ident or locate acronyms, which I've got from `sg_ses --enumerate` output. No success here   

Is there a more elegant way or I will have to grep the output for searched term?


----------



## SirDice (Apr 2, 2014)

*Re: monitoring JBOD enclosure with sg_ses command from sg3_u*



			
				wszczep said:
			
		

> Is there a more elegant way or I will have to grep the output for searched term?


Different solution but have you looked at sysutils/smartmontools?


----------



## wszczep (Apr 2, 2014)

*Re: monitoring JBOD enclosure with sg_ses command from sg3_u*

I am using smartmontools to check health and report temperature of all disks. But for this enclosure it does not work.

```
# smartctl -a /dev/ses0
Vendor:               INTEL
Product:              RES2CV360-R
Revision:             0d00
Logical Unit id:      0x5001e6775dd97ffd
Serial number:
Device type:          enclosure
Transport protocol:   SAS
Local Time is:        Wed Apr  2 11:58:37 2014 CEST
Device does not support SMART

Error Counter logging not supported
Device does not support Self Test logging
```


----------



## wszczep (Apr 2, 2014)

*Re: monitoring JBOD enclosure with sg_ses command from sg3_u*

...while following gives

```
# sg_ses --page=es /dev/ses0
[...]
    Element type: Voltage sensor, subenclosure id: 0 [ti=1]
      Overall descriptor:
        Predicted failure=0, Disabled=0, Swap=0, status: Unsupported
        Ident=0, Fail=0,  Warn Over=0, Warn Under=0, Crit Over=0
        Crit Under=0
        Voltage: 0.00 volts
      Element 0 descriptor:
        Predicted failure=0, Disabled=0, Swap=0, status: OK
        Ident=0, Fail=0,  Warn Over=0, Warn Under=0, Crit Over=0
        Crit Under=0
        Voltage: 3.24 volts
      Element 1 descriptor:
        Predicted failure=0, Disabled=0, Swap=0, status: OK
        Ident=0, Fail=0,  Warn Over=0, Warn Under=0, Crit Over=0
        Crit Under=0
        Voltage: 5.01 volts
      Element 2 descriptor:
        Predicted failure=0, Disabled=0, Swap=0, status: OK
        Ident=0, Fail=0,  Warn Over=0, Warn Under=0, Crit Over=0
        Crit Under=0
        Voltage: 12.04 volts
    Element type: Temperature sensor, subenclosure id: 0 [ti=2]
      Overall descriptor:
        Predicted failure=0, Disabled=0, Swap=0, status: Unsupported
        Ident=0, Fail=0, OT failure=0, OT warning=0, UT failure=0
        UT warning=0
        Temperature: <reserved>
      Element 0 descriptor:
        Predicted failure=0, Disabled=0, Swap=0, status: OK
        Ident=0, Fail=0, OT failure=0, OT warning=0, UT failure=0
        UT warning=0
        Temperature=21 C
    Element type: Cooling, subenclosure id: 0 [ti=3]
      Overall descriptor:
        Predicted failure=0, Disabled=0, Swap=0, status: Unsupported
        Ident=0, Hot swap=0, Fail=0, Requested on=0, Off=0
        Actual speed=0 rpm, Fan stopped
      Element 0 descriptor:
        Predicted failure=0, Disabled=0, Swap=0, status: OK
        Ident=0, Hot swap=0, Fail=0, Requested on=0, Off=0
        Actual speed=6280 rpm, Fan at intermediate speed
      Element 1 descriptor:
        Predicted failure=0, Disabled=0, Swap=0, status: OK
        Ident=0, Hot swap=0, Fail=0, Requested on=0, Off=0
        Actual speed=6280 rpm, Fan at intermediate speed
      Element 2 descriptor:
        Predicted failure=0, Disabled=0, Swap=0, status: OK
        Ident=0, Hot swap=0, Fail=0, Requested on=0, Off=0
        Actual speed=6320 rpm, Fan at intermediate speed
[...]
```


----------



## SirDice (Apr 2, 2014)

*Re: monitoring JBOD enclosure with sg_ses command from sg3_u*



			
				wszczep said:
			
		

> But for this enclosure it does not work.


Ah, yes. Some do, some don't. I guess you have one of the latter ones


----------



## ralphbsz (Apr 2, 2014)

*Re: monitoring JBOD enclosure with sg_ses command from sg3_u*

Get the SES manual for whatever enclosure you are using.  That will tell you what information is reported where in the SES data.  If that fails (vendor is not helpful or pretends to not exist), then you'll have to understand the output from `sg_ses`, and understand the logical structure of SES commands and responses.  The SCSI standards documents are very clear, but have way too much detail, and every enclosure implements a different subset of the standard.  So this will be a long learning process.

Then you have two options.  Either you wrap `sg_ses` in some scripts, which filter the output to your liking.  Or you write a small program yourself (you can use the source of sgutils as a textbook) which issues exactly the SCSI command (CDB) that's needed, and pulls exactly the information you need from the output.

Communicating with disk enclosures over SES is very tedious, but possible.


----------



## RakeshRK (Mar 9, 2016)

wszczep said:


> *Re: monitoring JBOD enclosure with sg_ses command from sg3_u*
> 
> I am using smartmontools to check health and report temperature of all disks. But for this enclosure it does not work.
> 
> ...




Why is the serial number displayed empty ? Don't we have a way to get it ?


----------

