source: people/peter.buschman/backup_monitoring/backmon/commands/db/subcommands/test.py

Last change on this file was 976, checked in by peter, on Dec 6, 2011 at 10:19:33 AM

Raw checkin of current NetBackup / TSM parsing code.

File size: 1.2 KB
Line 
1#!/usr/bin/python26
2###
3### backmon.commands.db.test
4###
5
6import sys
7import os
8import os.path
9import glob
10import re
11
12from optparse import OptionParser
13from guppy import hpy
14
15from ....lib import *
16
17from backup_monitoring.debug import *
18from backup_monitoring.math import *
19
20from backup_monitoring.parsing.parsers import bpstulist
21from backup_monitoring.parsing.parsers import df
22from backup_monitoring.parsing.parsers import dsu_ls_l
23from backup_monitoring.parsing.parsers import nbstlutil
24from backup_monitoring.parsing.parsers import nbdevquery
25from backup_monitoring.parsing.parsers import bpdbjobs
26
27usage = 'usage: %prog db test'
28parser = OptionParser(usage=usage)
29
30def run(args, kwargs):
31
32 #
33 # add kwargs to local namespace
34 #
35 for key in kwargs.keys():
36
37 if re.compile('^[A-Z][A-Z_]+$').match(key):
38 exec(key + ' = kwargs[\'' + key + '\']')
39
40 (options, args) = parser.parse_args(args)
41
42
43 #
44 # Test Database Connection
45 #
46 conn = CONN
47 curs = conn.cursor()
48 curs.execute ("SELECT VERSION()")
49 row = curs.fetchone ()
50 print "server version:", row[0]
51 curs.close ()
52 conn.close ()
Note: See TracBrowser for help on using the repository browser.