diff --git a/sensu/files/checks/check_ceph_df b/sensu/files/checks/check_ceph_df
new file mode 100755
index 0000000..f841b55
--- /dev/null
+++ b/sensu/files/checks/check_ceph_df
@@ -0,0 +1,155 @@
+#!/usr/bin/env python
+#
+#  Copyright (c) 2013 SWITCH http://www.switch.ch
+#
+#  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.
+#
+
+import argparse
+import os
+import subprocess
+import sys
+
+__version__ = '1.0.1'
+
+# default ceph values
+CEPH_COMMAND = '/usr/bin/ceph'
+
+# nagios exit code
+STATUS_OK = 0
+STATUS_WARNING = 1
+STATUS_ERROR = 2
+STATUS_UNKNOWN = 3
+
+def main():
+
+    # parse args
+    parser = argparse.ArgumentParser(description="'ceph df' nagios plugin.")
+    parser.add_argument('-e','--exe', help='ceph executable [%s]' % CEPH_COMMAND)
+    parser.add_argument('-c','--conf', help='alternative ceph conf file')
+    parser.add_argument('-m','--monaddress', help='ceph monitor address[:port]')    
+    parser.add_argument('-i','--id', help='ceph client id')
+    parser.add_argument('-n','--name', help='ceph client name')
+    parser.add_argument('-k','--keyring', help='ceph client keyring file')
+    parser.add_argument('-d','--detail', help="show pool details on warn and critical", action='store_true')
+    parser.add_argument('-W','--warn', help="warn above this percent RAW USED")
+    parser.add_argument('-C','--critical', help="critical alert above this percent RAW USED")
+    parser.add_argument('-V','--version', help='show version and exit', action='store_true')
+    args = parser.parse_args()
+   
+    # validate args
+    ceph_exec = args.exe if args.exe else CEPH_COMMAND
+    if not os.path.exists(ceph_exec):
+        print "ERROR: ceph executable '%s' doesn't exist" % ceph_exec
+        return STATUS_UNKNOWN
+    
+    if args.version:
+        print 'version %s' % __version__
+        return STATUS_OK
+
+    if args.conf and not os.path.exists(args.conf):
+        print "ERROR: ceph conf file '%s' doesn't exist" % args.conf
+        return STATUS_UNKNOWN
+    
+    if args.keyring and not os.path.exists(args.keyring):
+        print "ERROR: keyring file '%s' doesn't exist" % args.keyring
+        return STATUS_UNKNOWN
+
+    if args.warn > args.critical or not args.warn or not args.critical:
+        print "ERROR: warn and critical level must be set and critical must be greater than warn"
+        return STATUS_UNKNOWN
+    
+    # build command
+    ceph_df = [ceph_exec]
+    if args.monaddress:
+        ceph_df.append('-m')
+        ceph_df.append(args.monaddress)
+    if args.conf:
+        ceph_df.append('-c')
+        ceph_df.append(args.conf)
+    if args.id:
+        ceph_df.append('--id')
+        ceph_df.append(args.id)
+    if args.name:
+        ceph_df.append('--name')
+        ceph_df.append(args.name)
+    if args.keyring:
+        ceph_df.append('--keyring')
+        ceph_df.append(args.keyring)
+    ceph_df.append('df')
+
+    #print ceph_df
+    
+    # exec command
+    p = subprocess.Popen(ceph_df,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
+    output, err = p.communicate()
+    
+    # parse output
+    # print "DEBUG: output:", output
+    # print "DEBUG: err:", err
+    if output:
+        # parse output
+        # if detail switch was not set only show global values and compare to warning and critical
+        # otherwise show space for pools too
+        result=output.splitlines()
+        # values for GLOBAL are in 3rd line of output
+        globalline = result[2]
+        globalvals = globalline.split(' ')
+        # strip all empty values from list
+        globalvals = [x for x in globalvals if x != '']
+
+        # prepare pool values
+        # pool output starts in line 4 with the bare word POOLS: followed by the output
+        poolline = result[3:]
+        # print 'DEBUG:', globalvals
+        # finally 4th element contains percentual value
+        # print 'DEBUG USAGE:', globalvals[3]
+        global_usage_percent = globalvals[3]
+        global_available_space = globalvals[1]
+        global_total_space = globalvals[0]
+        # print 'DEBUG WARNLEVEL:', args.warn
+        # print 'DEBUG CRITICALLEVEL:', args.critical
+        if global_usage_percent > args.critical:
+            if args.detail:
+                    poolline.insert(0, '\n')
+                    poolout = '\n '.join(poolline)
+            else:
+                    poolout = ''
+            print 'CRITICAL: global RAW usage of %s%% is above %s%% (%s of %s free)%s' % (global_usage_percent, args.critical, global_available_space, global_total_space, poolout)
+            return STATUS_ERROR
+        elif global_usage_percent > args.warn:
+            if args.detail:
+                    poolline.insert(0, '\n')
+                    poolout = '\n '.join(poolline)
+            else:
+                    poolout = ''
+            print 'WARNING: global RAW usage of %s%% is above %s%% (%s of %s free)%s' % (global_usage_percent, args.warn, global_available_space, global_total_space, poolout)
+            return STATUS_WARNING 
+        else:
+            print 'RAW usage %s%%' % global_usage_percent
+            return STATUS_OK
+    elif err:
+        # read only first line of error
+        one_line = err.split('\n')[0]
+        if '-1 ' in one_line:
+            idx = one_line.rfind('-1 ')
+            print 'ERROR: %s: %s' % (ceph_exec, one_line[idx+len('-1 '):])
+        else:
+            print one_line
+    
+    return STATUS_UNKNOWN
+
+
+if __name__ == "__main__":
+    sys.exit(main())
+
diff --git a/sensu/files/checks/check_ceph_health b/sensu/files/checks/check_ceph_health
new file mode 100755
index 0000000..b164e45
--- /dev/null
+++ b/sensu/files/checks/check_ceph_health
@@ -0,0 +1,130 @@
+#!/usr/bin/env python
+#
+#  Copyright (c) 2013 SWITCH http://www.switch.ch
+#
+#  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.
+#
+
+import argparse
+import os
+import subprocess
+import sys
+
+__version__ = '1.0.1'
+
+# default ceph values
+CEPH_COMMAND = '/usr/bin/ceph'
+
+# nagios exit code
+STATUS_OK = 0
+STATUS_WARNING = 1
+STATUS_ERROR = 2
+STATUS_UNKNOWN = 3
+
+def main():
+
+    # parse args
+    parser = argparse.ArgumentParser(description="'ceph health' nagios plugin.")
+    parser.add_argument('-e','--exe', help='ceph executable [%s]' % CEPH_COMMAND)
+    parser.add_argument('-c','--conf', help='alternative ceph conf file')
+    parser.add_argument('-m','--monaddress', help='ceph monitor address[:port]')    
+    parser.add_argument('-i','--id', help='ceph client id')
+    parser.add_argument('-n','--name', help='ceph client name')
+    parser.add_argument('-k','--keyring', help='ceph client keyring file')
+    parser.add_argument('-d','--detail', help="exec 'ceph health detail'", action='store_true')
+    parser.add_argument('-V','--version', help='show version and exit', action='store_true')
+    args = parser.parse_args()
+   
+    # validate args
+    ceph_exec = args.exe if args.exe else CEPH_COMMAND
+    if not os.path.exists(ceph_exec):
+        print "ERROR: ceph executable '%s' doesn't exist" % ceph_exec
+        return STATUS_UNKNOWN
+    
+    if args.version:
+        print 'version %s' % __version__
+        return STATUS_OK
+
+    if args.conf and not os.path.exists(args.conf):
+        print "ERROR: ceph conf file '%s' doesn't exist" % args.conf
+        return STATUS_UNKNOWN
+    
+    if args.keyring and not os.path.exists(args.keyring):
+        print "ERROR: keyring file '%s' doesn't exist" % args.keyring
+        return STATUS_UNKNOWN
+    
+    # build command
+    ceph_health = [ceph_exec]
+    if args.monaddress:
+        ceph_health.append('-m')
+        ceph_health.append(args.monaddress)
+    if args.conf:
+        ceph_health.append('-c')
+        ceph_health.append(args.conf)
+    if args.id:
+        ceph_health.append('--id')
+        ceph_health.append(args.id)
+    if args.name:
+        ceph_health.append('--name')
+        ceph_health.append(args.name)
+    if args.keyring:
+        ceph_health.append('--keyring')
+        ceph_health.append(args.keyring)
+    ceph_health.append('health')
+    if args.detail:
+        ceph_health.append('detail')
+
+    #print ceph_health
+    
+    # exec command
+    p = subprocess.Popen(ceph_health,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
+    output, err = p.communicate()
+    
+    # parse output
+    #print "output:", output
+    #print "err:", err
+    if output:
+        # merge multi-lines of output in one line
+        one_line = output.replace('\n','; ')
+        if one_line.startswith('HEALTH_OK'):
+            #print 'HEALTH OK:', one_line[len('HEALTH_OK')+1:]
+            one_line= one_line[len('HEALTH_OK')+1:].strip()
+            if one_line:
+                print 'HEALTH OK:', one_line
+            else:
+                print 'HEALTH OK'
+            return STATUS_OK
+        elif one_line.startswith('HEALTH_WARN'):
+            print 'HEALTH WARNING:', one_line[len('HEALTH_WARN')+1:]
+            return STATUS_WARNING
+        elif one_line.startswith('HEALTH_ERR'):
+            print 'HEALTH ERROR:', one_line[len('HEALTH_ERR')+1:]
+            return STATUS_ERROR
+        else:
+            print one_line
+        
+    elif err:
+        # read only first line of error
+        one_line = err.split('\n')[0]
+        if '-1 ' in one_line:
+            idx = one_line.rfind('-1 ')
+            print 'ERROR: %s: %s' % (ceph_exec, one_line[idx+len('-1 '):])
+        else:
+            print one_line
+    
+    return STATUS_UNKNOWN
+
+
+if __name__ == "__main__":
+    sys.exit(main())
+
diff --git a/sensu/files/checks/check_ceph_mon b/sensu/files/checks/check_ceph_mon
new file mode 100755
index 0000000..e00f0eb
--- /dev/null
+++ b/sensu/files/checks/check_ceph_mon
@@ -0,0 +1,162 @@
+#!/usr/bin/env python
+#
+#  Copyright (c) 2013 Catalyst IT http://www.catalyst.net.nz
+#  Copyright (c) 2015 SWITCH http://www.switch.ch
+#
+#  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.
+#
+
+import argparse
+import socket
+import os
+import re
+import subprocess
+import sys
+import json
+
+__version__ = '1.1.0'
+
+# default ceph values
+CEPH_EXEC = '/usr/bin/ceph'
+CEPH_COMMAND = 'quorum_status'
+
+# nagios exit code
+STATUS_OK = 0
+STATUS_WARNING = 1
+STATUS_ERROR = 2
+STATUS_UNKNOWN = 3
+
+##
+# ceph quorum_status output example
+##
+ceph_quorum_status_output_example = '''{
+   "quorum_leader_name" : "s0001",
+   "monmap" : {
+      "mons" : [
+         {
+            "name" : "s0001",
+            "addr" : "[2001:620:5ca1:8000::1001]:6789/0",
+            "rank" : 0
+         },
+         {
+            "name" : "s0003",
+            "addr" : "[2001:620:5ca1:8000::1003]:6789/0",
+            "rank" : 1
+         }
+      ],
+      "created" : "2014-12-15 08:28:35.153650",
+      "epoch" : 2,
+      "modified" : "2014-12-15 08:28:40.371878",
+      "fsid" : "22348d2b-b69d-46cc-9a79-ca93cd6bae84"
+   },
+   "quorum_names" : [
+      "s0001",
+      "s0003"
+   ],
+   "quorum" : [
+      0,
+      1
+   ],
+   "election_epoch" : 24
+}'''
+
+def main():
+
+  # parse args
+  parser = argparse.ArgumentParser(description="'ceph quorum_status' nagios plugin.")
+  parser.add_argument('-e','--exe', help='ceph executable [%s]' % CEPH_EXEC)
+  parser.add_argument('-c','--conf', help='alternative ceph conf file')
+  parser.add_argument('-m','--monaddress', help='ceph monitor to use for queries (address[:port])')    
+  parser.add_argument('-i','--id', help='ceph client id')
+  parser.add_argument('-k','--keyring', help='ceph client keyring file')
+  parser.add_argument('-V','--version', help='show version and exit', action='store_true')
+  parser.add_argument('-I','--monid', help='mon ID to be checked for availability')
+  args = parser.parse_args()
+ 
+  if args.version:
+    print 'version %s' % __version__
+    return STATUS_OK
+
+  # validate args
+  ceph_exec = args.exe if args.exe else CEPH_EXEC
+  if not os.path.exists(ceph_exec):
+    print "MON ERROR: ceph executable '%s' doesn't exist" % ceph_exec
+    return STATUS_UNKNOWN
+  
+  if args.conf and not os.path.exists(args.conf):
+    print "MON ERROR: ceph conf file '%s' doesn't exist" % args.conf
+    return STATUS_UNKNOWN
+  
+  if args.keyring and not os.path.exists(args.keyring):
+    print "MON ERROR: keyring file '%s' doesn't exist" % args.keyring
+    return STATUS_UNKNOWN
+  
+  if not args.monid:
+    print "MON ERROR: no MON ID given, use -I/--monid parameter"
+    return STATUS_UNKNOWN
+
+  # build command
+  ceph_cmd = [ceph_exec]
+  if args.monaddress:
+    ceph_cmd.append('-m')
+    ceph_cmd.append(args.monaddress)
+  if args.conf:
+    ceph_cmd.append('-c')
+    ceph_cmd.append(args.conf)
+  if args.id:
+    ceph_cmd.append('--id')
+    ceph_cmd.append(args.id)
+  if args.keyring:
+    ceph_cmd.append('--keyring')
+    ceph_cmd.append(args.keyring)
+  ceph_cmd.append(CEPH_COMMAND)
+
+  # exec command
+  p = subprocess.Popen(ceph_cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
+  output, err = p.communicate()
+
+  if p.returncode != 0 or not output:
+    print "MON ERROR: %s" % err
+    return STATUS_ERROR
+
+  # load json output and parse
+  quorum_status = False
+  try:
+    quorum_status = json.loads(output)
+  except Exception as e:
+    print "MON ERROR: could not parse '%s' output: %s: %s" % (CEPH_COMMAND,output,e)
+    return STATUS_UNKNOWN
+
+  #print "XXX: quorum_status['quorum_names']:", quorum_status['quorum_names']
+
+  # do our checks
+  is_monitor = False
+  for mon in quorum_status['monmap']['mons']:
+    if mon['name'] == args.monid:
+      is_monitor = True
+  if not is_monitor:
+    print "MON WARN: mon '%s' is not in monmap: %s" % (args.monid,quorum_status['monmap']['mons'])
+    return STATUS_WARNING
+
+  in_quorum = args.monid in quorum_status['quorum_names']
+  if in_quorum:
+    print "MON OK"
+    return STATUS_OK
+  else:
+    print "MON WARN: no MON '%s' found in quorum" % args.monid
+    return STATUS_WARNING
+
+# main
+if __name__ == "__main__":
+  sys.exit(main())
+
diff --git a/sensu/files/checks/check_ceph_osd b/sensu/files/checks/check_ceph_osd
new file mode 100755
index 0000000..64f13e3
--- /dev/null
+++ b/sensu/files/checks/check_ceph_osd
@@ -0,0 +1,142 @@
+#!/usr/bin/env python
+#
+#  Copyright (c) 2013 Catalyst IT http://www.catalyst.net.nz
+#
+#  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.
+#
+
+import argparse
+import os
+import re
+import subprocess
+import sys
+import socket
+
+__version__ = '1.1.0'
+
+# default ceph values
+CEPH_COMMAND = '/usr/bin/ceph'
+
+# nagios exit code
+STATUS_OK = 0
+STATUS_WARNING = 1
+STATUS_ERROR = 2
+STATUS_UNKNOWN = 3
+
+def main():
+
+  # parse args
+  parser = argparse.ArgumentParser(description="'ceph osd' nagios plugin.")
+  parser.add_argument('-e','--exe', help='ceph executable [%s]' % CEPH_COMMAND)
+  parser.add_argument('-c','--conf', help='alternative ceph conf file')
+  parser.add_argument('-m','--monaddress', help='ceph monitor address[:port]')    
+  parser.add_argument('-i','--id', help='ceph client id')
+  parser.add_argument('-k','--keyring', help='ceph client keyring file')
+  parser.add_argument('-V','--version', help='show version and exit', action='store_true')
+  parser.add_argument('-H','--host', help='osd host', required=True)
+  parser.add_argument('-I','--osdid', help='osd id', required=False)
+  parser.add_argument('-o','--out', help='check osds that are set OUT', default=False, action='store_true', required=False)
+  args = parser.parse_args()
+ 
+  # validate args
+  ceph_exec = args.exe if args.exe else CEPH_COMMAND
+  if not os.path.exists(ceph_exec):
+    print "OSD ERROR: ceph executable '%s' doesn't exist" % ceph_exec
+    return STATUS_UNKNOWN
+  
+  if args.version:
+    print 'version %s' % __version__
+    return STATUS_OK
+
+  if args.conf and not os.path.exists(args.conf):
+    print "OSD ERROR: ceph conf file '%s' doesn't exist" % args.conf
+    return STATUS_UNKNOWN
+  
+  if args.keyring and not os.path.exists(args.keyring):
+    print "OSD ERROR: keyring file '%s' doesn't exist" % args.keyring
+    return STATUS_UNKNOWN
+  
+  if not args.osdid:
+    args.osdid = '[^ ]*'
+
+  if not args.host:
+    print "OSD ERROR: no OSD hostname given"
+    return STATUS_UNKNOWN
+
+  try:
+    args.host = socket.gethostbyname(args.host)
+  except socket.gaierror:
+    print 'OSD ERROR: could not resolve %s' % args.host
+    return STATUS_UNKNOWN
+
+
+  # build command
+  ceph_cmd = [ceph_exec]
+  if args.monaddress:
+      ceph_cmd.append('-m')
+      ceph_cmd.append(args.monaddress)
+  if args.conf:
+      ceph_cmd.append('-c')
+      ceph_cmd.append(args.conf)
+  if args.id:
+      ceph_cmd.append('--id')
+      ceph_cmd.append(args.id)
+  if args.keyring:
+      ceph_cmd.append('--keyring')
+      ceph_cmd.append(args.keyring)
+  ceph_cmd.append('osd')
+  ceph_cmd.append('dump')
+
+  # exec command
+  p = subprocess.Popen(ceph_cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
+  output, err = p.communicate()
+  
+  if err or not output:
+    print "OSD ERROR: %s" % err
+    return STATUS_ERROR
+
+  # escape IPv4 host address
+  osd_host = args.host.replace('.', '\.')
+  # escape IPv6 host address
+  osd_host = osd_host.replace('[', '\[')
+  osd_host = osd_host.replace(']', '\]')
+  up = re.findall(r"^(osd\.%s) up.* %s:" % (args.osdid, osd_host), output, re.MULTILINE)
+  if args.out:
+    down = re.findall(r"^(osd\.%s) down.* %s:" % (args.osdid, osd_host), output, re.MULTILINE)
+    down_in = re.findall(r"^(osd\.%s) down[ ]+in.* %s:" % (args.osdid, osd_host), output, re.MULTILINE)
+    down_out = re.findall(r"^(osd\.%s) down[ ]+out.* %s:" % (args.osdid, osd_host), output, re.MULTILINE)
+  else:
+    down = re.findall(r"^(osd\.%s) down[ ]+in.* %s:" % (args.osdid, osd_host), output, re.MULTILINE)
+    down_in = down
+    down_out = re.findall(r"^(osd\.%s) down[ ]+out.* %s:" % (args.osdid, osd_host), output, re.MULTILINE)
+
+  if down:
+    print "OSD WARN: Down OSD%s on %s: %s" % ('s' if len(down)>1 else '', args.host, " ".join(down))
+    print "Up OSDs: " + " ".join(up)
+    print "Down+In OSDs: " + " ".join(down_in)
+    print "Down+Out OSDs: " + " ".join(down_out)
+    return STATUS_WARNING
+
+  if up:
+    print "OSD OK"
+    print "Up OSDs: " + " ".join(up)
+    print "Down+In OSDs: " + " ".join(down_in)
+    print "Down+Out OSDs: " + " ".join(down_out)
+    return STATUS_OK
+
+  print "OSD WARN: no OSD.%s found on host %s" % (args.osdid, args.host)
+  return STATUS_WARNING
+
+if __name__ == "__main__":
+    sys.exit(main())
+
diff --git a/sensu/files/checks/check_ceph_rgw b/sensu/files/checks/check_ceph_rgw
new file mode 100755
index 0000000..87c214f
--- /dev/null
+++ b/sensu/files/checks/check_ceph_rgw
@@ -0,0 +1,111 @@
+#!/usr/bin/env python
+#
+#  Copyright (c) 2014 Catalyst IT http://www.catalyst.net.nz
+#  Copyright (c) 2015 SWITCH http://www.switch.ch
+#
+#  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.
+#
+
+import argparse
+import os
+import re
+import subprocess
+import sys
+import json
+
+__version__ = '1.3.0'
+
+# default ceph values
+RGW_COMMAND = '/usr/bin/radosgw-admin'
+
+# nagios exit code
+STATUS_OK = 0
+STATUS_WARNING = 1
+STATUS_ERROR = 2
+STATUS_UNKNOWN = 3
+
+def main():
+
+  # parse args
+  parser = argparse.ArgumentParser(description="'radosgw-admin bucket stats' nagios plugin.")
+  parser.add_argument('-d','--detail', help='output perf data for all buckets', action='store_true')
+  parser.add_argument('-B','--byte', help='output perf data in Byte instead of KB', action='store_true')
+  parser.add_argument('-e','--exe', help='radosgw-admin executable [%s]' % RGW_COMMAND)
+  parser.add_argument('-c','--conf', help='alternative ceph conf file')
+  parser.add_argument('-i','--id', help='ceph client id')
+  parser.add_argument('-V','--version', help='show version and exit', action='store_true')
+  args = parser.parse_args()
+ 
+  # validate args
+  rgw_exec = args.exe if args.exe else RGW_COMMAND
+  if not os.path.exists(rgw_exec):
+    print "RGW ERROR: radosgw-admin executable '%s' doesn't exist" % rgw_exec
+    return STATUS_UNKNOWN
+  
+  if args.version:
+    print 'version %s' % __version__
+    return STATUS_OK
+
+  if args.conf and not os.path.exists(args.conf):
+    print "RGW ERROR: ceph conf file '%s' doesn't exist" % args.conf
+    return STATUS_UNKNOWN
+  
+  # build command
+  rgw_cmd = [rgw_exec]
+  if args.conf:
+    rgw_cmd.append('-c')
+    rgw_cmd.append(args.conf)
+  if args.id:
+    rgw_cmd.append('-i')
+    rgw_cmd.append(args.id)
+  rgw_cmd.append('bucket')
+  rgw_cmd.append('stats')
+
+  # exec command
+  p = subprocess.Popen(rgw_cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
+  output, err = p.communicate()
+
+  if p.returncode != 0 or not output:
+    print "RGW ERROR: %s :: %s" % (output, err)
+    return STATUS_ERROR
+
+  bucket_stats = json.loads(output)
+  #print bucket_stats
+  buckets = []
+  for i in bucket_stats:
+    if type(i) is dict:
+      bucket_name = i['bucket']
+      usage_dict = i['usage']
+      if not usage_dict:
+        bucket_usage_kb = 0
+      else:
+        bucket_usage_kb = usage_dict['rgw.main']['size_kb_actual']
+      buckets.append((bucket_name, bucket_usage_kb))
+  buckets_total_kb =  sum([b[1] for b in buckets])
+  if args.byte:
+    status = "RGW OK: {} buckets, {} KB total | /={}B ".format(len(buckets),buckets_total_kb,buckets_total_kb*1024)
+  else:
+    status = "RGW OK: {} buckets, {} KB total | /={}KB ".format(len(buckets),buckets_total_kb,buckets_total_kb)
+  #print buckets
+  if buckets and args.detail:
+    if args.byte:
+      status = status + " ".join(["{}={}B".format(b[0],b[1]*1024) for b in buckets])
+    else:
+      status = status + " ".join(["{}={}KB".format(b[0],b[1]) for b in buckets])
+
+  print status
+  return STATUS_OK
+
+if __name__ == "__main__":
+  sys.exit(main())
+
