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':
# 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) */
-