summaryrefslogtreecommitdiffstats
path: root/collectors/macos.plugin
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-02-06 16:11:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-02-06 16:11:34 +0000
commitd079b656b4719739b2247dcd9d46e9bec793095a (patch)
treed2c950c70a776bcf697c963151c5bd959f8a9f03 /collectors/macos.plugin
parentReleasing debian version 1.37.1-2. (diff)
downloadnetdata-d079b656b4719739b2247dcd9d46e9bec793095a.tar.xz
netdata-d079b656b4719739b2247dcd9d46e9bec793095a.zip
Merging upstream version 1.38.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'collectors/macos.plugin')
-rw-r--r--collectors/macos.plugin/README.md6
-rw-r--r--collectors/macos.plugin/macos_fw.c22
-rw-r--r--collectors/macos.plugin/macos_mach_smi.c16
-rw-r--r--collectors/macos.plugin/macos_sysctl.c56
-rw-r--r--collectors/macos.plugin/plugin_macos.c2
5 files changed, 53 insertions, 49 deletions
diff --git a/collectors/macos.plugin/README.md b/collectors/macos.plugin/README.md
index 92bbf1eb1..3a3e8a1a2 100644
--- a/collectors/macos.plugin/README.md
+++ b/collectors/macos.plugin/README.md
@@ -1,6 +1,10 @@
<!--
title: "macos.plugin"
-custom_edit_url: https://github.com/netdata/netdata/edit/master/collectors/macos.plugin/README.md
+custom_edit_url: "https://github.com/netdata/netdata/edit/master/collectors/macos.plugin/README.md"
+sidebar_label: "macos.plugin"
+learn_status: "Published"
+learn_topic_type: "References"
+learn_rel_path: "References/Collectors references/System metrics"
-->
# macos.plugin
diff --git a/collectors/macos.plugin/macos_fw.c b/collectors/macos.plugin/macos_fw.c
index 07f7d773d..ca06f428e 100644
--- a/collectors/macos.plugin/macos_fw.c
+++ b/collectors/macos.plugin/macos_fw.c
@@ -84,14 +84,14 @@ int do_macos_iokit(int update_every, usec_t dt) {
/* Get ports and services for drive statistics. */
if (unlikely(IOMainPort(bootstrap_port, &main_port))) {
- error("MACOS: IOMasterPort() failed");
+ collector_error("MACOS: IOMasterPort() failed");
do_io = 0;
- error("DISABLED: system.io");
+ collector_error("DISABLED: system.io");
/* Get the list of all drive objects. */
} else if (unlikely(IOServiceGetMatchingServices(main_port, IOServiceMatching("IOBlockStorageDriver"), &drive_list))) {
- error("MACOS: IOServiceGetMatchingServices() failed");
+ collector_error("MACOS: IOServiceGetMatchingServices() failed");
do_io = 0;
- error("DISABLED: system.io");
+ collector_error("DISABLED: system.io");
} else {
while ((drive = IOIteratorNext(drive_list)) != 0) {
properties = 0;
@@ -126,9 +126,9 @@ int do_macos_iokit(int update_every, usec_t dt) {
/* Obtain the properties for this drive object. */
if (unlikely(IORegistryEntryCreateCFProperties(drive, (CFMutableDictionaryRef *)&properties, kCFAllocatorDefault, 0))) {
IOObjectRelease(drive);
- error("MACOS: IORegistryEntryCreateCFProperties() failed");
+ collector_error("MACOS: IORegistryEntryCreateCFProperties() failed");
do_io = 0;
- error("DISABLED: system.io");
+ collector_error("DISABLED: system.io");
break;
} else if (likely(properties)) {
/* Obtain the statistics from the drive properties. */
@@ -413,11 +413,11 @@ int do_macos_iokit(int update_every, usec_t dt) {
if (likely(do_space || do_inodes)) {
// there is no mount info in sysctl MIBs
if (unlikely(!(mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)))) {
- error("MACOS: getmntinfo() failed");
+ collector_error("MACOS: getmntinfo() failed");
do_space = 0;
- error("DISABLED: disk_space.X");
+ collector_error("DISABLED: disk_space.X");
do_inodes = 0;
- error("DISABLED: disk_inodes.X");
+ collector_error("DISABLED: disk_inodes.X");
} else {
for (i = 0; i < mntsize; i++) {
if (mntbuf[i].f_flags == MNT_RDONLY ||
@@ -500,9 +500,9 @@ int do_macos_iokit(int update_every, usec_t dt) {
if (likely(do_bandwidth)) {
if (unlikely(getifaddrs(&ifap))) {
- error("MACOS: getifaddrs()");
+ collector_error("MACOS: getifaddrs()");
do_bandwidth = 0;
- error("DISABLED: system.ipv4");
+ collector_error("DISABLED: system.ipv4");
} else {
for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
if (ifa->ifa_addr->sa_family != AF_LINK)
diff --git a/collectors/macos.plugin/macos_mach_smi.c b/collectors/macos.plugin/macos_mach_smi.c
index 53b2607b4..f21a56af2 100644
--- a/collectors/macos.plugin/macos_mach_smi.c
+++ b/collectors/macos.plugin/macos_mach_smi.c
@@ -41,16 +41,16 @@ int do_macos_mach_smi(int update_every, usec_t dt) {
if (likely(do_cpu)) {
if (unlikely(HOST_CPU_LOAD_INFO_COUNT != 4)) {
- error("MACOS: There are %d CPU states (4 was expected)", HOST_CPU_LOAD_INFO_COUNT);
+ collector_error("MACOS: There are %d CPU states (4 was expected)", HOST_CPU_LOAD_INFO_COUNT);
do_cpu = 0;
- error("DISABLED: system.cpu");
+ collector_error("DISABLED: system.cpu");
} else {
count = HOST_CPU_LOAD_INFO_COUNT;
kr = host_statistics(host, HOST_CPU_LOAD_INFO, (host_info_t)cp_time, &count);
if (unlikely(kr != KERN_SUCCESS)) {
- error("MACOS: host_statistics() failed: %s", mach_error_string(kr));
+ collector_error("MACOS: host_statistics() failed: %s", mach_error_string(kr));
do_cpu = 0;
- error("DISABLED: system.cpu");
+ collector_error("DISABLED: system.cpu");
} else {
st = rrdset_find_active_bytype_localhost("system", "cpu");
@@ -95,13 +95,13 @@ int do_macos_mach_smi(int update_every, usec_t dt) {
kr = host_statistics(host, HOST_VM_INFO, (host_info_t)&vm_statistics, &count);
#endif
if (unlikely(kr != KERN_SUCCESS)) {
- error("MACOS: host_statistics64() failed: %s", mach_error_string(kr));
+ collector_error("MACOS: host_statistics64() failed: %s", mach_error_string(kr));
do_ram = 0;
- error("DISABLED: system.ram");
+ collector_error("DISABLED: system.ram");
do_swapio = 0;
- error("DISABLED: system.swapio");
+ collector_error("DISABLED: system.swapio");
do_pgfaults = 0;
- error("DISABLED: mem.pgfaults");
+ collector_error("DISABLED: mem.pgfaults");
} else {
if (likely(do_ram)) {
st = rrdset_find_active_localhost("system.ram");
diff --git a/collectors/macos.plugin/macos_sysctl.c b/collectors/macos.plugin/macos_sysctl.c
index 1f04f6e41..42f01d85a 100644
--- a/collectors/macos.plugin/macos_sysctl.c
+++ b/collectors/macos.plugin/macos_sysctl.c
@@ -222,7 +222,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
if (likely(do_loadavg)) {
if (unlikely(GETSYSCTL_BY_NAME("vm.loadavg", sysload))) {
do_loadavg = 0;
- error("DISABLED: system.load");
+ collector_error("DISABLED: system.load");
} else {
st = rrdset_find_active_bytype_localhost("system", "load");
@@ -260,7 +260,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
if (likely(do_swap)) {
if (unlikely(GETSYSCTL_BY_NAME("vm.swapusage", swap_usage))) {
do_swap = 0;
- error("DISABLED: system.swap");
+ collector_error("DISABLED: system.swap");
} else {
st = rrdset_find_active_localhost("system.swap");
if (unlikely(!st)) {
@@ -298,15 +298,15 @@ int do_macos_sysctl(int update_every, usec_t dt) {
mib[4] = NET_RT_IFLIST2;
mib[5] = 0;
if (unlikely(sysctl(mib, 6, NULL, &size, NULL, 0))) {
- error("MACOS: sysctl(%s...) failed: %s", "net interfaces", strerror(errno));
+ collector_error("MACOS: sysctl(%s...) failed: %s", "net interfaces", strerror(errno));
do_bandwidth = 0;
- error("DISABLED: system.ipv4");
+ collector_error("DISABLED: system.ipv4");
} else {
ifstatdata = reallocz(ifstatdata, size);
if (unlikely(sysctl(mib, 6, ifstatdata, &size, NULL, 0) < 0)) {
- error("MACOS: sysctl(%s...) failed: %s", "net interfaces", strerror(errno));
+ collector_error("MACOS: sysctl(%s...) failed: %s", "net interfaces", strerror(errno));
do_bandwidth = 0;
- error("DISABLED: system.ipv4");
+ collector_error("DISABLED: system.ipv4");
} else {
lim = ifstatdata + size;
iftot.ift_ibytes = iftot.ift_obytes = 0;
@@ -353,19 +353,19 @@ int do_macos_sysctl(int update_every, usec_t dt) {
if (likely(do_tcp_packets || do_tcp_errors || do_tcp_handshake || do_tcpext_connaborts || do_tcpext_ofo || do_tcpext_syscookies || do_ecn)) {
if (unlikely(GETSYSCTL_BY_NAME("net.inet.tcp.stats", tcpstat))){
do_tcp_packets = 0;
- error("DISABLED: ipv4.tcppackets");
+ collector_error("DISABLED: ipv4.tcppackets");
do_tcp_errors = 0;
- error("DISABLED: ipv4.tcperrors");
+ collector_error("DISABLED: ipv4.tcperrors");
do_tcp_handshake = 0;
- error("DISABLED: ipv4.tcphandshake");
+ collector_error("DISABLED: ipv4.tcphandshake");
do_tcpext_connaborts = 0;
- error("DISABLED: ipv4.tcpconnaborts");
+ collector_error("DISABLED: ipv4.tcpconnaborts");
do_tcpext_ofo = 0;
- error("DISABLED: ipv4.tcpofo");
+ collector_error("DISABLED: ipv4.tcpofo");
do_tcpext_syscookies = 0;
- error("DISABLED: ipv4.tcpsyncookies");
+ collector_error("DISABLED: ipv4.tcpsyncookies");
do_ecn = 0;
- error("DISABLED: ipv4.ecnpkts");
+ collector_error("DISABLED: ipv4.ecnpkts");
} else {
if (likely(do_tcp_packets)) {
st = rrdset_find_active_localhost("ipv4.tcppackets");
@@ -597,9 +597,9 @@ int do_macos_sysctl(int update_every, usec_t dt) {
if (likely(do_udp_packets || do_udp_errors)) {
if (unlikely(GETSYSCTL_BY_NAME("net.inet.udp.stats", udpstat))) {
do_udp_packets = 0;
- error("DISABLED: ipv4.udppackets");
+ collector_error("DISABLED: ipv4.udppackets");
do_udp_errors = 0;
- error("DISABLED: ipv4.udperrors");
+ collector_error("DISABLED: ipv4.udperrors");
} else {
if (likely(do_udp_packets)) {
st = rrdset_find_active_localhost("ipv4.udppackets");
@@ -673,10 +673,10 @@ int do_macos_sysctl(int update_every, usec_t dt) {
if (likely(do_icmp_packets || do_icmpmsg)) {
if (unlikely(GETSYSCTL_BY_NAME("net.inet.icmp.stats", icmpstat))) {
do_icmp_packets = 0;
- error("DISABLED: ipv4.icmp");
- error("DISABLED: ipv4.icmp_errors");
+ collector_error("DISABLED: ipv4.icmp");
+ collector_error("DISABLED: ipv4.icmp_errors");
do_icmpmsg = 0;
- error("DISABLED: ipv4.icmpmsg");
+ collector_error("DISABLED: ipv4.icmpmsg");
} else {
for (i = 0; i <= ICMP_MAXTYPE; i++) {
icmp_total.msgs_in += icmpstat.icps_inhist[i];
@@ -777,13 +777,13 @@ int do_macos_sysctl(int update_every, usec_t dt) {
if (likely(do_ip_packets || do_ip_fragsout || do_ip_fragsin || do_ip_errors)) {
if (unlikely(GETSYSCTL_BY_NAME("net.inet.ip.stats", ipstat))) {
do_ip_packets = 0;
- error("DISABLED: ipv4.packets");
+ collector_error("DISABLED: ipv4.packets");
do_ip_fragsout = 0;
- error("DISABLED: ipv4.fragsout");
+ collector_error("DISABLED: ipv4.fragsout");
do_ip_fragsin = 0;
- error("DISABLED: ipv4.fragsin");
+ collector_error("DISABLED: ipv4.fragsin");
do_ip_errors = 0;
- error("DISABLED: ipv4.errors");
+ collector_error("DISABLED: ipv4.errors");
} else {
if (likely(do_ip_packets)) {
st = rrdset_find_active_localhost("ipv4.packets");
@@ -919,13 +919,13 @@ int do_macos_sysctl(int update_every, usec_t dt) {
if (likely(do_ip6_packets || do_ip6_fragsout || do_ip6_fragsin || do_ip6_errors)) {
if (unlikely(GETSYSCTL_BY_NAME("net.inet6.ip6.stats", ip6stat))) {
do_ip6_packets = 0;
- error("DISABLED: ipv6.packets");
+ collector_error("DISABLED: ipv6.packets");
do_ip6_fragsout = 0;
- error("DISABLED: ipv6.fragsout");
+ collector_error("DISABLED: ipv6.fragsout");
do_ip6_fragsin = 0;
- error("DISABLED: ipv6.fragsin");
+ collector_error("DISABLED: ipv6.fragsin");
do_ip6_errors = 0;
- error("DISABLED: ipv6.errors");
+ collector_error("DISABLED: ipv6.errors");
} else {
if (do_ip6_packets == CONFIG_BOOLEAN_YES || (do_ip6_packets == CONFIG_BOOLEAN_AUTO &&
(ip6stat.ip6s_localout ||
@@ -1096,7 +1096,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
if (likely(do_icmp6 || do_icmp6_redir || do_icmp6_errors || do_icmp6_echos || do_icmp6_router || do_icmp6_neighbor || do_icmp6_types)) {
if (unlikely(GETSYSCTL_BY_NAME("net.inet6.icmp6.stats", icmp6stat))) {
do_icmp6 = 0;
- error("DISABLED: ipv6.icmp");
+ collector_error("DISABLED: ipv6.icmp");
} else {
for (i = 0; i <= ICMP6_MAXTYPE; i++) {
icmp6_total.msgs_in += icmp6stat.icp6s_inhist[i];
@@ -1392,7 +1392,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
if (likely(do_uptime)) {
if (unlikely(GETSYSCTL_BY_NAME("kern.boottime", boot_time))) {
do_uptime = 0;
- error("DISABLED: system.uptime");
+ collector_error("DISABLED: system.uptime");
} else {
clock_gettime(CLOCK_REALTIME, &cur_time);
st = rrdset_find_active_localhost("system.uptime");
diff --git a/collectors/macos.plugin/plugin_macos.c b/collectors/macos.plugin/plugin_macos.c
index 10472bdb8..f3b860510 100644
--- a/collectors/macos.plugin/plugin_macos.c
+++ b/collectors/macos.plugin/plugin_macos.c
@@ -32,7 +32,7 @@ static void macos_main_cleanup(void *ptr)
struct netdata_static_thread *static_thread = (struct netdata_static_thread *)ptr;
static_thread->enabled = NETDATA_MAIN_THREAD_EXITING;
- info("cleaning up...");
+ collector_info("cleaning up...");
static_thread->enabled = NETDATA_MAIN_THREAD_EXITED;
}