[hobbit] Roracle

Levin, Alexandre alevin at reveredata.com
Thu Nov 8 08:19:29 CET 2007


As an addition to Roracle,  feel free to  use following script ( on the
client in the ext folder ) to chart ( ncv ) tablespace usage:

 

 

================

#!/usr/local/bin/python

 

import os

import sys

import cx_Oracle

import StringIO

import socket

import time

import string

 

#

BB = os.environ["BB"]

BBTMP = os.environ["BBTMP"]

BBDISP = os.environ["BBDISP"]

 

os.environ['BBPROG'] = 'ora-tbs.py'

 

TEST = 'oratbs'

os.environ['TEST'] = TEST

 

MACHINE = socket.gethostname()

MACHINE = string.replace(MACHINE, '.', ',')

 

DATE = time.strftime("%a %b %d %H:%M:%S %Z %Y",
time.localtime(time.time()))

 

connection = cx_Oracle.connect("dbuser/password")

 

sql = """ SELECT F.TABLESPACE_NAME,

         TO_CHAR ((T.TOTAL_SPACE - F.FREE_SPACE),'999,999') "USED (MB)",

         TO_CHAR (F.FREE_SPACE, '999,999') "FREE (MB)",

         TO_CHAR (T.TOTAL_SPACE, '999,999') "TOTAL (MB)",

         TO_CHAR ((ROUND ((F.FREE_SPACE/T.TOTAL_SPACE)*100)),'999')
PER_FREE

       FROM   (

           SELECT TABLESPACE_NAME,

           ROUND (SUM (BLOCKS*(SELECT VALUE/1024

                  FROM V$PARAMETER

                  WHERE NAME = 'db_block_size')/1024)

              ) FREE_SPACE

       FROM DBA_FREE_SPACE

       GROUP BY TABLESPACE_NAME

       ) F,

       (

         SELECT TABLESPACE_NAME,

         ROUND (SUM (BYTES/1048576)) TOTAL_SPACE

         FROM DBA_DATA_FILES

         GROUP BY TABLESPACE_NAME

       ) T

       WHERE F.TABLESPACE_NAME = T.TABLESPACE_NAME ORDER BY 1

       """

 

cursor = connection.cursor()

cursor.arraysize = 50

cursor.execute (sql)

i1 = cursor.fetchall()

 

output = StringIO.StringIO()

 

for z in range(i1.__len__()):

  print >> output, i1[z][0].ljust(15) + " : " + i1[z][4]

 

L0 = output.getvalue()

output.close()

 

COLOR = 'green'

 

LINE = "status " + MACHINE + "." + TEST + " " + COLOR + " " + DATE + "
Tablespaces on " + MACHINE + '\n' + L0

 

cmd = BB + ' ' + BBDISP + ' "' + LINE + '"'

 

os.system(cmd)

 

=============== 

 

 

___________________________

Alexander Levin

 

From: Ryan Jay B. Lapuz [mailto:rlapuz at fcpp.fujitsu.com] 
Sent: Wednesday, November 07, 2007 4:59 PM
To: hobbit at hswn.dk
Subject: Re: [hobbit] Roracle

 

Hi sir!

 

I'm running oracle on solaris sparc. Could you please help me make it
work. Right now I'm still monitoring tablespace manually because I was
not able to implement it with hobbit. Please make the procedure as
simple as possible because I have limited knowledge in oracle.

 

Thank you very much!

Ryan

	----- Original Message ----- 

	From: Everett, Vernon <mailto:Vernon.Everett at woodside.com.au>  

	To: hobbit at hswn.dk 

	Sent: Wednesday, November 07, 2007 7:38 AM

	Subject: RE: [hobbit] Roracle

	 

	Hi Stefan

	 

	If by Roracle you refer to bb-roracle script available from
deadcat, then yes, I have used it. (This contract, a few years back.
Still have the scripts and ksh binary)

	Damn useful, once you get it working. Gave some good info. I
don't think it did any graphing, but I may be wrong.

	 

	The problem I encountered had to do with the subtle differences
between different implementations of ksh. I suspect this is where you
are getting stuck too.

	Yes, ksh differs from one version to the next, and the
implementation I had on my server (Solaris Sparc) was just never going
to work.

	 

	Eventually, I got so fed up, I downloaded a different version of
ksh, and put it in the ~hobbit directory structure, and changed the #!
line to point to the new ksh.

	It was a horrible fix, but the best I could do under the
circumstances. :-(

	 

	If you are running Solaris on Sparc, I can send you what I have,
but if you on a different architechture and OS, you are pretty much on
your own.

	 

	Cheers

	      V

	 

	 

________________________________

	From: Stefan van der Walt [mailto:skjoldar at gmail.com] 
	Sent: Tuesday, 6 November 2007 10:18 PM
	To: hobbit at hswn.dk
	Subject: [hobbit] Roracle

	Have any of you installed this addon into hobbit?
	
	The instructions are sparse, and I just need to know how to get
the client to know the 
	addon is there?
	
	Thanks
	Stefan

	NOTICE: This email and any attachments are confidential. 
	They may contain legally privileged information or 
	copyright material. You must not read, copy, use or 
	disclose them without authorisation. If you are not an 
	intended recipient, please contact us at once by return 
	email and then delete both messages and all attachments.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20071107/718caf4c/attachment.html>


More information about the Xymon mailing list