What do you use as a system monitor - Servers Administration, Networking, & Virtualization

Users browsing this thread: 1 Guest(s)
gaak
Members
(12-02-2022, 09:36 PM)seninha Wrote: On my OpenBSD desktop, I configured apmd to log every minute at /var/log. I also configured sensorsd.conf to set a high temperature value that, when passed, a message should be logged.

This for everything. When the current state is nominal, nothing should be displayed.

Getting everyone to agree on a message bus is not easy. eg. battery low/high goes to X11 display, while the daily security report goes to email.

Code:
#!/usr/bin/awk -f

BEGIN { max_disk = 0.950 ; min_ifree = 2000; max_load = 1.0; }

/^$/ { is_disk = 0; is_network = 0; }
/^disks:/ { is_disk = 1; next; }
/^network:/ { is_network = 1; next; }
# remove date-time as that breaks duplicate output checking
/^OpenBSD/ {
    for ( i = 4 ; i <= NF; i++ ) {
        $i = "";
    }
}
/load averages:/ {
    if ( $NF > max_load ) { print; }
    next;
}

! is_network && ! is_disk { print; }

is_network {
  name = $1; colls = int($NF); ofail = int($(NF-1)); ifail = int($(NF-3));
  if ( colls > 0 || ofail > 0 || ifail > 0 ) {
    printf("net %s input errs %s output errs %s collisions %s\n", name, ifail, ofail, colls);
  }
}

is_disk {
  name = $NF; total = int($2); used = int($3); ifree = int($7);
  if ( name == "on" ) { next; }
  if ( used / total > max_disk ) {
    printf("disk %s at %.2f used\n", name, used / total);
  }
  if ( ifree < min_ifree ) {
    printf("disk %s ifree at %d\n", name, ifree);
  }
}


Messages In This Thread
What do you use as a system monitor - by venam - 10-02-2022, 01:22 PM
RE: What do you use as a system monitor - by movq - 12-02-2022, 04:51 AM
RE: What do you use as a system monitor - by pfr - 14-02-2022, 10:31 PM
RE: What do you use as a system monitor - by VMS - 15-02-2022, 01:14 PM
RE: What do you use as a system monitor - by jkl - 21-02-2022, 11:31 AM
RE: What do you use as a system monitor - by prx* - 24-02-2022, 06:02 PM
RE: What do you use as a system monitor - by gaak - 31-10-2022, 04:21 AM