summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 08fb07f)
raw | patch | inline | side by side (parent: 08fb07f)
author | octo <octo> | |
Sat, 17 Dec 2005 08:49:23 +0000 (08:49 +0000) | ||
committer | octo <octo> | |
Sat, 17 Dec 2005 08:49:23 +0000 (08:49 +0000) |
TODO | patch | blob | history | |
src/Makefile.am | patch | blob | history | |
src/collectd.c | patch | blob | history | |
src/users.c | patch | blob | history |
index edb073f5f4aac7670a96305df63e1ee74d68d7b1..f98488fe86f32b119e7a2ef1692dcb3536ef18b0 100644 (file)
--- a/TODO
+++ b/TODO
* Port tape module to Linux
* Maybe look into porting the serial module
* Ping bug (disabled)
+* Handle sigterm
diff --git a/src/Makefile.am b/src/Makefile.am
index bd2d25f4ecbf61c91139df44ceb7cc2e8092c185..6b85c0358689e2acf4765896a949bd620477602b 100644 (file)
--- a/src/Makefile.am
+++ b/src/Makefile.am
#collectd_CFLAGS = -DPLUGINDIR='"$(pkglibdir)"'
collectd_CPPFLAGS = $(LTDLINCL)
collectd_CPPFLAGS += -DCONFIGFILE='"${sysconfdir}/${PACKAGE_NAME}.conf"'
-collectd_CPPFLAGS += -DCONFIGDIR='"${sysconfdir}/${PACKAGE_NAME}.d"'
collectd_CPPFLAGS += -DPKGLOCALSTATEDIR='"${localstatedir}/lib/${PACKAGE_NAME}"'
if BUILD_FEATURE_DAEMON
collectd_CPPFLAGS += -DPIDFILE='"${localstatedir}/run/${PACKAGE_NAME}.pid"'
diff --git a/src/collectd.c b/src/collectd.c
index af3d106182d9ce93ea6f0a75b1e89cc3eee56873..76c62d9c977f12fa145a7e34daf0f31f10720e86 100644 (file)
--- a/src/collectd.c
+++ b/src/collectd.c
int operating_mode;
#endif
-static void
-sigIntHandler (int signal)
+static void sigIntHandler (int signal)
{
loop++;
}
-static int
-change_basedir (char *dir)
+static int change_basedir (char *dir)
{
int dirlen = strlen (dir);
} /* static int change_basedir (char *dir) */
#if HAVE_LIBKSTAT
-static void
-update_kstat (void)
+static void update_kstat (void)
{
if (kc == NULL)
{
} /* static void update_kstat (void) */
#endif /* HAVE_LIBKSTAT */
-static void
-exit_usage (char *name)
+static void exit_usage (char *name)
{
printf ("Usage: "PACKAGE" [OPTIONS]\n\n"
" General:\n"
" -C <file> Configuration file.\n"
" Default: "CONFIGFILE"\n"
- /* sure you want a configFILE?
- what about a configDIR? - niki */
- /*
- " -C <dir> Configuration directory.\n"
- " Default: "CONFIGDIR"\n"
- */
#if COLLECT_DAEMON
" -P <file> PID file.\n"
" Default: "PIDFILE"\n"
exit (0);
} /* static void exit_usage (char *name) */
-static int
-start_client (void)
+static int start_client (void)
{
int sleepingtime;
} /* static int start_client (void) */
#if HAVE_LIBRRD
-static int
-start_server (void)
+static int start_server (void)
{
char *host;
char *type;
#endif /* HAVE_LIBRRD */
#if COLLECT_DAEMON
-static int
-pidfile_create (const char *file)
+static int pidfile_create (const char *file)
{
FILE *fh;
#endif /* COLLECT_DAEMON */
#if COLLECT_DAEMON
-static int
-pidfile_remove (const char *file)
+static int pidfile_remove (const char *file)
{
if (file == NULL) {
file = PIDFILE;
} /* static int pidfile_remove (const char *file) */
#endif /* COLLECT_DAEMON */
-int
-main (int argc, char **argv)
+int main (int argc, char **argv)
{
struct sigaction sigIntAction, sigChldAction;
char *configfile = CONFIGFILE;
-/* or char *configdir = CONFIGDIR; */
char *plugindir = PLUGINDIR;
char *datadir = PKGLOCALSTATEDIR;
#if COLLECT_DAEMON
char *pidfile = PIDFILE;
pid_t pid;
- int daemonize = 1;
+ int daemonize = 1;
#endif
#if COLLECT_DEBUG
char *logfile = LOGFILE;
#endif /* HAVE_LIBRRD */
case 'C':
configfile = optarg;
- /* configdir = optarg; */
break;
#if COLLECT_DAEMON
case 'P':
diff --git a/src/users.c b/src/users.c
index 486c7bdf24bfe44339212d726578611ea469e5f7..2739c2beec307bb17f9e55460f0f5ada5ae58b74 100644 (file)
--- a/src/users.c
+++ b/src/users.c
# endif /* HAVE_UTMP_H */
#endif /* HAVE_UTMPX_H */
-
-
#define MODULE_NAME "users"
static char *rrd_file = "users.rrd";
-static char *ds_def[] = {
+static char *ds_def[] =
+{
"DS:users:GAUGE:25:0:65535",
NULL
};
static int ds_num = 1;
+static void users_init (void)
+{
+ /* we have nothing to do here :-) */
+ return;
+} /* static void users_init(void) */
-
-static void users_submit(unsigned int users);
-static void users_init(void);
-static void users_read(void);
-static void users_write(char *host, char *inst, char *val);
-
-
+static void users_write (char *host, char *inst, char *val)
+{
+ rrd_update_file(host, rrd_file, val, ds_def, ds_num);
+ return;
+} /* static void users_write(char *host, char *inst, char *val) */
/* I don't like this temporary macro definition - well it's used everywhere
else in the collectd-sources, so I will just stick with it... */
#define BUFSIZE 256
-static void
-users_submit(unsigned int users)
+static void users_submit (unsigned int users)
{
char buf[BUFSIZE] = "";
} /* static void users_submit(unsigned int users) */
#undef BUFSIZE
-
-
-static void
-users_init(void)
-{
- /* we have nothing to do here :-) */
- return;
-} /* static void users_init(void) */
-
-static void
-users_read(void)
+static void users_read (void)
{
#if HAVE_GETUTXENT
unsigned int users = 0;
}
endutxent();
- users_submit(users);
-#else /* !HAVE_GETUTXENT */
-# if HAVE_GETUTENT
+ users_submit (users);
+/* #endif HAVE_GETUTXENT */
+
+#elif HAVE_GETUTENT
unsigned int users = 0;
struct utmp *entry = NULL;
endutent();
users_submit(users);
-# endif /* HAVE_GETUTENT */
-#endif /* HAVE_GETUTXENT */
+#endif /* HAVE_GETUTENT */
return;
} /* static void users_read(void) */
-static void
-users_write(char *host, char *inst, char *val)
+void module_register (void)
{
- rrd_update_file(host, rrd_file, val, ds_def, ds_num);
- return;
-} /* static void users_write(char *host, char *inst, char *val) */
-
-
-
-void
-module_register(void)
-{
- plugin_register(MODULE_NAME, users_init, users_read, users_write);
+ plugin_register (MODULE_NAME, users_init, users_read, users_write);
return;
} /* void module_register(void) */
-