SWick

Sysadmin-by-Nature

Entries from March 2009.

Baraka
8th March 2009

Tags: movies, trailer, videos.
Tinikling
8th March 2009

Tinikling ist der nationale Tanz der Philippinen.

No tags
Erste Vorbereitungen für Süd-Korea
8th March 2009

Da ich schon immer nach Süd-Korea mal wollte,
ein Stop-Over bei der Australienreise 2007 jedoch zu teuer war, hole ich das 2009 einfach nach.

Ein weiterer Grund für Süd-Korea ist der höhere Schwierigkeitsgrad.
Da es möglich war, sich in Australien '''alleine''' und '''ohne Muttersprache''' durchzuschlagen,
wird dies doch auch in einem Land zu schaffen sein, in dem kaum Englisch gesprochen wird
und dessen Kultur sich noch weiter von der unseren unterscheidet.

Gänzlich unvorbereitet möchte ich auch diesmal nicht sein und nutze daher intensiv das Internet:

Forum

Für Australien war das deutschsprachige Forum http://australien-forum.de sehr hilfreich.
Nicht ganz vergleichbar aber auch für Korea hat sich ein Forum gefunden: http://forum.meet-korea.de

Reiseführer

Beim Stöbern im Forum wurde desöfteren der Reiseführer "Abenteuer Seoul" erwähnt, den ich mir auch gleich bestellt habe.

Beste Reisezeit

Der Reiseführer erwähnte leider nicht, wann denn die beste Reisezeit sei. Auf einer deutschen Wetterseite fand ich jedoch die passende Info dazu:

Von Ende März bis Mai und von September bis Anfang November angenehmes Klima
mit Tagestemperaturen um 20 Grad.

Weitere hilfreiche Seiten

Für Australien findet man haufenweise Infos im Internet, doch in Bezug auf Korea fand ich bisher nur die folgenden Seiten nützlich:

Wie geht's weiter

Mein Urlaubsantrag ist seit ca. 3 Wochen für den ganzen Oktober eingereicht und ich warte immer noch auf das "OK" von Cheffe. Sobald genehmigt, wird der Flug gebucht und die weiteren Details geplant.

No tags
Python script for Nagios to monitor SQL Server 2005 database mirroring
16th March 2009

Python Port of a Perl script I uploaded to NagiosExchange last year.

The script should be run on the PRINCIPAL with a read-only user. If you want to run it on the MIRROR, the user must have the Sysadmin role on it (ask Microsoft for the reason). Otherwise you get NULL.

You have to install the module pymssql manually if it's not shipped with your distro.

#!/usr/bin/python

import optparse
import pymssql
import sys

def main():

    #Connect to MSSQL Server
    try:
        con = pymssql.connect(host=host, user=user, password=password, database=database)
        cur = con.cursor()

    except TypeError:
        print 
        print "Could not connect to SQL Server"
        print 
        sys.exit(1)

    # Execute Query which checks if database is mirrored
    query="""SELECT d.name, m.mirroring_role_desc, m.mirroring_state_desc
             FROM sys.database_mirroring m
             JOIN sys.databases d ON m.database_id = d.database_id
             WHERE mirroring_state_desc IS NOT NULL AND name = """ + "'" + database + "'"

    cur.execute(query)

    results = cur.fetchall()

    for row in results:
        name  = row[0]
        role  = row[1]
        state = row[2]

    exit_val = 2

    if cur.rowcount > 0:
        if (role == "PRINCIPAL") and (state == "SYNCHRONIZED"):
            exit_val = 0

    if exit_val == 0:
        print "OK", "-", name, "-", role, "-", state
    else:
        print "CRITICAL - Check the mirrored database"

    con.close()


if __name__ == "__main__":

    # Command line Options
    parser = optparse.OptionParser()

    parser.add_option("-H", "--host",     dest="host",     metavar="HOST", help="IP or hostname with the mirrored database")
    parser.add_option("-d", "--database", dest="database", metavar="DB",   help="Name of the mirrored database")
    parser.add_option("-u", "--user",     dest="user",     metavar="USER", help="User to login")
    parser.add_option("-p", "--password", dest="password", metavar="PW",   help="Password of the user")

    if (len(sys.argv) < 2):
        args=["-h"]
        (options, args) = parser.parse_args(args)

    (options, args) = parser.parse_args()

    host     = options.host
    user     = options.user
    password = options.password
    database = options.database

    # Main function 
    main()
Tags: db, monitoring, mssql, python.

RSS Feed

"People said I should accept the world. Bullshit! I don't accept the world." -- Stallman