ceph / ceph-nagios-plugins

Nagios plugins for Ceph
Apache License 2.0
81 stars 80 forks source link

output of 'ceph df' seems to be changed in mimic-Release #42

Closed hihiuztrewq closed 5 years ago

hihiuztrewq commented 6 years ago

I had to change two lines in the check_ceph_df script after upgrading my ceph cluster to mimic:

Line 140 & 141:

<            global_usage_percent = float(globalvals[3])
<            global_available_space = globalvals[1]
>            global_usage_percent = float(globalvals[6])
>            global_available_space = globalvals[2]
valerytschopp commented 6 years ago

Can you please give me a example output of ceph df ?

hihiuztrewq commented 6 years ago

no problem:

user@server1:~$ ceph df
GLOBAL:
    SIZE       AVAIL      RAW USED     %RAW USED
    16 TiB     15 TiB      1.7 TiB         10.64
POOLS:
    NAME        ID     USED        %USED     MAX AVAIL     OBJECTS
    rbd         0          0 B         0       2.0 TiB           0
    volumes     1      743 GiB     26.95       2.0 TiB      193539
    images      2      107 GiB      2.20       4.6 TiB       13680
    backups     3          0 B         0       2.0 TiB           0
    vms         4       19 GiB      0.91       2.0 TiB        4877
    scbench     5       16 GiB      0.78       2.0 TiB        4043
valerytschopp commented 6 years ago

Ok I see the problem, here is the output for Ceph Luminous:

$ ceph --version
ceph version 12.2.7 (3ec878d1e53e1aeb47a9f619c49d9e7c0aa384d5) luminous (stable)
$ ceph df       
GLOBAL:
    SIZE      AVAIL     RAW USED     %RAW USED 
    3088T     1560T        1527T         49.47 
POOLS:
    NAME                   ID     USED       %USED     MAX AVAIL     OBJECTS   
    data                   0        152G      0.06          232T       2499145 
    metadata               1           0         0          232T             0 
    rbd                    2           8         0          232T             1 
    volumes                5        445T     65.73          232T     120311711 
    images                 6       6983G      2.86          232T       2691148 

There is no space between the value and unit (e.g. 152G)

valerytschopp commented 6 years ago

To fix this, we should use the json output:

tschopp@controller:~$ ceph --version
ceph version 12.2.7 (3ec878d1e53e1aeb47a9f619c49d9e7c0aa384d5) luminous (stable)
tschopp@controller:~$ ceph df -f json|jq .
{
  "stats": {
    "total_bytes": 3387723703693312,
    "total_used_bytes": 1681636750491648,
    "total_avail_bytes": 1706086953201664
  },
  "pools": [
    {
      "name": "data",
      "id": 0,
      "stats": {
        "kb_used": 159810944,
        "bytes_used": 163646406656,
        "percent_used": 0.06,
        "max_avail": 253408623722496,
        "objects": 2497046
      }
    },
    {
      "name": "metadata",
      "id": 1,
      "stats": {
        "kb_used": 0,
        "bytes_used": 0,
        "percent_used": 0,
        "max_avail": 253408623722496,
        "objects": 0
      }
    },
    {
      "name": "rbd",
      "id": 2,
      "stats": {
        "kb_used": 1,
        "bytes_used": 8,
        "percent_used": 0,
        "max_avail": 253408623722496,
        "objects": 1
      }
    },
    {
      "name": "volumes",
      "id": 5,
      "stats": {
        "kb_used": 478095492957,
        "bytes_used": 489569784787415,
        "percent_used": 65.89,
        "max_avail": 253408623722496,
        "objects": 120317125
      }
    },
    {
      "name": "images",
      "id": 6,
      "stats": {
        "kb_used": 7370468221,
        "bytes_used": 7547359457400,
        "percent_used": 2.89,
        "max_avail": 253408623722496,
        "objects": 2665118
      }
    }
  ]
}
valerytschopp commented 6 years ago

@hihiuztrewq can you please post the output of ceph df -f json for Mimic?

hihiuztrewq commented 6 years ago

shure

{
   "stats":{
      "total_bytes":17887680761856,
      "total_used_bytes":1909911343104,
      "total_avail_bytes":15977769418752
   },
   "pools":[
      {
         "name":"rbd",
         "id":0,
         "stats":{
            "kb_used":0,
            "bytes_used":0,
            "percent_used":0.000000,
            "max_avail":2160158965760,
            "objects":0
         }
      },
      {
         "name":"volumes",
         "id":1,
         "stats":{
            "kb_used":782236621,
            "bytes_used":801010299101,
            "percent_used":0.270505,
            "max_avail":2160158965760,
            "objects":194283
         }
      },
      {
         "name":"images",
         "id":2,
         "stats":{
            "kb_used":111770552,
            "bytes_used":114453045087,
            "percent_used":0.021968,
            "max_avail":5095488487424,
            "objects":13680
         }
      },
      {
         "name":"backups",
         "id":3,
         "stats":{
            "kb_used":0,
            "bytes_used":0,
            "percent_used":0.000000,
            "max_avail":2160158965760,
            "objects":0
         }
      },
      {
         "name":"vms",
         "id":4,
         "stats":{
            "kb_used":19471742,
            "bytes_used":19939063164,
            "percent_used":0.009146,
            "max_avail":2160158965760,
            "objects":4877
         }
      },
      {
         "name":"scbench",
         "id":5,
         "stats":{
            "kb_used":16556033,
            "bytes_used":16953376792,
            "percent_used":0.007787,
            "max_avail":2160158965760,
            "objects":4043
         }
      }
   ]
}

[Edit: ]

$ ceph --version
ceph version 13.2.1 (5533ecdc0fda920179d7ad84e0aa65a127b20d77) mimic (stable)
valerytschopp commented 5 years ago

Fixed with commit 9ac9de0