• API
  • TRP how to get counter group list

Trying to use Trisul Remote Protocol - how to get a list of counter groups ?

I am using Python, all the samples on github trisulnsm repo are in Ruby

--

    Hi,

    You need to use COUNTER_GROUP_INFO_REQUEST with no parameters, this will retrieve all counter groups.

    See this link for Python : https://github.com/trisulnsm/trisul-scripts/tree/master/trp/python

    The relevant snippet is

    req = trp_pb2.Message()
    req.trp_command=req.COUNTER_GROUP_INFO_REQUEST
    resp = get_response(sys.argv[1],req)
    
    # display the information 
    for cg in resp.group_details:
      print cg.guid  + "," + cg.name 

    The output would be like

    v@v14:~/dev/python$ python cginfo.py ipc:///usr/local/var/lib/trisul-hub/domain0/hub0/context0/run/trp_0
    {889900CC-0063-11A5-8380-FEBDBABBDBEA},Internal Hosts
    {00AA77BB-0063-11A5-8380-FEBDBABBDBEA},External Hosts
    {EEF95297-0C8D-4673-AD6B-F4BD2345FD69},Web Hosts
    {22D4082E-B8BA-40D0-A287-1F524DF8DA7B},Email Hosts
    {439002E4-3758-4E88-9438-8034FE1616AF},SSH Hosts
    {AE3A1449-5663-41A5-A028-FDE61DBB7EFA},Unusual Traffic Hosts
    {FF889910-9293-AAA5-0028-883991889884},Unleash Apps
    {A0FA9464-B496-4A20-A9AB-4D2D09AFF902},Alert Signatures
    {20BC4345-37F0-44D0-ABFF-3BED97363CB1},Alert Classes
    {9EFAFDD0-6CBB-4C04-8B13-2C8E0A9D3F85},Alert Priorities
     ((more ))

    Check out the cginfo.py script on https://github.com/trisulnsm/trisul-scripts/tree/master/trp/python

    -
    Trisul support

      Write a Reply...