sflow / host-sflow

host-sflow agent
http://sflow.net
Other
146 stars 55 forks source link

it seems hsflowd don't re-read configure file #4

Closed elianka closed 8 years ago

elianka commented 8 years ago

hi, hsflowd only reads hsflowd.conf once when it starts, and not re-read it when it running. so when we modify configure file dynamically, it will not update.

sflow commented 8 years ago

That's right. If you change /etc/hsflowd.conf then you have to "service hsflowd restart" for it to take effect. It's typical of most daemons in that regard. You incur a discontinuity in the sFlow feed sequence numbers, but that shouldn't make much difference at the collector side.

We thought about allowing SIGHUP to trigger a reload of the config, but changing the config happens so rarely that we couldn't justify it. If you really need to adjust config dynamically then the DNSSD feature can be used. I believe it has the properties you are looking for.

elianka commented 8 years ago

That's all right, the config changing rarely happens. I just confused by the FSM in main function. It is more like a sequential execution. For example, no condition to trigger state changed from HSPSTATE_RUN to HSPSTATE_READCONFIG. Meanwhile i think multi-thread could help to re-read the config file, and reset the state of the FSM to HSPSTATE_READCONFIG.

sflow commented 8 years ago

Yes, the first prototype did have that state-change (on SIGHUP). However once we added more stateful options (such as DNS-SD, ULOG/NFLOG and JSON input) then that transition became too complex (turning things off if they were no longer configured). Much easier to just require a restart.

So if the FSM paradigm seems a little heavy here... you guessed correctly why.

elianka commented 8 years ago

got it. Thanks!