summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2013-07-05 15:11:46 +0200
committerThomas Graf <tgraf@suug.ch>2013-07-05 15:11:46 +0200
commit3be703f67d34b761725a13b6e58ab22591824bbe (patch)
treee3126790b78f0f9268455d9aac9dfd0e6985b8da
parent924d1e1fb48eb0c1bf0abee3afba005e06368432 (diff)
Initial import
-rw-r--r--.gitignore21
-rw-r--r--ChangeLog0
-rw-r--r--Makefile.am11
-rw-r--r--README.md5
-rwxr-xr-xautogen.sh4
-rw-r--r--configure.ac191
-rw-r--r--etc/bmon.conf81
-rw-r--r--include/bmon/.gitignore2
-rw-r--r--include/bmon/attr.h138
-rw-r--r--include/bmon/bmon.h82
-rw-r--r--include/bmon/compile-fixes.h35
-rw-r--r--include/bmon/conf.h91
-rw-r--r--include/bmon/config.h158
-rw-r--r--include/bmon/defs.h.in246
-rw-r--r--include/bmon/element.h130
-rw-r--r--include/bmon/element_cfg.h53
-rw-r--r--include/bmon/graph.h72
-rw-r--r--include/bmon/group.h100
-rw-r--r--include/bmon/history.h93
-rw-r--r--include/bmon/info.h42
-rw-r--r--include/bmon/input.h52
-rw-r--r--include/bmon/list.h93
-rw-r--r--include/bmon/module.h75
-rw-r--r--include/bmon/output.h39
-rw-r--r--include/bmon/unit.h68
-rw-r--r--include/bmon/utils.h102
-rw-r--r--m4/ax_with_curses.m4518
-rw-r--r--man/Makefile.am3
-rw-r--r--man/bmon.8235
-rw-r--r--src/.gitignore2
-rw-r--r--src/Makefile.am42
-rw-r--r--src/attr.c635
-rw-r--r--src/bmon.c397
-rw-r--r--src/conf.c596
-rw-r--r--src/element.c537
-rw-r--r--src/element_cfg.c96
-rw-r--r--src/graph.c235
-rw-r--r--src/group.c278
-rw-r--r--src/history.c318
-rw-r--r--src/in_dummy.c243
-rw-r--r--src/in_netlink.c868
-rw-r--r--src/in_null.c62
-rw-r--r--src/in_proc.c234
-rw-r--r--src/input.c83
-rw-r--r--src/module.c195
-rw-r--r--src/out_ascii.c299
-rw-r--r--src/out_curses.c1277
-rw-r--r--src/out_format.c373
-rw-r--r--src/out_null.c56
-rw-r--r--src/output.c95
-rw-r--r--src/unit.c216
-rw-r--r--src/utils.c421
52 files changed, 10285 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore
index 0331bbb..ef9058c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,17 +1,12 @@
-# Object files
*.o
-
-# Libraries
-*.lib
*.a
-
-# Shared objects (inc. Windows DLLs)
-*.dll
*.so
*.so.*
-*.dylib
-
-# Executables
-*.exe
-*.out
-*.app
+*.swp
+.deps
+Makefile.in
+Makefile
+/build-aux/
+/aclocal.m4
+/configure
+/config.*
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/ChangeLog
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..533f8c5
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,11 @@
+# -*- Makefile -*-
+
+ACLOCAL_AMFLAGS = -I m4
+
+SUBDIRS = src man
+
+pkgsysconfdir = $(sysconfdir)
+pkgsysconf_DATA = etc/bmon.conf
+
+EXTRA_DIST = \
+ $(pkgsysconf_DATA)
diff --git a/README.md b/README.md
index f47f8b3..50255a0 100644
--- a/README.md
+++ b/README.md
@@ -2,3 +2,8 @@ bmon
====
bandwidth monitor and rate estimator
+
+bmon is a monitoring and debugging tool to capture networking related
+statistics and prepare them visually in a human friendly way. It
+features various output methods including an interactive curses user
+interface and a programmable text output for scripting.
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..a569614
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+autoreconf -fi;
+rm -Rf autom4te.cache;
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..752784b
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,191 @@
+#
+# configure.in Configure Script
+#
+# Copyright (c) 2001-2013 Thomas Graf <tgraf@suug.ch>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+AC_INIT(bmon, 3.0-git, [], [], [http://www.infradead.org/~tgr/bmon/])
+AC_CONFIG_HEADERS(include/bmon/defs.h)
+AC_CONFIG_AUX_DIR([build-aux])
+AC_CONFIG_MACRO_DIR([m4])
+
+AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)], [])
+
+AC_ISC_POSIX
+AC_PROG_CC
+AC_PROG_CC_STDC
+AC_PROG_CPP
+AC_PROG_MAKE_SET
+AC_PROG_INSTALL
+
+AC_C_CONST
+AC_C_INLINE
+
+AC_HEADER_TIME
+AC_HEADER_DIRENT
+
+AC_TYPE_SIZE_T
+AC_TYPE_SIGNAL
+AC_TYPE_PID_T
+
+AC_FUNC_FORK
+
+AC_CHECK_HEADERS(getopt.h ncurses/ncurses.h ncurses.h curses.h)
+AC_CHECK_HEADERS(dirent.h sys/utsname.h sys/sockio.h netinet6/in6.h)
+AC_CHECK_HEADERS(fcntl.h netdb.h netinet/in.h sysctl/ioctl.h)
+AC_CHECK_HEADERS(sys/param.h sys/socket.h)
+
+AC_CHECK_TYPES(suseconds_t)
+
+AC_CHECK_FUNCS(atexit gettimeofday memset pow socket strcasecmp)
+AC_CHECK_FUNCS(strchr strdup strerror strncasecmp strstr strtol)
+AC_CHECK_FUNCS(uname getdate)
+
+AX_WITH_CURSES
+if test "x$ax_cv_curses" != xyes || test "x$ax_cv_curses_color" != xyes; then
+ AC_MSG_ERROR([requires an X/Open-compatible Curses library with color])
+fi
+
+PKG_CHECK_MODULES([CONFUSE], [libconfuse], [], AC_MSG_ERROR([requires libconfuse]))
+
+PKG_CHECK_MODULES([LIBNL], [libnl-3.0], [], AC_MSG_ERROR([requires libnl]))
+PKG_CHECK_MODULES([LIBNL_ROUTE], [libnl-route-3.0], [], AC_MSG_ERROR([requires libnl3-route]))
+
+AC_CHECK_LIB(m, pow, [], AC_MSG_ERROR([requires libm]))
+
+BMON_LIB=""
+
+#####################################################################
+##
+## libcurses check
+##
+#####################################################################
+CURSES="No "
+AC_CHECK_LIB(ncurses, initscr, [
+ AC_DEFINE_UNQUOTED(HAVE_NCURSES, "1", [have ncurses])
+ LCURSES="ncurses"
+ CURSES="Yes"
+],[
+ AC_CHECK_LIB(curses,initscr, [
+ AC_DEFINE_UNQUOTED(HAVE_CURSES, "1", [have curses])
+ LCURSES="curses"
+ CURSES="Yes"
+ ],[
+ echo
+ echo "*** Warning: Building bmon w/o curses support ***"
+ echo
+ ])
+])
+
+LIBCURSES="-l$LCURSES"
+
+AC_CHECK_LIB($LCURSES, redrawwin, [
+ AC_DEFINE_UNQUOTED(HAVE_REDRAWWIN, "1", [have redrawwin])
+])
+
+AC_CHECK_LIB($LCURSES, use_default_colors, [
+ AC_DEFINE_UNQUOTED(HAVE_USE_DEFAULT_COLORS, "1", [have udc])
+])
+
+#####################################################################
+##
+## interface counter overflow workaround
+##
+#####################################################################
+AC_ARG_ENABLE(cnt-workaround,
+[ --disable-cnt-workaround Disables interface counter overflow workaround],[
+ if test x$enableval = xno; then
+ AC_DEFINE_UNQUOTED(DISABLE_OVERFLOW_WORKAROUND,"1",[no overflow workaround])
+ fi
+])
+
+#####################################################################
+##
+## curses
+##
+#####################################################################
+AC_ARG_ENABLE(curses,
+[ --disable-curses Disables curses output],[
+ if test x$enableval = xno; then
+ CURSES="No "
+ fi
+])
+
+#####################################################################
+##
+## debug check
+##
+#####################################################################
+DEBUG=0
+AC_ARG_ENABLE(debug,
+[ --enable-debug Enable debug mode (default disabled)],[
+ if test x$enableval = xyes; then
+ AC_DEFINE_UNQUOTED(DEBUG, "1", [enable debugging])
+ DEBUG=1;
+ fi
+])
+
+#####################################################################
+##
+## target os eval
+##
+#####################################################################
+case ${target_os} in
+ linux*)
+ AC_DEFINE_UNQUOTED(SYS_LINUX, "1", [operating system])
+ ;;
+
+ *solaris*)
+ AC_DEFINE_UNQUOTED(SYS_SUNOS, "1", [operating system])
+ ;;
+
+ *bsd*)
+ AC_DEFINE_UNQUOTED(SYS_BSD, "1", [operating system])
+ ;;
+
+ *darwin*)
+ AC_DEFINE_UNQUOTED(SYS_BSD, "1", [operating system])
+ ;;
+
+ *)
+ AC_DEFINE_UNQUOTED(SYS_OTHER, "1", [operating system])
+ ;;
+esac
+
+#####################################################################
+##
+## export variables
+##
+#####################################################################
+AC_SUBST(DEBUG)
+AC_SUBST(STATIC)
+AC_SUBST(SYS)
+AC_SUBST(ARCH)
+
+AC_SUBST(CURSES)
+
+AC_CONFIG_FILES([
+Makefile
+src/Makefile
+man/Makefile
+])
+
+AC_OUTPUT
diff --git a/etc/bmon.conf b/etc/bmon.conf
new file mode 100644
index 0000000..567a131
--- /dev/null
+++ b/etc/bmon.conf
@@ -0,0 +1,81 @@
+/*
+ * read_interval = 1.0
+ * rate_interval = 1.0
+ * variance = 0.1
+ * history_variance = 0.1
+ * sleep_time = 20000
+ * lifetime = 30.0
+ * show_all = true
+ * policy = ""
+ */
+
+/*
+ * element eth0 {
+ * description = { "My description" }
+ * rxmax = { 10000 }
+ * txmax = { 10000 }
+ * max = { 12500000 }
+ * }
+ */
+
+/*
+ * Default configuration
+ *
+ * The following definitions is what is compiled into bmon and used
+ * by default.
+ *
+ * unit byte {
+ * variant default {
+ * div = { 1, 1024, 1048576, 1073741824, 1099511627776}
+ * txt = { "B", "KiB", "MiB", "GiB", "TiB" }
+ * }
+ * variant si {
+ * div = { 1, 1000, 1000000, 1000000000, 1000000000000 }
+ * txt = { "B", "KB", "MB", "GB", "TB" }
+ * }
+ * }
+ *
+ * unit bit {
+ * variant default {
+ * div = { 1, 1024, 1048576, 1073741824, 1099511627776}
+ * txt = { "b", "Kib", "Mib", "Gib", "TiB" }
+ * }
+ * variant si {
+ * div = { 1, 1000, 1000000, 1000000000, 1000000000000 }
+ * txt = { "b", "Kb", "Mb", "Gb", "Tb" }
+ * }
+ * }
+ *
+ * unit number {
+ * variant default {
+ * div = { 1, 1000, 1000000, 1000000000, 1000000000000 }
+ * txt = { "", "K", "M", "G", "T" }
+ * }
+ * }
+ * unit percent {
+ * variant default {
+ * div = { 1. }
+ * txt = { "%" }
+ * }
+ * }
+ *
+ * history second {
+ * interval = { 1. }
+ * size = { 60 }
+ * }
+ *
+ * history minute {
+ * interval = { 60. }
+ * size = { 60 }
+ * }
+ *
+ * history hour {
+ * interval = { 3600. }
+ * size = { 60 }
+ * }
+ *
+ * history day {
+ * interval = { 86400. }
+ * size = { 60 }
+ * }
+ */
diff --git a/include/bmon/.gitignore b/include/bmon/.gitignore
new file mode 100644
index 0000000..7ffac03
--- /dev/null
+++ b/include/bmon/.gitignore
@@ -0,0 +1,2 @@
+defs.h*
+stamp-h1
diff --git a/include/bmon/attr.h b/include/bmon/attr.h
new file mode 100644
index 0000000..224f151
--- /dev/null
+++ b/include/bmon/attr.h
@@ -0,0 +1,138 @@
+/*
+ * bmon/attr.h Attributes
+ *
+ * Copyright (c) 2001-2013 Thomas Graf <tgraf@suug.ch>
+ * Copyright (c) 2013 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __BMON_ATTR_H_
+#define __BMON_ATTR_H_
+
+#include <bmon/bmon.h>
+#include <bmon/unit.h>
+
+struct element;
+
+struct rate
+{
+ /* Total value of attribute with eventual overflows accumulated. */
+ uint64_t r_total;
+
+ /* Current value of counter */
+ uint64_t r_current;
+
+ /* Value of r_current at last read */
+ uint64_t r_prev;
+
+ /* Rate per second calculated every `rate_interval' */
+ float r_rate;
+
+ /* Time of last calculation */
+ timestamp_t r_last_calc;
+};
+
+enum {
+ ATTR_TYPE_UNSPEC,
+ ATTR_TYPE_COUNTER,
+ ATTR_TYPE_RATE,
+ ATTR_TYPE_PERCENT,
+};
+
+struct attr_def {
+ int ad_id;
+ char * ad_name;
+ char * ad_description;
+ int ad_type;
+ int ad_flags;
+ struct unit * ad_unit;
+
+ struct list_head ad_list;
+};
+
+struct attr_map {
+ const char * name;
+ const char * description;
+ const char * unit;
+ int attrid,
+ type,
+ rxid,
+ txid,
+ flags;
+};
+
+extern int attr_def_add(const char *, const char *,
+ struct unit *, int, int);
+extern struct attr_def * attr_def_lookup(const char *);
+extern struct attr_def * attr_def_lookup_id(int);
+
+extern int attr_map_load(struct attr_map *map, size_t size);
+
+#define ATTR_FORCE_HISTORY 0x01 /* collect history */
+#define ATTR_IGNORE_OVERFLOWS 0x02
+#define ATTR_TRUE_64BIT 0x04
+#define ATTR_RX_ENABLED 0x08 /* has RX counter */
+#define ATTR_TX_ENABLED 0x10 /* has TX counter */
+#define ATTR_DOING_HISTORY 0x20 /* history collected */
+
+struct attr
+{
+ struct rate a_rx_rate,
+ a_tx_rate;
+
+ uint8_t a_flags;
+ struct attr_def * a_def;
+ timestamp_t a_last_update;
+
+ struct list_head a_history_list;
+
+ struct list_head a_list;
+ struct list_head a_sort_list;
+};
+
+extern struct attr * attr_lookup(const struct element *, int);
+extern void attr_update(struct element *, int,
+ uint64_t, uint64_t , int );
+extern void attr_notify_update(struct attr *,
+ timestamp_t *);
+extern void attr_free(struct attr *);
+
+extern void attr_rate2float(struct attr *,
+ double *, char **, int *,
+ double *, char **, int *);
+
+extern void attr_calc_usage(struct attr *, float *, float *,
+ uint64_t, uint64_t);
+
+#define ATTR_HASH_SIZE 32
+
+#define UPDATE_FLAG_RX 0x01
+#define UPDATE_FLAG_TX 0x02
+#define UPDATE_FLAG_64BIT 0x04
+
+extern struct attr * attr_select_first(void);
+extern struct attr * attr_select_last(void);
+extern struct attr * attr_select_next(void);
+extern struct attr * attr_select_prev(void);
+extern struct attr * attr_current(void);
+
+extern void attr_start_collecting_history(struct attr *);
+
+#endif
diff --git a/include/bmon/bmon.h b/include/bmon/bmon.h
new file mode 100644
index 0000000..e349110
--- /dev/null
+++ b/include/bmon/bmon.h
@@ -0,0 +1,82 @@
+/*
+ * bmon.h All-include Header
+ *
+ * Copyright (c) 2001-2013 Thomas Graf <tgraf@suug.ch>
+ * Copyright (c) 2013 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __BMON_BMON_H_
+#define __BMON_BMON_H_
+
+#include <bmon/config.h>
+#include <bmon/list.h>
+
+extern int start_time;
+
+typedef struct timestamp_s
+{
+ int64_t tv_sec;
+ int64_t tv_usec;
+} timestamp_t;
+
+typedef struct xdate_s
+{
+ struct tm d_tm;
+ unsigned int d_usec;
+} xdate_t;
+
+enum {
+ EMPTY_LIST = 1,
+ END_OF_LIST = 2
+};
+
+#define BUG() \
+ do { \
+ fprintf(stderr, "BUG: %s:%d\n", __FILE__, __LINE__); \
+ assert(0); \
+ exit(EINVAL); \
+ } while (0);
+
+#define ARRAY_SIZE(X) (sizeof(X) / sizeof((X)[0]))
+
+#if defined __GNUC__
+#define __init __attribute__ ((constructor))
+#define __exit __attribute__ ((destructor))
+#else
+#define __init
+#define __exit
+#endif
+
+#ifdef DEBUG
+#define DBG(FMT, ARG...) \
+ do { \
+ fprintf(stderr, \
+ "[DBG] %20s:%-4u %s: " FMT "\n", \
+ __FILE__, __LINE__, \
+ __PRETTY_FUNCTION__, ##ARG); \
+ } while (0)
+#else
+#define DBG(FMT, ARG...) \
+ do { \
+ } while (0)
+#endif
+
+#endif
diff --git a/include/bmon/compile-fixes.h b/include/bmon/compile-fixes.h
new file mode 100644
index 0000000..c3e5b00
--- /dev/null
+++ b/include/bmon/compile-fixes.h
@@ -0,0 +1,35 @@
+/*
+ * compile_fixes.h
+ *
+ * Copyright (c) 2001-2013 Thomas Graf <tgraf@suug.ch>
+ * Copyright (c) 2013 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __BMON_COMPILE_FIXES_H_
+#define __BMON_COMPILE_FIXES_H_
+
+#include <bmon/defs.h>
+
+#ifndef HAVE_SUSECONDS_T
+typedef long suseconds_t;
+#endif
+
+#endif
diff --git a/include/bmon/conf.h b/include/bmon/conf.h
new file mode 100644
index 0000000..f95d48f
--- /dev/null
+++ b/include/bmon/conf.h
@@ -0,0 +1,91 @@
+/*
+ * conf.h Config Crap
+ *
+ * Copyright (c) 2001-2013 Thomas Graf <tgraf@suug.ch>
+ * Copyright (c) 2013 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __BMON_CONF_H_
+#define __BMON_CONF_H_
+
+#include <bmon/bmon.h>
+
+extern cfg_t *cfg;
+
+extern float cfg_read_interval;
+extern float cfg_rate_interval;
+extern float cfg_rate_variance;
+extern float cfg_history_variance;
+extern int cfg_show_all;
+extern int cfg_unit_exp;
+
+extern void conf_init_pre(void);
+extern void conf_init_post(void);
+extern void configfile_read(void);
+extern void set_configfile(const char *);
+
+extern unsigned int get_lifecycles(void);
+
+extern void conf_set_float(const char *, double);
+extern double conf_get_float(const char *);
+extern void conf_set_int(const char *, long);
+extern long conf_get_int(const char *);
+extern void conf_set_string(const char *, const char *);
+extern const char * conf_get_string(const char *);
+
+typedef struct tv_s
+{
+ char * tv_type;
+ char * tv_value;
+ struct list_head tv_list;
+} tv_t;
+
+typedef struct module_conf_s
+{
+ char * m_name;
+ struct list_head m_attrs;
+ struct list_head m_list;
+} module_conf_t;
+
+extern int parse_module_param(const char *, struct list_head *);
+
+enum {
+ LAYOUT_UNSPEC,
+ LAYOUT_DEFAULT,
+ LAYOUT_STATUSBAR,
+ LAYOUT_HEADER,
+ LAYOUT_LIST,
+ LAYOUT_SELECTED,
+ __LAYOUT_MAX
+};
+
+#define LAYOUT_MAX (__LAYOUT_MAX - 1)
+
+struct layout
+{
+ int l_fg,
+ l_bg,
+ l_attr;
+};
+
+extern struct layout cfg_layout[];
+
+#endif
diff --git a/include/bmon/config.h b/include/bmon/config.h
new file mode 100644
index 0000000..e717245
--- /dev/null
+++ b/include/bmon/config.h
@@ -0,0 +1,158 @@
+/*
+ * config.h Global Config
+ *
+ * Copyright (c) 2001-2013 Thomas Graf <tgraf@suug.ch>
+ * Copyright (c) 2013 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __BMON_CONFIG_H_
+#define __BMON_CONFIG_H_
+
+#include <bmon/defs.h>
+#include <bmon/compile-fixes.h>
+
+#if STDC_HEADERS != 1
+#error "*** ERROR: ANSI C headers