(NAME, VAL, TYPE, UNITS, SLOPE, TMAX, DMAX, GROUP)
return packer.get_buffer(),  data.get_buffer()
Arguments are in all upper-case to match XML
Arguments are in all upper-case to match XML
Arguments are in all upper - case to match XML
def gmetric_write(NAME, VAL, TYPE, UNITS, SLOPE, TMAX, DMAX, GROUP):
    """
    Arguments are in all upper-case to match XML
    """
    packer = Packer()
    HOSTNAME = "test"
    SPOOF = 0
    # Meta data about a metric
    packer.pack_int(128)
    packer.pack_string(HOSTNAME)
    packer.pack_string(NAME)
    packer.pack_int(SPOOF)
    packer.pack_string(TYPE)
    packer.pack_string(NAME)
    packer.pack_string(UNITS)
    packer.pack_int(slope_str2int[SLOPE])  # map slope string to int
    packer.pack_uint(int(TMAX))
    packer.pack_uint(int(DMAX))
    # Magic number. Indicates number of entries to follow. Put in 1 for GROUP
    if GROUP == "":
        packer.pack_int(0)
    else:
        packer.pack_int(1)
        packer.pack_string("GROUP")
        packer.pack_string(GROUP)

    # Actual data sent in a separate packet
    data = Packer()
    data.pack_int(128 + 5)
    data.pack_string(HOSTNAME)
    data.pack_string(NAME)
    data.pack_int(SPOOF)
    data.pack_string("%s")
    data.pack_string(str(VAL))

    return packer.get_buffer(),  data.get_buffer()
def gmetric_write ( NAME , VAL , TYPE , UNITS , SLOPE , TMAX , DMAX , GROUP ) : packer = Packer ( ) HOSTNAME = "test" SPOOF = 0 # Meta data about a metric packer . pack_int ( 128 ) packer . pack_string ( HOSTNAME ) packer . pack_string ( NAME ) packer . pack_int ( SPOOF ) packer . pack_string ( TYPE ) packer . pack_string ( NAME ) packer . pack_string ( UNITS ) packer . pack_int ( slope_str2int [ SLOPE ] ) # map slope string to int packer . pack_uint ( int ( TMAX ) ) packer . pack_uint ( int ( DMAX ) ) # Magic number. Indicates number of entries to follow. Put in 1 for GROUP if GROUP == "" : packer . pack_int ( 0 ) else : packer . pack_int ( 1 ) packer . pack_string ( "GROUP" ) packer . pack_string ( GROUP ) # Actual data sent in a separate packet data = Packer ( ) data . pack_int ( 128 + 5 ) data . pack_string ( HOSTNAME ) data . pack_string ( NAME ) data . pack_int ( SPOOF ) data . pack_string ( "%s" ) data . pack_string ( str ( VAL ) ) return packer . get_buffer ( ) , data . get_buffer ( )