Skip to content

Commit

Permalink
Update readme file
Browse files Browse the repository at this point in the history
  • Loading branch information
buaazp committed Apr 17, 2015
1 parent a33d3c5 commit bcd28a2
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 58 deletions.
89 changes: 44 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,18 @@ This package is used for go codes to get MegaRaid stat.
Create a DiskStatus struct by calling diskutil.NewDiskStatus(). You need provide the MegaCli binary path and the count of RAID card in your server.

```
ds, err := diskutil.NewDiskStatus("/opt/MegaRAID/MegaCli/MegaCli64", 1)
if err != nil {
fmt.Fprintf(os.Stderr, "DiskStatus New error: %v\n", err)
return
}
err = ds.Get()
if err != nil {
fmt.Fprintf(os.Stderr, "DiskStatus Get error: %v\n", err)
return
}
fmt.Println(ds)
ds, err := diskutil.NewDiskStatus(megaPath, adapterCount)
if err != nil {
fmt.Fprintf(os.Stderr, "DiskStatus New error: %v\n", err)
return
}
err = ds.Get()
if err != nil {
fmt.Fprintf(os.Stderr, "DiskStatus Get error: %v\n", err)
return
}
fmt.Println(ds)
```

After calling ds.Get(), you can visit any stat in the DiskStatus like this:
Expand All @@ -39,38 +38,38 @@ Or print the DiskStatus in json format:

```
{
"adapter_stats": [
{
"id": 0,
"virtual_drive_stats": [
{
"virtual_drive": 0,
"name": "",
"size": "278.875 GB",
"state": "Optimal",
"number_of_drives": 1,
"encryption_type": "None"
}
],
"physical_drive_stats": [
{
"enclosure_device_id": 64,
"device_id": 8,
"slot_number": 0,
"media_error_count": 0,
"other_error_count": 0,
"predictive_failure_count": 0,
"pd_type": "SAS",
"raw_size": "279.396 GB [0x22ecb25c Sectors]",
"firmware_state": "Online, Spun Up",
"brand": "SEAGATE",
"model": "ST9300605SS",
"serial_number": "00046XP4MQNJ",
"drive_emperature": "65C (149.00 F)"
}
]
}
]
"adapter_stats": [
{
"id": 0,
"virtual_drive_stats": [
{
"virtual_drive": 0,
"name": "",
"size": "278.875 GB",
"state": "Optimal",
"number_of_drives": 1,
"encryption_type": "None"
}
],
"physical_drive_stats": [
{
"enclosure_device_id": 64,
"device_id": 8,
"slot_number": 0,
"media_error_count": 0,
"other_error_count": 0,
"predictive_failure_count": 0,
"pd_type": "SAS",
"raw_size": "279.396 GB [0x22ecb25c Sectors]",
"firmware_state": "Online, Spun Up",
"brand": "SEAGATE",
"model": "ST9300605SS",
"serial_number": "00046XP4MQNJ",
"drive_emperature": "65C (149.00 F)"
}
]
}
]
}
```

Expand Down
26 changes: 13 additions & 13 deletions doc.go
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
/*
This package is used for go codes to get MegaRaid stat.
Create a DiskStatus struct by calling diskutil.NewDiskStatus(). You need provide the MegaCli binary path and the count of RAID card in your server.
Usage
ds, err := diskutil.NewDiskStatus("/opt/MegaRAID/MegaCli/MegaCli64", 1)
if err != nil {
fmt.Fprintf(os.Stderr, "DiskStatus New error: %v\n", err)
return
}
Create a DiskStatus struct by calling diskutil.NewDiskStatus(). You need provide the MegaCli binary path and the count of RAID card in your server.
err = ds.Get()
if err != nil {
fmt.Fprintf(os.Stderr, "DiskStatus Get error: %v\n", err)
return
}
ds, err := diskutil.NewDiskStatus(megaPath, adapterCount)
if err != nil {
fmt.Fprintf(os.Stderr, "DiskStatus New error: %v\n", err)
return
}
fmt.Println(ds)
err = ds.Get()
if err != nil {
fmt.Fprintf(os.Stderr, "DiskStatus Get error: %v\n", err)
return
}
fmt.Println(ds)
After calling ds.Get(), you can visit any stat in the DiskStatus like this:
Expand Down

0 comments on commit bcd28a2

Please sign in to comment.