Skip to content

Commit

Permalink
fix sensu checks
Browse files Browse the repository at this point in the history
  • Loading branch information
paulczar committed Mar 18, 2015
1 parent 35f7ba1 commit f6186e5
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 92 deletions.
4 changes: 2 additions & 2 deletions sensu/plugins/check-cinder-sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import subprocess
import sys

from novaclient.v2.client import Client as nova_client
from novaclient.v1_1.client import Client as nova_client

CREDS = {
'username': os.environ['OS_USERNAME'],
Expand Down Expand Up @@ -74,7 +74,7 @@ def main():
print "Volume %s is 'in-use' but not " \
"connected" % vol['id']
failure = True
except Exeception as e:
except Exception as e:
print "Could not run check: %s" % e
sys.exit(2)
sys.exit(failure)
Expand Down
13 changes: 10 additions & 3 deletions sensu/plugins/check-glance-store.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python2.7

import argparse
import logging
import os
import pytz
Expand All @@ -23,7 +24,13 @@
'region_name': 'RegionOne',
}

store_directory = os.environ['GLANCE_IMAGE_DIR']

argparser = argparse.ArgumentParser()
argparser.add_argument('--imagedir', help='Glance file store image directory',
default='/var/lib/glance/images')
options = argparser.parse_args()

store_directory = options.imagedir

if 'OS_CACERT' in os.environ.keys():
glance_auth['ca_cert'] = os.environ['OS_CACERT']
Expand All @@ -36,7 +43,7 @@
endpoint_type='publicURL')

# logging.basicConfig(level=logging.DEBUG)
glance = client.Client('1', endpoint=endpoint, token=auth_token)
glance = client.Client('2', endpoint=endpoint, token=auth_token)
glance.format = 'json'

# Fetch the list of files in store_directory matching the UUID regex
Expand All @@ -52,7 +59,7 @@
glance_images = []
for x in glance.images.list():
if x.status == 'active':
tz_aware_time = pytz.utc.localize(parser.parse(x.created_at))
tz_aware_time = parser.parse(x.created_at)
glance_images.append((x.id, x.size, tz_aware_time))

# Check all active images 1 hour or older are present
Expand Down
85 changes: 0 additions & 85 deletions sensu/plugins/check-neutron-fip.sh

This file was deleted.

2 changes: 1 addition & 1 deletion sensu/plugins/metrics-nova-state.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import time
import os

from novaclient.v3 import Client
from novaclient.v1_1 import Client

DEFAULT_SCHEME = '{}.nova.states'.format(socket.gethostname())

Expand Down
2 changes: 1 addition & 1 deletion sensu/plugins/metrics-nova.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import time
import os

from novaclient.v3 import Client
from novaclient.v1_1 import Client

DEFAULT_SCHEME = '{}.nova.hypervisors'.format(socket.gethostname())

Expand Down

0 comments on commit f6186e5

Please sign in to comment.