Skip to content

Record network usage of a Fleetspeak client (Bytes sent/received) #299

@tsehori

Description

@tsehori

We want to record the network usage of a single Fleetspeak client deployed, so that we can later on plot, inspect and analyze this data for measuring performance and be alerted if there are any unexpected "spikes" in network usage.
An example for a use case is GRR, that has a dashboard for Client Load Stats (google/grr#859) which fetches its data from Fleetspeak server's datastore.

The concept is similar to other metrics gathered from Fleetspeak clients, such as resident memory size.
As an example, check out #275 to learn more about how IO MiB read/write is implemented.

Implementation details:
Other metrics gathered for individual Fleetspeak clients are using the ResourceUsageFetcher struct, and specifically the method ResourceUsageForPID. Unlike those metrics, the kernel does not have information about the network usage of a given process PID, so this cannot be fetched using the library gopsutil.
Thus, an idea for implementing this: add a new struct (a singleton effectively) that will become a field in ResourceUsageFetcher. This new singleton will also be shared with the StreamingCommunicator struct (note that an implementation may needed for polling as well), so network usage data can be recorded when messages enter/exit the Fleetspeak client in the methods readLoop and writeLoop, where both are called from the connect method of StreamingCommunicator.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions