Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added proc/net fake #433

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

MarkusGnigler
Copy link

@MarkusGnigler MarkusGnigler commented Jan 18, 2025

Added fakenet to have a copy of proc/net inside the agent container.
Used the concept from netdata to simulate proc/net within /dev/shm/fakenet.

#232

I copied the bash script for the copy function directly from Script.

In the docker file i have mounted a shared named volume between the agent and the copy container.

Added:

  • Fakenet dockerfile and script to /beszel folder
  • Docker image build in the docker-images action
  • Compose file extended in add-system.tsx and /supplemental standalone agent

Missing:

  • Extending compose file in /supplemental for same-system agent

@henrygd
Copy link
Owner

henrygd commented Jan 18, 2025

Thanks, I'll get back to you on this tomorrow.

@MarkusGnigler
Copy link
Author

Please take your time. Other issues are more important i think :)

@MarkusGnigler
Copy link
Author

If we can trim it down to just /proc/net/dev, no extra docker image is necessary. But that's a matter of taste.

What do you think?

---
volumes:
    procnet: {}

services:
  fakenet:
    image: alpine
    restart: unless-stopped
    network_mode: host
    entrypoint: /bin/sh
    command:
      - -c
      - |
        export OUTPUT="/dev/shm/fakenet/"
        export SOURCE="/proc/net/dev"
        mkdir -p $OUTPUT/dev
        while [ true ]; do
            OUTFILE="$${SOURCE:10}"
            echo "$$(<SOURCE)" > $$OUTPUT$$OUTFILE
            cat $$SOURCE
            sleep 0.23
        done
    volumes:
      - procnet:/dev/shm/fakenet

@henrygd
Copy link
Owner

henrygd commented Jan 19, 2025

If we can trim it down to just /proc/net/dev, no extra docker image is necessary. But that's a matter of taste.

I love this, good idea! It allows people see what's happening rather than just running a black box process.

My general idea was to write a little C program to do this. The benefit there is that it would use practically no resources. Probably something like 500 KB memory or less.

I want to play around with both approaches, and maybe offer both depending on user preference. Didn't have time to get into it today, but will as soon as I can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants