Giter Site home page Giter Site logo

Castome about diamond HOT 5 CLOSED

rubenpapovyan avatar rubenpapovyan commented on July 27, 2024
Castome

from diamond.

Comments (5)

jaingaurav avatar jaingaurav commented on July 27, 2024

What do you mean by "one trade 100% for 20 seconds"? Are you saying that diamond occasionally takes 20 seconds? My guess is the netstat -ant is taking a long time. How many connections are you typically working with?

from diamond.

jaingaurav avatar jaingaurav commented on July 27, 2024

Also please note that development of diamond has moved to https://github.com/python-diamond/Diamond

from diamond.

rubenpapovyan avatar rubenpapovyan commented on July 27, 2024

Im executing this script it takes 2 sec
When i'm putting same same code to dimond class it using CPU a lot

#!/usr/bin/python
from decimal import *
import commands

import diamond.collector

all_connections = commands.getoutput("netstat -ant")

connection_list = {"ESTABLISHED" : 0 , "SYN_SENT" : 0 ,  "SYN_RECV" : 0 ,  "FIN_WAIT1" : 0 ,  "FIN_WAIT2" : 0 ,  "TIME_WAIT" : 0 , "CLOSE" : 0 , "CLOSE_WAIT" : 0 , "LAST_ACK" : 0 , "LISTEN" : 0 , "CLOSING" : 0 , "UNKNOWN" : 0 }

for line in all_connections.splitlines():
    #print line
    if line.find("ESTABLISHED") != -1:
        #print "ESTABLISHED"
        connection_list["ESTABLISHED"]+=1

    elif line.find("SYN_SENT") != -1:
        #print "SYN_SENT"
        connection_list["SYN_SENT"]+=1

    elif line.find("SYN_RECV") != -1:
        #print "SYN_RECV"
        connection_list["SYN_RECV"]+=1

    elif line.find("FIN_WAIT1") != -1:
        #print "FIN_WAIT1"
        connection_list["FIN_WAIT1"]+=1

    elif line.find("FIN_WAIT2") != -1:
        #print "FIN_WAIT2"
        connection_list["FIN_WAIT2"]+=1

    elif line.find("TIME_WAIT") != -1:
        #print "TIME_WAIT"
        connection_list["TIME_WAIT"]+=1

    elif line.find("CLOSE") != -1:
        #print "CLOSE"
        connection_list["CLOSE"]+=1

    elif line.find("CLOSE_WAIT") != -1:
        #print "CLOSE_WAIT"
        connection_list["CLOSE_WAIT"]+=1

    elif line.find("LAST_ACK") != -1:
        #print "LAST_ACK"
        connection_list["LAST_ACK"]+=1

    elif line.find("LISTEN") != -1:
        #print "LISTEN"
        connection_list["LISTEN"]+=1

    elif line.find("CLOSING") != -1:
        #print "CLOSING"
        connection_list["CLOSING"]+=1

    elif line.find("UNKNOWN") != -1:
        #print "UNKNOWN"
        connection_list["UNKNOWN"]+=1

print "ESTABLISHED : " , connection_list["ESTABLISHED"]
print "SYN_SENT    : " , connection_list["SYN_SENT"]   
print "SYN_RECV    : " , connection_list["SYN_RECV"]   
print "FIN_WAIT1   : " , connection_list["FIN_WAIT1"]  
print "FIN_WAIT2   : " , connection_list["FIN_WAIT2"]  
print "TIME_WAIT   : " , connection_list["TIME_WAIT"]  
print "CLOSE       : " , connection_list["CLOSE"]      
print "CLOSE_WAIT  : " , connection_list["CLOSE_WAIT"] 
print "LAST_ACK    : " , connection_list["LAST_ACK"]   
print "LISTEN      : " , connection_list["LISTEN"]     
print "CLOSING     : " , connection_list["CLOSING"]    
print "UNKNOWN     : " , connection_list["UNKNOWN"] 

from diamond.

jaingaurav avatar jaingaurav commented on July 27, 2024

@rubenpapovyan there really shouldn't be any reason why diamond would use more resources than a standalone script. You might have to paste your entire config for a better understanding. How are you integrating your script? As a custom collector or as a script in the UserScriptCollector?

from diamond.

kormoc avatar kormoc commented on July 27, 2024

This repo has moved to https://github.com/python-diamond/Diamond

Please open a new ticket there if this issue is not resolved with the current code there.

Thanks!

from diamond.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.