python.d/dovecot.conf \
python.d/example.conf \
python.d/exim.conf \
+ python.d/freeradius.conf \
python.d/hddtemp.conf \
python.d/ipfs.conf \
python.d/memcached.conf \
freebsd*)
build_target=freebsd
;;
+darwin*)
+ build_target=freebsd
+ ;;
*)
;;
esac
dovecot.chart.py \
example.chart.py \
exim.chart.py \
+ freeradius.chart.py \
hddtemp.chart.py \
ipfs.chart.py \
memcached.chart.py \
---
+# freeradius
+
+Uses the `radclient` command to provide freeradius statistics. It is not recommended to run it every second.
+
+It produces:
+
+1. **Authentication counters:**
+ * access-accepts
+ * access-rejects
+ * auth-dropped-requests
+ * auth-duplicate-requests
+ * auth-invalid-requests
+ * auth-malformed-requests
+ * auth-unknown-types
+
+2. **Accounting counters:** [optional]
+ * accounting-requests
+ * accounting-responses
+ * acct-dropped-requests
+ * acct-duplicate-requests
+ * acct-invalid-requests
+ * acct-malformed-requests
+ * acct-unknown-types
+
+3. **Proxy authentication counters:** [optional]
+ * proxy-access-accepts
+ * proxy-access-rejects
+ * proxy-auth-dropped-requests
+ * proxy-auth-duplicate-requests
+ * proxy-auth-invalid-requests
+ * proxy-auth-malformed-requests
+ * proxy-auth-unknown-types
+
+4. **Proxy accounting counters:** [optional]
+ * proxy-accounting-requests
+ * proxy-accounting-responses
+ * proxy-acct-dropped-requests
+ * proxy-acct-duplicate-requests
+ * proxy-acct-invalid-requests
+ * proxy-acct-malformed-requests
+ * proxy-acct-unknown-typesa
+
+
+### configuration
+
+Sample:
+
+```yaml
+local:
+ host : 'localhost'
+ port : '18121'
+ secret : 'adminsecret'
+ acct : False # Freeradius accounting statistics.
+ proxy_auth : False # Freeradius proxy authentication statistics.
+ proxy_acct : False # Freeradius proxy accounting statistics.
+```
+
+**Freeradius server configuration:**
+
+The configuration for the status server is automatically created in the sites-available directory.
+By default, server is enabled and can be queried from every client.
+FreeRADIUS will only respond to status-server messages, if the status-server virtual server has been enabled.
+
+To do this, create a link from the sites-enabled directory to the status file in the sites-available directory:
+ * cd sites-enabled
+ * ln -s ../sites-available/status status
+
+and restart/reload your FREERADIUS server.
+
+---
+
# hddtemp
Module monitors disk temperatures from one or more hddtemp daemons.
self.acct = self.configuration.get('acct', False)
self.proxy_auth = self.configuration.get('proxy_auth', False)
self.proxy_acct = self.configuration.get('proxy_acct', False)
- self.echo = [''.join([directory, 'echo']) for directory in directories if isfile(''.join([directory, 'echo']))][0]
- self.radclient = [''.join([directory, 'radclient']) for directory in directories if isfile(''.join([directory, 'radclient']))][0]
+ self.echo = [''.join([directory, 'echo']) for directory in directories if isfile(''.join([directory, 'echo']))][:1]
+ self.radclient = [''.join([directory, 'radclient']) for directory in directories if isfile(''.join([directory, 'radclient']))][:1]
self.sub_echo = [self.echo, 'Message-Authenticator = 0x00, FreeRADIUS-Statistics-Type = 15, Response-Packet-Type = Access-Accept']
self.sub_radclient = [self.radclient, '-r', '1', '-t', '1', ':'.join([self.host, self.port]), 'status', self.secret]
#include "common.h"
-#ifdef __FreeBSD__
+#ifdef __APPLE__
+#define INHERIT_NONE 0
+#endif /* __APPLE__ */
+#if defined(__FreeBSD__) || defined(__APPLE__)
# define O_NOATIME 0
# define MADV_DONTFORK INHERIT_NONE
-#endif /* __FreeBSD__ */
+#endif /* __FreeBSD__ || __APPLE__*/
char *global_host_prefix = "";
int enable_ksm = 1;
pid_t gettid(void) {
#ifdef __FreeBSD__
return (pid_t)pthread_getthreadid_np();
+#elif defined(__APPLE__)
+ uint64_t curthreadid;
+ pthread_threadid_np(NULL, &curthreadid);
+ return (pid_t)curthreadid;
#else
return (pid_t)syscall(SYS_gettid);
-#endif /* __FreeBSD__ */
+#endif /* __FreeBSD__, __APPLE__*/
}
char *fgets_trim_len(char *buf, size_t buf_size, FILE *fp, size_t *len) {
#else /* !defined(ENABLE_JEMALLOC) && !defined(ENABLE_TCMALLOC) */
-#ifndef __FreeBSD__
+#if !(defined(__FreeBSD__) || defined(__APPLE__))
#include <malloc.h>
-#endif /* __FreeBSD__ */
+#endif /* __FreeBSD__ || __APPLE__ */
#endif
#include <signal.h>
#include <syslog.h>
#include <sys/mman.h>
-#ifndef __FreeBSD__
+#if !(defined(__FreeBSD__) || defined(__APPLE__))
#include <sys/prctl.h>
-#endif /* __FreeBSD__ */
+#endif /* __FreeBSD__ || __APPLE__*/
#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include "plugin_checks.h"
#include "plugin_idlejitter.h"
#include "plugin_nfacct.h"
-#ifndef __FreeBSD__
+#if !(defined(__FreeBSD__) || defined(__APPLE__))
#include "plugin_proc.h"
#else
#include "plugin_freebsd.h"
-#endif /* __FreeBSD__ */
+#endif /* __FreeBSD__ || __APPLE__*/
#include "plugin_tc.h"
#include "plugins_d.h"
ngroups = 0;
}
+#ifdef __APPLE__
+ if(setregid(gid, gid) != 0) {
+#else
if(setresgid(gid, gid, gid) != 0) {
+#endif /* __APPLE__ */
error("Cannot switch to user's %s group (gid: %u).", username, gid);
return -1;
}
+#ifdef __APPLE__
+ if(setreuid(uid, uid) != 0) {
+#else
if(setresuid(uid, uid, uid) != 0) {
+#endif /* __APPLE__ */
error("Cannot switch to user %s (uid: %u).", username, uid);
return -1;
}
#include "common.h"
+#ifndef __APPLE__
// NEEDED BY: struct vmtotal, struct vmmeter
#include <sys/vmmeter.h>
// NEEDED BY: struct devstat
#define _IFI_OQDROPS // It is for FreeNAS only. Most probably in future releases of FreeNAS it will be removed
#include <net/if.h>
#include <ifaddrs.h>
+#endif /* __APPLE__ */
// NEEDED BY: do_disk_io
#define RRD_TYPE_DISK "disk"
static usec_t last_loadavg_usec = 0;
struct loadavg sysload;
+#ifndef __APPLE__
// NEEDED BY: do_cpu, do_cpu_cores
long cp_time[CPUSTATES];
// --------------------------------------------------------------------
+#endif /* __APPLE__ */
if (last_loadavg_usec <= dt) {
if (likely(do_loadavg)) {
if (unlikely(GETSYSCTL("vm.loadavg", sysload))) {
last_loadavg_usec = st->update_every * USEC_PER_SEC;
}
else last_loadavg_usec -= dt;
+#ifndef __APPLE__
// --------------------------------------------------------------------
freeifaddrs(ifap);
}
}
+#endif /* __APPLE__ */
return 0;
}
{"tc", "plugins", "tc", 1, NULL, NULL, tc_main},
{"idlejitter", "plugins", "idlejitter", 1, NULL, NULL, cpuidlejitter_main},
-#ifndef __FreeBSD__
+#if !(defined(__FreeBSD__) || defined(__APPLE__))
{"proc", "plugins", "proc", 1, NULL, NULL, proc_main},
#else
{"freebsd", "plugins", "freebsd", 1, NULL, NULL, freebsd_main},
-#endif /* __FreeBSD__ */
+#endif /* __FreeBSD__ || __APPLE__*/
{"cgroups", "plugins", "cgroups", 1, NULL, NULL, cgroups_main},
{"check", "plugins", "checks", 0, NULL, NULL, checks_main},
{"backends", NULL, NULL, 1, NULL, NULL, backends_main},
if(setrlimit(RLIMIT_CORE, &rl) != 0)
error("Cannot request unlimited core dumps for debugging... Proceeding anyway...");
-#ifndef __FreeBSD__
+#if !(defined(__FreeBSD__) || defined(__APPLE__))
prctl(PR_SET_DUMPABLE, 1, 0, 0, 0);
-#endif /* __FreeBSD__ */
+#endif /* __FreeBSD__ || __APPLE__*/
}
// --------------------------------------------------------------------
struct rlimit rl = { RLIM_INFINITY, RLIM_INFINITY };
if(setrlimit(RLIMIT_CORE, &rl) != 0)
error("Cannot request unlimited core dumps for debugging... Proceeding anyway...");
-#ifndef __FreeBSD__
+#if !(defined(__FreeBSD__) || defined(__APPLE__))
prctl(PR_SET_DUMPABLE, 1, 0, 0, 0);
-#endif /* __FreeBSD__ */
+#endif /* __FreeBSD__ || __APPLE__*/
}
#endif /* NETDATA_INTERNAL_CHECKS */
#ifndef NETDATA_PLUGIN_FREEBSD_H
#define NETDATA_PLUGIN_FREEBSD_H 1
+#include <sys/sysctl.h>
+
#define GETSYSCTL(name, var) getsysctl(name, &(var), sizeof(var))
void *freebsd_main(void *ptr);
st->mapped = rrd_memory_mode;
st->variables = NULL;
st->alarms = NULL;
+ memset(&st->rwlock, 0, sizeof(pthread_rwlock_t));
+ memset(&st->avl, 0, sizeof(avl));
+ memset(&st->avlname, 0, sizeof(avl));
+ memset(&st->variables_root_index, 0, sizeof(avl_tree_lock));
+ memset(&st->dimensions_index, 0, sizeof(avl_tree_lock));
}
else {
st = callocz(1, size);
rd->variables = NULL;
rd->next = NULL;
rd->name = NULL;
+ memset(&rd->avl, 0, sizeof(avl));
}
else {
// if we didn't manage to get a mmap'd dimension, just create one
w->wait_send = 0;
buffer_flush(w->response.data);
w->response.rlen = stat.st_size;
+#ifdef __APPLE__
+ w->response.data->date = stat.st_mtimespec.tv_sec;
+#else
w->response.data->date = stat.st_mtim.tv_sec;
+#endif /* __APPLE__ */
buffer_cacheable(w->response.data);
return 200;