mirror of
				https://github.com/prometheus/node_exporter.git
				synced 2025-08-20 18:33:52 -07:00 
			
		
		
		
	Remove obsolete megacli collector. (#798)
This collector has been replaced by the textfile collector tool `storcli.py`.
This commit is contained in:
		
							parent
							
								
									1ad5ba4dc7
								
							
						
					
					
						commit
						111e3af437
					
				| 
						 | 
				
			
			@ -80,7 +80,6 @@ tcpstat | Exposes TCP connection status information from `/proc/net/tcp` and `/p
 | 
			
		|||
Name     | Description | OS
 | 
			
		||||
---------|-------------|----
 | 
			
		||||
gmond | Exposes statistics from Ganglia. | _any_
 | 
			
		||||
megacli | Exposes RAID statistics from MegaCLI. | Linux
 | 
			
		||||
 | 
			
		||||
### Textfile Collector
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1111,25 +1111,6 @@ node_md_is_active{device="md6"} 1
 | 
			
		|||
node_md_is_active{device="md7"} 1
 | 
			
		||||
node_md_is_active{device="md8"} 1
 | 
			
		||||
node_md_is_active{device="md9"} 1
 | 
			
		||||
# HELP node_megacli_drive_count megacli: drive error and event counters
 | 
			
		||||
# TYPE node_megacli_drive_count gauge
 | 
			
		||||
node_megacli_drive_count{enclosure="32",slot="0",type="Media Error Count"} 0
 | 
			
		||||
node_megacli_drive_count{enclosure="32",slot="0",type="Other Error Count"} 0
 | 
			
		||||
node_megacli_drive_count{enclosure="32",slot="0",type="Predictive Failure Count"} 0
 | 
			
		||||
node_megacli_drive_count{enclosure="32",slot="1",type="Media Error Count"} 0
 | 
			
		||||
node_megacli_drive_count{enclosure="32",slot="1",type="Other Error Count"} 0
 | 
			
		||||
node_megacli_drive_count{enclosure="32",slot="1",type="Predictive Failure Count"} 0
 | 
			
		||||
node_megacli_drive_count{enclosure="32",slot="2",type="Media Error Count"} 0
 | 
			
		||||
node_megacli_drive_count{enclosure="32",slot="2",type="Other Error Count"} 0
 | 
			
		||||
node_megacli_drive_count{enclosure="32",slot="2",type="Predictive Failure Count"} 0
 | 
			
		||||
node_megacli_drive_count{enclosure="32",slot="3",type="Media Error Count"} 0
 | 
			
		||||
node_megacli_drive_count{enclosure="32",slot="3",type="Other Error Count"} 0
 | 
			
		||||
node_megacli_drive_count{enclosure="32",slot="3",type="Predictive Failure Count"} 23
 | 
			
		||||
# HELP node_megacli_drive_temperature_celsius megacli: drive temperature
 | 
			
		||||
# TYPE node_megacli_drive_temperature_celsius gauge
 | 
			
		||||
node_megacli_drive_temperature_celsius{enclosure="32",slot="0"} 37
 | 
			
		||||
node_megacli_drive_temperature_celsius{enclosure="32",slot="2"} 39
 | 
			
		||||
node_megacli_drive_temperature_celsius{enclosure="32",slot="3"} 38
 | 
			
		||||
# HELP node_memory_Active_anon_bytes Memory information field Active_anon_bytes.
 | 
			
		||||
# TYPE node_memory_Active_anon_bytes gauge
 | 
			
		||||
node_memory_Active_anon_bytes 2.068484096e+09
 | 
			
		||||
| 
						 | 
				
			
			@ -2643,7 +2624,6 @@ node_scrape_collector_success{collector="ipvs"} 1
 | 
			
		|||
node_scrape_collector_success{collector="ksmd"} 1
 | 
			
		||||
node_scrape_collector_success{collector="loadavg"} 1
 | 
			
		||||
node_scrape_collector_success{collector="mdadm"} 1
 | 
			
		||||
node_scrape_collector_success{collector="megacli"} 1
 | 
			
		||||
node_scrape_collector_success{collector="meminfo"} 1
 | 
			
		||||
node_scrape_collector_success{collector="meminfo_numa"} 1
 | 
			
		||||
node_scrape_collector_success{collector="mountstats"} 1
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1141,25 +1141,6 @@ node_md_is_active{device="md6"} 1
 | 
			
		|||
node_md_is_active{device="md7"} 1
 | 
			
		||||
node_md_is_active{device="md8"} 1
 | 
			
		||||
node_md_is_active{device="md9"} 1
 | 
			
		||||
# HELP node_megacli_drive_count megacli: drive error and event counters
 | 
			
		||||
# TYPE node_megacli_drive_count gauge
 | 
			
		||||
node_megacli_drive_count{enclosure="32",slot="0",type="Media Error Count"} 0
 | 
			
		||||
node_megacli_drive_count{enclosure="32",slot="0",type="Other Error Count"} 0
 | 
			
		||||
node_megacli_drive_count{enclosure="32",slot="0",type="Predictive Failure Count"} 0
 | 
			
		||||
node_megacli_drive_count{enclosure="32",slot="1",type="Media Error Count"} 0
 | 
			
		||||
node_megacli_drive_count{enclosure="32",slot="1",type="Other Error Count"} 0
 | 
			
		||||
node_megacli_drive_count{enclosure="32",slot="1",type="Predictive Failure Count"} 0
 | 
			
		||||
node_megacli_drive_count{enclosure="32",slot="2",type="Media Error Count"} 0
 | 
			
		||||
node_megacli_drive_count{enclosure="32",slot="2",type="Other Error Count"} 0
 | 
			
		||||
node_megacli_drive_count{enclosure="32",slot="2",type="Predictive Failure Count"} 0
 | 
			
		||||
node_megacli_drive_count{enclosure="32",slot="3",type="Media Error Count"} 0
 | 
			
		||||
node_megacli_drive_count{enclosure="32",slot="3",type="Other Error Count"} 0
 | 
			
		||||
node_megacli_drive_count{enclosure="32",slot="3",type="Predictive Failure Count"} 23
 | 
			
		||||
# HELP node_megacli_drive_temperature_celsius megacli: drive temperature
 | 
			
		||||
# TYPE node_megacli_drive_temperature_celsius gauge
 | 
			
		||||
node_megacli_drive_temperature_celsius{enclosure="32",slot="0"} 37
 | 
			
		||||
node_megacli_drive_temperature_celsius{enclosure="32",slot="2"} 39
 | 
			
		||||
node_megacli_drive_temperature_celsius{enclosure="32",slot="3"} 38
 | 
			
		||||
# HELP node_memory_Active Memory information field Active.
 | 
			
		||||
# TYPE node_memory_Active gauge
 | 
			
		||||
node_memory_Active 2.287017984e+09
 | 
			
		||||
| 
						 | 
				
			
			@ -2673,7 +2654,6 @@ node_scrape_collector_success{collector="ipvs"} 1
 | 
			
		|||
node_scrape_collector_success{collector="ksmd"} 1
 | 
			
		||||
node_scrape_collector_success{collector="loadavg"} 1
 | 
			
		||||
node_scrape_collector_success{collector="mdadm"} 1
 | 
			
		||||
node_scrape_collector_success{collector="megacli"} 1
 | 
			
		||||
node_scrape_collector_success{collector="meminfo"} 1
 | 
			
		||||
node_scrape_collector_success{collector="meminfo_numa"} 1
 | 
			
		||||
node_scrape_collector_success{collector="mountstats"} 1
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,3 +0,0 @@
 | 
			
		|||
#!/usr/bin/env bash
 | 
			
		||||
 | 
			
		||||
cat "$(dirname "$0")/megacli_disks.txt"
 | 
			
		||||
| 
						 | 
				
			
			@ -1,280 +0,0 @@
 | 
			
		|||
Adapter #0
 | 
			
		||||
 | 
			
		||||
==============================================================================
 | 
			
		||||
                    Versions
 | 
			
		||||
                ================
 | 
			
		||||
Product Name    : PERC 6/i Integrated
 | 
			
		||||
Serial No       : 1234567890123456
 | 
			
		||||
FW Package Build: 6.3.3.0002
 | 
			
		||||
 | 
			
		||||
                    Mfg. Data
 | 
			
		||||
                ================
 | 
			
		||||
Mfg. Date       : 06/24/08
 | 
			
		||||
Rework Date     : 06/24/08
 | 
			
		||||
Revision No     : 
 | 
			
		||||
Battery FRU     : N/A
 | 
			
		||||
 | 
			
		||||
                Image Versions in Flash:
 | 
			
		||||
                ================
 | 
			
		||||
FW Version         : 1.22.52-1909
 | 
			
		||||
BIOS Version       : 2.04.00
 | 
			
		||||
WebBIOS Version    : 1.1-46-e_15-Rel
 | 
			
		||||
Ctrl-R Version     : 1.02-015B
 | 
			
		||||
Preboot CLI Version: 01.00-022:#%00005
 | 
			
		||||
Boot Block Version : 1.00.00.01-0011
 | 
			
		||||
 | 
			
		||||
                Pending Images in Flash
 | 
			
		||||
                ================
 | 
			
		||||
None
 | 
			
		||||
 | 
			
		||||
                PCI Info
 | 
			
		||||
                ================
 | 
			
		||||
Controller Id	: 0000
 | 
			
		||||
Vendor Id       : 1000
 | 
			
		||||
Device Id       : 0060
 | 
			
		||||
SubVendorId     : 1028
 | 
			
		||||
SubDeviceId     : 1f0c
 | 
			
		||||
 | 
			
		||||
Host Interface  : PCIE
 | 
			
		||||
 | 
			
		||||
Link Speed 	     : 0 
 | 
			
		||||
Number of Frontend Port: 0 
 | 
			
		||||
Device Interface  : PCIE
 | 
			
		||||
 | 
			
		||||
Number of Backend Port: 8 
 | 
			
		||||
Port  :  Address
 | 
			
		||||
0        5000c50028f2083d 
 | 
			
		||||
1        5000c50023cb3f39 
 | 
			
		||||
2        5000c50023cea805 
 | 
			
		||||
3        5000c50029124491 
 | 
			
		||||
4        0000000000000000 
 | 
			
		||||
5        0000000000000000 
 | 
			
		||||
6        0000000000000000 
 | 
			
		||||
7        0000000000000000 
 | 
			
		||||
 | 
			
		||||
                HW Configuration
 | 
			
		||||
                ================
 | 
			
		||||
SAS Address      : 5a4badb01e219100
 | 
			
		||||
BBU              : Present
 | 
			
		||||
Alarm            : Absent
 | 
			
		||||
NVRAM            : Present
 | 
			
		||||
Serial Debugger  : Present
 | 
			
		||||
Memory           : Present
 | 
			
		||||
Flash            : Present
 | 
			
		||||
Memory Size      : 256MB
 | 
			
		||||
TPM              : Absent
 | 
			
		||||
On board Expander: Absent
 | 
			
		||||
Upgrade Key      : Absent
 | 
			
		||||
Temperature sensor for ROC    : Absent
 | 
			
		||||
Temperature sensor for controller    : Absent
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                Settings
 | 
			
		||||
                ================
 | 
			
		||||
Current Time                     : 14:55:23 7/4, 2014
 | 
			
		||||
Predictive Fail Poll Interval    : 300sec
 | 
			
		||||
Interrupt Throttle Active Count  : 16
 | 
			
		||||
Interrupt Throttle Completion    : 50us
 | 
			
		||||
Rebuild Rate                     : 30%
 | 
			
		||||
PR Rate                          : 30%
 | 
			
		||||
BGI Rate                         : 30%
 | 
			
		||||
Check Consistency Rate           : 30%
 | 
			
		||||
Reconstruction Rate              : 30%
 | 
			
		||||
Cache Flush Interval             : 4s
 | 
			
		||||
Max Drives to Spinup at One Time : 2
 | 
			
		||||
Delay Among Spinup Groups        : 12s
 | 
			
		||||
Physical Drive Coercion Mode     : 128MB
 | 
			
		||||
Cluster Mode                     : Disabled
 | 
			
		||||
Alarm                            : Disabled
 | 
			
		||||
Auto Rebuild                     : Enabled
 | 
			
		||||
Battery Warning                  : Enabled
 | 
			
		||||
Ecc Bucket Size                  : 15
 | 
			
		||||
Ecc Bucket Leak Rate             : 1440 Minutes
 | 
			
		||||
Restore HotSpare on Insertion    : Disabled
 | 
			
		||||
Expose Enclosure Devices         : Disabled
 | 
			
		||||
Maintain PD Fail History         : Disabled
 | 
			
		||||
Host Request Reordering          : Enabled
 | 
			
		||||
Auto Detect BackPlane Enabled    : SGPIO/i2c SEP
 | 
			
		||||
Load Balance Mode                : Auto
 | 
			
		||||
Use FDE Only                     : No
 | 
			
		||||
Security Key Assigned            : No
 | 
			
		||||
Security Key Failed              : No
 | 
			
		||||
Security Key Not Backedup        : No
 | 
			
		||||
Default LD PowerSave Policy      : Controller Defined
 | 
			
		||||
Maximum number of direct attached drives to spin up in 1 min : 0 
 | 
			
		||||
Auto Enhanced Import             : No
 | 
			
		||||
Any Offline VD Cache Preserved   : No
 | 
			
		||||
Allow Boot with Preserved Cache  : No
 | 
			
		||||
Disable Online Controller Reset  : No
 | 
			
		||||
PFK in NVRAM                     : No
 | 
			
		||||
Use disk activity for locate     : No
 | 
			
		||||
POST delay			 : 90 seconds
 | 
			
		||||
BIOS Error Handling          	 : Stop On Errors
 | 
			
		||||
Current Boot Mode 		  :Normal
 | 
			
		||||
                Capabilities
 | 
			
		||||
                ================
 | 
			
		||||
RAID Level Supported             : RAID0, RAID1, RAID5, RAID6, RAID00, RAID10, RAID50, RAID60, PRL 11, PRL 11 with spanning, SRL 3 supported, PRL11-RLQ0 DDF layout with no span, PRL11-RLQ0 DDF layout with span
 | 
			
		||||
Supported Drives                 : SAS, SATA
 | 
			
		||||
 | 
			
		||||
Allowed Mixing:
 | 
			
		||||
 | 
			
		||||
Mix in Enclosure Allowed
 | 
			
		||||
 | 
			
		||||
                Status
 | 
			
		||||
                ================
 | 
			
		||||
ECC Bucket Count                 : 0
 | 
			
		||||
 | 
			
		||||
                Limitations
 | 
			
		||||
                ================
 | 
			
		||||
Max Arms Per VD          : 32 
 | 
			
		||||
Max Spans Per VD         : 8 
 | 
			
		||||
Max Arrays               : 128 
 | 
			
		||||
Max Number of VDs        : 64 
 | 
			
		||||
Max Parallel Commands    : 1008 
 | 
			
		||||
Max SGE Count            : 80 
 | 
			
		||||
Max Data Transfer Size   : 8192 sectors 
 | 
			
		||||
Max Strips PerIO         : 42 
 | 
			
		||||
Max LD per array         : 16 
 | 
			
		||||
Min Strip Size           : 8 KB
 | 
			
		||||
Max Strip Size           : 1.0 MB
 | 
			
		||||
Max Configurable CacheCade Size: 0 GB
 | 
			
		||||
Current Size of CacheCade      : 0 GB
 | 
			
		||||
Current Size of FW Cache       : 0 MB
 | 
			
		||||
 | 
			
		||||
                Device Present
 | 
			
		||||
                ================
 | 
			
		||||
Virtual Drives    : 1 
 | 
			
		||||
  Degraded        : 0 
 | 
			
		||||
  Offline         : 0 
 | 
			
		||||
Physical Devices  : 5 
 | 
			
		||||
  Disks           : 4 
 | 
			
		||||
  Critical Disks  : 0 
 | 
			
		||||
  Failed Disks    : 0 
 | 
			
		||||
 | 
			
		||||
                Supported Adapter Operations
 | 
			
		||||
                ================
 | 
			
		||||
Rebuild Rate                    : Yes
 | 
			
		||||
CC Rate                         : Yes
 | 
			
		||||
BGI Rate                        : Yes
 | 
			
		||||
Reconstruct Rate                : Yes
 | 
			
		||||
Patrol Read Rate                : Yes
 | 
			
		||||
Alarm Control                   : Yes
 | 
			
		||||
Cluster Support                 : No
 | 
			
		||||
BBU                             : Yes
 | 
			
		||||
Spanning                        : Yes
 | 
			
		||||
Dedicated Hot Spare             : Yes
 | 
			
		||||
Revertible Hot Spares           : Yes
 | 
			
		||||
Foreign Config Import           : Yes
 | 
			
		||||
Self Diagnostic                 : Yes
 | 
			
		||||
Allow Mixed Redundancy on Array : No
 | 
			
		||||
Global Hot Spares               : Yes
 | 
			
		||||
Deny SCSI Passthrough           : No
 | 
			
		||||
Deny SMP Passthrough            : No
 | 
			
		||||
Deny STP Passthrough            : No
 | 
			
		||||
Support Security                : No
 | 
			
		||||
Snapshot Enabled                : No
 | 
			
		||||
Support the OCE without adding drives : No
 | 
			
		||||
Support PFK                     : No
 | 
			
		||||
Support PI                      : No
 | 
			
		||||
Support Boot Time PFK Change    : No
 | 
			
		||||
Disable Online PFK Change       : No
 | 
			
		||||
Support Shield State            : No
 | 
			
		||||
Block SSD Write Disk Cache Change: No
 | 
			
		||||
 | 
			
		||||
                Supported VD Operations
 | 
			
		||||
                ================
 | 
			
		||||
Read Policy          : Yes
 | 
			
		||||
Write Policy         : Yes
 | 
			
		||||
IO Policy            : Yes
 | 
			
		||||
Access Policy        : Yes
 | 
			
		||||
Disk Cache Policy    : Yes
 | 
			
		||||
Reconstruction       : Yes
 | 
			
		||||
Deny Locate          : No
 | 
			
		||||
Deny CC              : No
 | 
			
		||||
Allow Ctrl Encryption: No
 | 
			
		||||
Enable LDBBM         : No
 | 
			
		||||
Support Breakmirror  : No
 | 
			
		||||
Power Savings        : No
 | 
			
		||||
 | 
			
		||||
                Supported PD Operations
 | 
			
		||||
                ================
 | 
			
		||||
Force Online                            : Yes
 | 
			
		||||
Force Offline                           : Yes
 | 
			
		||||
Force Rebuild                           : Yes
 | 
			
		||||
Deny Force Failed                       : No
 | 
			
		||||
Deny Force Good/Bad                     : No
 | 
			
		||||
Deny Missing Replace                    : No
 | 
			
		||||
Deny Clear                              : No
 | 
			
		||||
Deny Locate                             : No
 | 
			
		||||
Support Temperature                     : No
 | 
			
		||||
NCQ                                     : No
 | 
			
		||||
Disable Copyback                        : No
 | 
			
		||||
Enable JBOD                             : No
 | 
			
		||||
Enable Copyback on SMART                : No
 | 
			
		||||
Enable Copyback to SSD on SMART Error   : No
 | 
			
		||||
Enable SSD Patrol Read                  : No
 | 
			
		||||
PR Correct Unconfigured Areas           : Yes
 | 
			
		||||
                Error Counters
 | 
			
		||||
                ================
 | 
			
		||||
Memory Correctable Errors   : 0 
 | 
			
		||||
Memory Uncorrectable Errors : 0 
 | 
			
		||||
 | 
			
		||||
                Cluster Information
 | 
			
		||||
                ================
 | 
			
		||||
Cluster Permitted     : No
 | 
			
		||||
Cluster Active        : No
 | 
			
		||||
 | 
			
		||||
                Default Settings
 | 
			
		||||
                ================
 | 
			
		||||
Phy Polarity                     : 0 
 | 
			
		||||
Phy PolaritySplit                : 0 
 | 
			
		||||
Background Rate                  : 30 
 | 
			
		||||
Strip Size                       : 64kB
 | 
			
		||||
Flush Time                       : 4 seconds
 | 
			
		||||
Write Policy                     : WB
 | 
			
		||||
Read Policy                      : None
 | 
			
		||||
Cache When BBU Bad               : Disabled
 | 
			
		||||
Cached IO                        : No
 | 
			
		||||
SMART Mode                       : Mode 6
 | 
			
		||||
Alarm Disable                    : No
 | 
			
		||||
Coercion Mode                    : 128MB
 | 
			
		||||
ZCR Config                       : Unknown
 | 
			
		||||
Dirty LED Shows Drive Activity   : No
 | 
			
		||||
BIOS Continue on Error           : 0 
 | 
			
		||||
Spin Down Mode                   : None
 | 
			
		||||
Allowed Device Type              : SAS/SATA Mix
 | 
			
		||||
Allow Mix in Enclosure           : Yes
 | 
			
		||||
Allow HDD SAS/SATA Mix in VD     : No
 | 
			
		||||
Allow SSD SAS/SATA Mix in VD     : No
 | 
			
		||||
Allow HDD/SSD Mix in VD          : No
 | 
			
		||||
Allow SATA in Cluster            : No
 | 
			
		||||
Max Chained Enclosures           : 1 
 | 
			
		||||
Disable Ctrl-R                   : No
 | 
			
		||||
Enable Web BIOS                  : No
 | 
			
		||||
Direct PD Mapping                : Yes
 | 
			
		||||
BIOS Enumerate VDs               : Yes
 | 
			
		||||
Restore Hot Spare on Insertion   : No
 | 
			
		||||
Expose Enclosure Devices         : No
 | 
			
		||||
Maintain PD Fail History         : No
 | 
			
		||||
Disable Puncturing               : No
 | 
			
		||||
Zero Based Enclosure Enumeration : Yes
 | 
			
		||||
PreBoot CLI Enabled              : No
 | 
			
		||||
LED Show Drive Activity          : No
 | 
			
		||||
Cluster Disable                  : Yes
 | 
			
		||||
SAS Disable                      : No
 | 
			
		||||
Auto Detect BackPlane Enable     : SGPIO/i2c SEP
 | 
			
		||||
Use FDE Only                     : No
 | 
			
		||||
Enable Led Header                : No
 | 
			
		||||
Delay during POST                : 0 
 | 
			
		||||
EnableCrashDump                  : No
 | 
			
		||||
Disable Online Controller Reset  : No
 | 
			
		||||
EnableLDBBM                      : No
 | 
			
		||||
Un-Certified Hard Disk Drives    : Block
 | 
			
		||||
Treat Single span R1E as R10     : No
 | 
			
		||||
Max LD per array                 : 16
 | 
			
		||||
Power Saving option              : All power saving options are enabled
 | 
			
		||||
Default spin down time in minutes: 0 
 | 
			
		||||
Enable JBOD                      : No
 | 
			
		||||
Time taken to detect CME         : 60s
 | 
			
		||||
 | 
			
		||||
Exit Code: 0x00
 | 
			
		||||
| 
						 | 
				
			
			@ -1,197 +0,0 @@
 | 
			
		|||
                                     
 | 
			
		||||
Adapter #0
 | 
			
		||||
 | 
			
		||||
Enclosure Device ID: 32
 | 
			
		||||
Slot Number: 0
 | 
			
		||||
Drive's position: DiskGroup: 0, Span: 0, Arm: 0
 | 
			
		||||
Enclosure position: N/A
 | 
			
		||||
Device Id: 0
 | 
			
		||||
WWN: 
 | 
			
		||||
Sequence Number: 2
 | 
			
		||||
Media Error Count: 0
 | 
			
		||||
Other Error Count: 0
 | 
			
		||||
Predictive Failure Count: 0
 | 
			
		||||
Last Predictive Failure Event Seq Number: 0
 | 
			
		||||
PD Type: SAS
 | 
			
		||||
 | 
			
		||||
Raw Size: 419.186 GB [0x3465f870 Sectors]
 | 
			
		||||
Non Coerced Size: 418.686 GB [0x3455f870 Sectors]
 | 
			
		||||
Coerced Size: 418.625 GB [0x34540000 Sectors]
 | 
			
		||||
Sector Size:  0
 | 
			
		||||
Firmware state: Online, Spun Up
 | 
			
		||||
Device Firmware Level: ES64
 | 
			
		||||
Shield Counter: 0
 | 
			
		||||
Successful diagnostics completion on :  N/A
 | 
			
		||||
SAS Address(0): 0x5000c50028f2083d
 | 
			
		||||
SAS Address(1): 0x0
 | 
			
		||||
Connected Port Number: 0(path0) 
 | 
			
		||||
Inquiry Data: SEAGATE ST3450857SS     ES643SK26856            
 | 
			
		||||
FDE Capable: Not Capable
 | 
			
		||||
FDE Enable: Disable
 | 
			
		||||
Secured: Unsecured
 | 
			
		||||
Locked: Unlocked
 | 
			
		||||
Needs EKM Attention: No
 | 
			
		||||
Foreign State: None 
 | 
			
		||||
Device Speed: Unknown 
 | 
			
		||||
Link Speed: Unknown 
 | 
			
		||||
Media Type: Hard Disk Device
 | 
			
		||||
Drive Temperature :37C (98.60 F)
 | 
			
		||||
PI Eligibility:  No 
 | 
			
		||||
Drive is formatted for PI information:  No
 | 
			
		||||
PI: No PI
 | 
			
		||||
Port-0 :
 | 
			
		||||
Port status: Active
 | 
			
		||||
Port's Linkspeed: Unknown 
 | 
			
		||||
Port-1 :
 | 
			
		||||
Port status: Active
 | 
			
		||||
Port's Linkspeed: Unknown 
 | 
			
		||||
Drive has flagged a S.M.A.R.T alert : No
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Enclosure Device ID: 32
 | 
			
		||||
Slot Number: 1
 | 
			
		||||
Drive's position: DiskGroup: 0, Span: 0, Arm: 1
 | 
			
		||||
Enclosure position: N/A
 | 
			
		||||
Device Id: 1
 | 
			
		||||
WWN: 
 | 
			
		||||
Sequence Number: 2
 | 
			
		||||
Media Error Count: 0
 | 
			
		||||
Other Error Count: 0
 | 
			
		||||
Predictive Failure Count: 0
 | 
			
		||||
Last Predictive Failure Event Seq Number: 0
 | 
			
		||||
PD Type: SAS
 | 
			
		||||
 | 
			
		||||
Raw Size: 419.186 GB [0x3465f870 Sectors]
 | 
			
		||||
Non Coerced Size: 418.686 GB [0x3455f870 Sectors]
 | 
			
		||||
Coerced Size: 418.625 GB [0x34540000 Sectors]
 | 
			
		||||
Sector Size:  0
 | 
			
		||||
Firmware state: Online, Spun Up
 | 
			
		||||
Device Firmware Level: ES62
 | 
			
		||||
Shield Counter: 0
 | 
			
		||||
Successful diagnostics completion on :  N/A
 | 
			
		||||
SAS Address(0): 0x5000c50023cb3f39
 | 
			
		||||
SAS Address(1): 0x0
 | 
			
		||||
Connected Port Number: 1(path0) 
 | 
			
		||||
Inquiry Data: SEAGATE ST3450857SS     ES623SK16HLC            
 | 
			
		||||
FDE Capable: Not Capable
 | 
			
		||||
FDE Enable: Disable
 | 
			
		||||
Secured: Unsecured
 | 
			
		||||
Locked: Unlocked
 | 
			
		||||
Needs EKM Attention: No
 | 
			
		||||
Foreign State: None 
 | 
			
		||||
Device Speed: Unknown 
 | 
			
		||||
Link Speed: Unknown 
 | 
			
		||||
Media Type: Hard Disk Device
 | 
			
		||||
Drive Temperature : N/A
 | 
			
		||||
PI Eligibility:  No 
 | 
			
		||||
Drive is formatted for PI information:  No
 | 
			
		||||
PI: No PI
 | 
			
		||||
Port-0 :
 | 
			
		||||
Port status: Active
 | 
			
		||||
Port's Linkspeed: Unknown 
 | 
			
		||||
Port-1 :
 | 
			
		||||
Port status: Active
 | 
			
		||||
Port's Linkspeed: Unknown 
 | 
			
		||||
Drive has flagged a S.M.A.R.T alert : No
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Enclosure Device ID: 32
 | 
			
		||||
Slot Number: 2
 | 
			
		||||
Drive's position: DiskGroup: 0, Span: 1, Arm: 0
 | 
			
		||||
Enclosure position: N/A
 | 
			
		||||
Device Id: 2
 | 
			
		||||
WWN: 
 | 
			
		||||
Sequence Number: 2
 | 
			
		||||
Media Error Count: 0
 | 
			
		||||
Other Error Count: 0
 | 
			
		||||
Predictive Failure Count: 0
 | 
			
		||||
Last Predictive Failure Event Seq Number: 0
 | 
			
		||||
PD Type: SAS
 | 
			
		||||
 | 
			
		||||
Raw Size: 419.186 GB [0x3465f870 Sectors]
 | 
			
		||||
Non Coerced Size: 418.686 GB [0x3455f870 Sectors]
 | 
			
		||||
Coerced Size: 418.625 GB [0x34540000 Sectors]
 | 
			
		||||
Sector Size:  0
 | 
			
		||||
Firmware state: Online, Spun Up
 | 
			
		||||
Device Firmware Level: ES62
 | 
			
		||||
Shield Counter: 0
 | 
			
		||||
Successful diagnostics completion on :  N/A
 | 
			
		||||
SAS Address(0): 0x5000c50023cea805
 | 
			
		||||
SAS Address(1): 0x0
 | 
			
		||||
Connected Port Number: 2(path0) 
 | 
			
		||||
Inquiry Data: SEAGATE ST3450857SS     ES623SK189BR            
 | 
			
		||||
FDE Capable: Not Capable
 | 
			
		||||
FDE Enable: Disable
 | 
			
		||||
Secured: Unsecured
 | 
			
		||||
Locked: Unlocked
 | 
			
		||||
Needs EKM Attention: No
 | 
			
		||||
Foreign State: None 
 | 
			
		||||
Device Speed: Unknown 
 | 
			
		||||
Link Speed: Unknown 
 | 
			
		||||
Media Type: Hard Disk Device
 | 
			
		||||
Drive Temperature :39C (102.20 F)
 | 
			
		||||
PI Eligibility:  No 
 | 
			
		||||
Drive is formatted for PI information:  No
 | 
			
		||||
PI: No PI
 | 
			
		||||
Port-0 :
 | 
			
		||||
Port status: Active
 | 
			
		||||
Port's Linkspeed: Unknown 
 | 
			
		||||
Port-1 :
 | 
			
		||||
Port status: Active
 | 
			
		||||
Port's Linkspeed: Unknown 
 | 
			
		||||
Drive has flagged a S.M.A.R.T alert : No
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Enclosure Device ID: 32
 | 
			
		||||
Slot Number: 3
 | 
			
		||||
Drive's position: DiskGroup: 0, Span: 1, Arm: 1
 | 
			
		||||
Enclosure position: N/A
 | 
			
		||||
Device Id: 3
 | 
			
		||||
WWN: 
 | 
			
		||||
Sequence Number: 2
 | 
			
		||||
Media Error Count: 0
 | 
			
		||||
Other Error Count: 0
 | 
			
		||||
Predictive Failure Count: 23
 | 
			
		||||
Last Predictive Failure Event Seq Number: 0
 | 
			
		||||
PD Type: SAS
 | 
			
		||||
 | 
			
		||||
Raw Size: 419.186 GB [0x3465f870 Sectors]
 | 
			
		||||
Non Coerced Size: 418.686 GB [0x3455f870 Sectors]
 | 
			
		||||
Coerced Size: 418.625 GB [0x34540000 Sectors]
 | 
			
		||||
Sector Size:  0
 | 
			
		||||
Firmware state: Online, Spun Up
 | 
			
		||||
Device Firmware Level: ES64
 | 
			
		||||
Shield Counter: 0
 | 
			
		||||
Successful diagnostics completion on :  N/A
 | 
			
		||||
SAS Address(0): 0x5000c50029124491
 | 
			
		||||
SAS Address(1): 0x0
 | 
			
		||||
Connected Port Number: 3(path0) 
 | 
			
		||||
Inquiry Data: SEAGATE ST3450857SS     ES643SK27GQ9            
 | 
			
		||||
FDE Capable: Not Capable
 | 
			
		||||
FDE Enable: Disable
 | 
			
		||||
Secured: Unsecured
 | 
			
		||||
Locked: Unlocked
 | 
			
		||||
Needs EKM Attention: No
 | 
			
		||||
Foreign State: None 
 | 
			
		||||
Device Speed: Unknown 
 | 
			
		||||
Link Speed: Unknown 
 | 
			
		||||
Media Type: Hard Disk Device
 | 
			
		||||
Drive Temperature :38C (100.40 F)
 | 
			
		||||
PI Eligibility:  No 
 | 
			
		||||
Drive is formatted for PI information:  No
 | 
			
		||||
PI: No PI
 | 
			
		||||
Port-0 :
 | 
			
		||||
Port status: Active
 | 
			
		||||
Port's Linkspeed: Unknown 
 | 
			
		||||
Port-1 :
 | 
			
		||||
Port status: Active
 | 
			
		||||
Port's Linkspeed: Unknown 
 | 
			
		||||
Drive has flagged a S.M.A.R.T alert : No
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Exit Code: 0x00
 | 
			
		||||
| 
						 | 
				
			
			@ -1,238 +0,0 @@
 | 
			
		|||
// Copyright 2015 The Prometheus Authors
 | 
			
		||||
// Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
// you may not use this file except in compliance with the License.
 | 
			
		||||
// You may obtain a copy of the License at
 | 
			
		||||
//
 | 
			
		||||
// http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
//
 | 
			
		||||
// Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
// distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
// See the License for the specific language governing permissions and
 | 
			
		||||
// limitations under the License.
 | 
			
		||||
 | 
			
		||||
// +build !nomegacli
 | 
			
		||||
 | 
			
		||||
package collector
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"bufio"
 | 
			
		||||
	"io"
 | 
			
		||||
	"os/exec"
 | 
			
		||||
	"strconv"
 | 
			
		||||
	"strings"
 | 
			
		||||
 | 
			
		||||
	"github.com/prometheus/client_golang/prometheus"
 | 
			
		||||
	"gopkg.in/alecthomas/kingpin.v2"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	defaultMegaCli   = "megacli"
 | 
			
		||||
	adapterHeaderSep = "================"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var (
 | 
			
		||||
	megacliCommand = kingpin.Flag("collector.megacli.command", "Command to run megacli.").Default(defaultMegaCli).String()
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type megaCliCollector struct {
 | 
			
		||||
	cli string
 | 
			
		||||
 | 
			
		||||
	driveTemperature *prometheus.GaugeVec
 | 
			
		||||
	driveCounters    *prometheus.GaugeVec
 | 
			
		||||
	drivePresence    *prometheus.GaugeVec
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func init() {
 | 
			
		||||
	registerCollector("megacli", defaultDisabled, NewMegaCliCollector)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewMegaCliCollector returns a new Collector exposing RAID status through
 | 
			
		||||
// megacli.
 | 
			
		||||
func NewMegaCliCollector() (Collector, error) {
 | 
			
		||||
	warnDeprecated("megacli")
 | 
			
		||||
	return &megaCliCollector{
 | 
			
		||||
		cli: *megacliCommand,
 | 
			
		||||
		driveTemperature: prometheus.NewGaugeVec(prometheus.GaugeOpts{
 | 
			
		||||
			Namespace: namespace,
 | 
			
		||||
			Name:      "megacli_drive_temperature_celsius",
 | 
			
		||||
			Help:      "megacli: drive temperature",
 | 
			
		||||
		}, []string{"enclosure", "slot"}),
 | 
			
		||||
		driveCounters: prometheus.NewGaugeVec(prometheus.GaugeOpts{
 | 
			
		||||
			Namespace: namespace,
 | 
			
		||||
			Name:      "megacli_drive_count",
 | 
			
		||||
			Help:      "megacli: drive error and event counters",
 | 
			
		||||
		}, []string{"enclosure", "slot", "type"}),
 | 
			
		||||
		drivePresence: prometheus.NewGaugeVec(prometheus.GaugeOpts{
 | 
			
		||||
			Namespace: namespace,
 | 
			
		||||
			Name:      "megacli_adapter_disk_presence",
 | 
			
		||||
			Help:      "megacli: disk presence per adapter",
 | 
			
		||||
		}, []string{"type"}),
 | 
			
		||||
	}, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c *megaCliCollector) Update(ch chan<- prometheus.Metric) error {
 | 
			
		||||
	if err := c.updateAdapter(); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := c.updateDisks(); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	c.driveTemperature.Collect(ch)
 | 
			
		||||
	c.driveCounters.Collect(ch)
 | 
			
		||||
	c.drivePresence.Collect(ch)
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func parseMegaCliDisks(r io.Reader) (map[int]map[int]map[string]string, error) {
 | 
			
		||||
	var (
 | 
			
		||||
		stats   = map[int]map[int]map[string]string{}
 | 
			
		||||
		scanner = bufio.NewScanner(r)
 | 
			
		||||
		curEnc  = -1
 | 
			
		||||
		curSlot = -1
 | 
			
		||||
	)
 | 
			
		||||
 | 
			
		||||
	for scanner.Scan() {
 | 
			
		||||
		var err error
 | 
			
		||||
		text := strings.TrimSpace(scanner.Text())
 | 
			
		||||
		parts := strings.SplitN(text, ":", 2)
 | 
			
		||||
		if len(parts) != 2 { // Adapter #X
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
		key := strings.TrimSpace(parts[0])
 | 
			
		||||
		value := strings.TrimSpace(parts[1])
 | 
			
		||||
		switch {
 | 
			
		||||
		case key == "Enclosure Device ID":
 | 
			
		||||
			curEnc, err = strconv.Atoi(value)
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				return nil, err
 | 
			
		||||
			}
 | 
			
		||||
		case key == "Slot Number":
 | 
			
		||||
			curSlot, err = strconv.Atoi(value)
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				return nil, err
 | 
			
		||||
			}
 | 
			
		||||
		case curSlot != -1 && curEnc != -1:
 | 
			
		||||
			if _, ok := stats[curEnc]; !ok {
 | 
			
		||||
				stats[curEnc] = map[int]map[string]string{}
 | 
			
		||||
			}
 | 
			
		||||
			if _, ok := stats[curEnc][curSlot]; !ok {
 | 
			
		||||
				stats[curEnc][curSlot] = map[string]string{}
 | 
			
		||||
			}
 | 
			
		||||
			stats[curEnc][curSlot][key] = value
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return stats, scanner.Err()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func parseMegaCliAdapter(r io.Reader) (map[string]map[string]string, error) {
 | 
			
		||||
	var (
 | 
			
		||||
		raidStats = map[string]map[string]string{}
 | 
			
		||||
		scanner   = bufio.NewScanner(r)
 | 
			
		||||
		header    = ""
 | 
			
		||||
		last      = ""
 | 
			
		||||
	)
 | 
			
		||||
 | 
			
		||||
	for scanner.Scan() {
 | 
			
		||||
		text := strings.TrimSpace(scanner.Text())
 | 
			
		||||
		if text == adapterHeaderSep {
 | 
			
		||||
			header = last
 | 
			
		||||
			raidStats[header] = map[string]string{}
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
		last = text
 | 
			
		||||
		if header == "" { // skip Adapter #X and separator
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
		parts := strings.SplitN(text, ":", 2)
 | 
			
		||||
		if len(parts) != 2 { // these section never include anything we are interested in
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
		key := strings.TrimSpace(parts[0])
 | 
			
		||||
		value := strings.TrimSpace(parts[1])
 | 
			
		||||
 | 
			
		||||
		raidStats[header][key] = value
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return raidStats, scanner.Err()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c *megaCliCollector) updateAdapter() error {
 | 
			
		||||
	cmd := exec.Command(c.cli, "-AdpAllInfo", "-aALL")
 | 
			
		||||
	pipe, err := cmd.StdoutPipe()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if err := cmd.Start(); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	stats, err := parseMegaCliAdapter(pipe)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := cmd.Wait(); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for k, v := range stats["Device Present"] {
 | 
			
		||||
		value, err := strconv.ParseFloat(v, 64)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return err
 | 
			
		||||
		}
 | 
			
		||||
		c.drivePresence.WithLabelValues(k).Set(value)
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c *megaCliCollector) updateDisks() error {
 | 
			
		||||
	var counters = []string{"Media Error Count", "Other Error Count", "Predictive Failure Count"}
 | 
			
		||||
 | 
			
		||||
	cmd := exec.Command(c.cli, "-PDList", "-aALL")
 | 
			
		||||
	pipe, err := cmd.StdoutPipe()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if err := cmd.Start(); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	stats, err := parseMegaCliDisks(pipe)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
	if err := cmd.Wait(); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for enc, encStats := range stats {
 | 
			
		||||
		for slot, slotStats := range encStats {
 | 
			
		||||
			encStr := strconv.Itoa(enc)
 | 
			
		||||
			slotStr := strconv.Itoa(slot)
 | 
			
		||||
 | 
			
		||||
			tStr := slotStats["Drive Temperature"]
 | 
			
		||||
			if strings.Index(tStr, "C") > 0 {
 | 
			
		||||
				tStr = tStr[:strings.Index(tStr, "C")]
 | 
			
		||||
				t, err := strconv.ParseFloat(tStr, 64)
 | 
			
		||||
				if err != nil {
 | 
			
		||||
					return err
 | 
			
		||||
				}
 | 
			
		||||
				c.driveTemperature.WithLabelValues(encStr, slotStr).Set(t)
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			for _, i := range counters {
 | 
			
		||||
				counter, err := strconv.ParseFloat(slotStats[i], 64)
 | 
			
		||||
				if err != nil {
 | 
			
		||||
					return err
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				c.driveCounters.WithLabelValues(encStr, slotStr, i).Set(counter)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,95 +0,0 @@
 | 
			
		|||
// Copyright 2015 The Prometheus Authors
 | 
			
		||||
// Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
// you may not use this file except in compliance with the License.
 | 
			
		||||
// You may obtain a copy of the License at
 | 
			
		||||
//
 | 
			
		||||
// http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
//
 | 
			
		||||
// Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
// distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
// See the License for the specific language governing permissions and
 | 
			
		||||
// limitations under the License.
 | 
			
		||||
 | 
			
		||||
// +build !nomegacli
 | 
			
		||||
 | 
			
		||||
package collector
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"os"
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
	"github.com/prometheus/client_golang/prometheus"
 | 
			
		||||
	"gopkg.in/alecthomas/kingpin.v2"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	testMegaCliAdapter = "fixtures/megacli_adapter.txt"
 | 
			
		||||
	testMegaCliDisks   = "fixtures/megacli_disks.txt"
 | 
			
		||||
 | 
			
		||||
	physicalDevicesExpected = "5"
 | 
			
		||||
	virtualDevicesDegraded  = "0"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestMegaCliAdapter(t *testing.T) {
 | 
			
		||||
	data, err := os.Open(testMegaCliAdapter)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		t.Fatal(err)
 | 
			
		||||
	}
 | 
			
		||||
	stats, err := parseMegaCliAdapter(data)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		t.Fatal(err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if stats["Device Present"]["Physical Devices"] != physicalDevicesExpected {
 | 
			
		||||
		t.Fatalf("Unexpected device count: %s != %s", stats["Device Present"]["Physical Devices"], physicalDevicesExpected)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if stats["Device Present"]["Degraded"] != virtualDevicesDegraded {
 | 
			
		||||
		t.Fatalf("Unexpected degraded device count: %s != %s", stats["Device Present"]["Degraded"], virtualDevicesDegraded)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestMegaCliDisks(t *testing.T) {
 | 
			
		||||
	data, err := os.Open(testMegaCliDisks)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		t.Fatal(err)
 | 
			
		||||
	}
 | 
			
		||||
	stats, err := parseMegaCliDisks(data)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		t.Fatal(err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if stats[32][0]["Drive Temperature"] != "37C (98.60 F)" {
 | 
			
		||||
		t.Fatalf("Unexpected drive temperature: %s", stats[32][0]["Drive Temperature"])
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if stats[32][1]["Drive Temperature"] != "N/A" {
 | 
			
		||||
		t.Fatalf("Unexpected drive temperature: %s", stats[32][2]["Drive Temperature"])
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if stats[32][3]["Predictive Failure Count"] != "23" {
 | 
			
		||||
		t.Fatalf("Unexpected predictive failure count: %s", stats[32][3]["Predictive Failure Count"])
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestMegaCliCollectorDoesntCrash(t *testing.T) {
 | 
			
		||||
	if _, err := kingpin.CommandLine.Parse([]string{"--collector.megacli.command", "./fixtures/megacli"}); err != nil {
 | 
			
		||||
		t.Fatal(err)
 | 
			
		||||
	}
 | 
			
		||||
	collector, err := NewMegaCliCollector()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		t.Fatal(err)
 | 
			
		||||
	}
 | 
			
		||||
	sink := make(chan prometheus.Metric)
 | 
			
		||||
	go func() {
 | 
			
		||||
		for {
 | 
			
		||||
			<-sink
 | 
			
		||||
		}
 | 
			
		||||
	}()
 | 
			
		||||
 | 
			
		||||
	err = collector.Update(sink)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		t.Fatal(err)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -31,7 +31,6 @@ enabled_collectors=$(cat << COLLECTORS
 | 
			
		|||
  stat
 | 
			
		||||
  textfile
 | 
			
		||||
  bonding
 | 
			
		||||
  megacli
 | 
			
		||||
  wifi
 | 
			
		||||
  xfs
 | 
			
		||||
  zfs
 | 
			
		||||
| 
						 | 
				
			
			@ -95,7 +94,6 @@ fi
 | 
			
		|||
  $(for c in ${enabled_collectors}; do echo --collector.${c}  ; done) \
 | 
			
		||||
  $(for c in ${disabled_collectors}; do echo --no-collector.${c}  ; done) \
 | 
			
		||||
  --collector.textfile.directory="collector/fixtures/textfile/two_metric_files/" \
 | 
			
		||||
  --collector.megacli.command="collector/fixtures/megacli" \
 | 
			
		||||
  --collector.wifi.fixtures="collector/fixtures/wifi" \
 | 
			
		||||
  --collector.qdisc.fixtures="collector/fixtures/qdisc/" \
 | 
			
		||||
  --web.listen-address "127.0.0.1:${port}" \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue