#!/usr/bin/python
######################################################################
# Cloud Routes Availability Manager: tcp-check module
# ------------------------------------------------------------------
# This is a moduel for performing tcp based health checks.
# This will return true if no errors or false if there are errors
# ------------------------------------------------------------------
# Version: Alpha.20140618
# Original Author: Benjamin J. Cane - madflojo@cloudrout.es
# Contributors:
# - your name here
######################################################################

import socket


def check(data):
    """ Perform a tcp connection to the specified IP and PORT """

    # Build socket Connection
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    # Sets realistic timeout value
    s.settimeout(5)
    try:
        result = s.connect_ex((data['data']['ip'], int(data['data']['port'])))
    except socket.error:
        return False

    if result != 0:
        return False
    else:
        return True

@@ -618,20 +618,24 @@
 f check(
-data
+**kwargs
 ):%0A    %22
@@ -694,16 +694,44 @@
 PORT %22%22%22
+%0A    jdata = kwargs%5B'jdata'%5D
 %0A%0A    # 
@@ -907,16 +907,17 @@
 ect_ex((
+j
 data%5B'da
@@ -932,16 +932,17 @@
 '%5D, int(
+j
 data%5B'da

Convert monitors kwargs: tcp