diff options
-rw-r--r-- | glougloud/Makefile | 20 | ||||
-rw-r--r-- | glougloud/README.txt | 39 | ||||
-rw-r--r-- | glougloud/glougloud.c | 74 |
3 files changed, 133 insertions, 0 deletions
diff --git a/glougloud/Makefile b/glougloud/Makefile new file mode 100644 index 0000000..f3ac56c --- /dev/null +++ b/glougloud/Makefile @@ -0,0 +1,20 @@ +PROG = glougloud +OBJS = glougloud.o +CFLAGS+=-Wall -g +LDFLAGS=-levent -lglouglou + +PREFIX=/usr/local +BINDIR=$(PREFIX)/bin + +all: + make $(OBJS) + $(CC) $(OBJS) -o $(PROG) $(LDFLAGS) + +install: $(PROG) + @echo "installation of $(PROG)" + mkdir -p $(BINDIR) + install -m 0755 $(PROG) $(BINDIR) + +clean: + rm -f $(PROG) $(OBJS) *~ + diff --git a/glougloud/README.txt b/glougloud/README.txt new file mode 100644 index 0000000..23c0cd3 --- /dev/null +++ b/glougloud/README.txt @@ -0,0 +1,39 @@ +glougloud - glouglou daemon, for network traffic visualisation in real time + +glougloud listen on port 4430 for probes and port 4431 for clients. +glougloud probes can be network monitoring probes, system process tracker +probes... +glougloud clients can be graphical visualisation clients, command line monitoring +clients ... + +Requirements +============ + +* libglouglou + +Known to work on OpenBSD 5.1 and Linux 3.4 + +Installation +============ + +git clone git@meg:glouglou + +sudo useradd -d /var/empty/ -s /sbin/nologin _glougloud + +make && sudo make install + +Usage +===== + +* Run the daemon + +sudo glougloud + +It logs to /var/log/glougloud. +For the moment it monitors on lo0 interface. + +* Connect manualy to the daemon + +nc -vvv -u 127.0.0.1 4431 |hexdump -C + +You get a copy of all what the probes send diff --git a/glougloud/glougloud.c b/glougloud/glougloud.c new file mode 100644 index 0000000..45fca17 --- /dev/null +++ b/glougloud/glougloud.c @@ -0,0 +1,74 @@ +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/wait.h> +#include <sys/ioctl.h> + +#include <net/if.h> +#include <netinet/in.h> + +#include <fcntl.h> +#include <stdio.h> +#include <stdlib.h> +#include <err.h> +#include <errno.h> +#include <unistd.h> +#include <signal.h> +#include <string.h> + +#include <libglouglou.h> + +struct gg_server *ggserv_probes; +struct gg_server *ggserv_clients; +struct event_base *ev_base; + +#if defined(__OPENBSD__) +void __dead +#else +void +#endif +usage(void) +{ + extern char *__progname; + + fprintf(stderr, "usage: %s [-vi]", + __progname); + exit(1); +} + +static void +sig_handler(int sig, short why, void *data) +{ + //log_info("got signal %d", sig); + if (sig == SIGINT || sig == SIGTERM) + event_base_loopexit(ev_base, NULL); +} + +int +main(int argc, char **argv) +{ + int loglevel = 0; + int op; + + while ((op = getopt(argc, argv, "hv")) != -1) { + switch (op) { + case 'h': + usage(); + /* NOTREACHED */ + case 'v': + loglevel++; + break; + default: + usage(); + /* NOTREACHED */ + } + } + + ev_base = event_base_new(); + + ggserv_probes = gg_server_start(ev_base, "127.0.0.1", 4430, NULL, NULL, NULL); + ggserv_clients = gg_server_start(ev_base, "127.0.0.1", 4431, NULL, NULL, NULL); + + event_base_dispatch(ev_base); + + return 0; +} |