def gmetric_write(NAME, VAL, TYPE, UNITS, SLOPE, TMAX, DMAX, GROUP):
 packer = Packer()
 HOSTNAME = 'test'
 SPOOF = 0
 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])
 packer.pack_uint(int(TMAX))
 packer.pack_uint(int(DMAX))
 if (GROUP == ''):
  packer.pack_int(0)
 else:
  packer.pack_int(1)
  packer.pack_string('GROUP')
  packer.pack_string(GROUP)
 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 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 ] ) packer . pack_uint ( int ( TMAX ) ) packer . pack_uint ( int ( DMAX ) ) if ( GROUP == '' ) : packer . pack_int ( 0 ) else : packer . pack_int ( 1 ) packer . pack_string ( 'GROUP' ) packer . pack_string ( GROUP ) 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 ( ) )
arguments are in all upper-case to match xml .