mattthias / slurm

yet another network load monitor
http://github.com/mattthias/slurm/wiki/
GNU General Public License v2.0
402 stars 42 forks source link

Interface is entirely grey #21

Open contentfree opened 6 years ago

contentfree commented 6 years ago

Built the latest (as of today's date) and it runs with all function except that the interface is all grey (except for the labels which appear to be black… this was with -t blue):

image

Running in iTerm 2 on macOS Sierra

mattthias commented 6 years ago

Hi @contentfree ,

looks like cmake couldn't detect libncurses and uses libcurses instead. The latter is missing color support. As i have no MacOS machine i'll ask a colleague tomorrow to reproduce your problem.

Just in case; I found the following in the iTerm2 FAQ (https://www.iterm2.com/faq.html):

    Q: Why is my text all black and white?
    A: The most common cause is that "minimum contrast" (under preferences > profiles > colors) is turned up all the way.
despair86 commented 5 years ago

I'm on Solaris 2.11, having the same problem with ncurses.

Using the stock AT&T curses (which also has colour support), the labels are legible, but colours are still suppressed: image

This is with ncurses: image

As a reference, my build of st is perfectly capable of displaying colour (using either library): image

despair86 commented 5 years ago

ok found the problem (I think)

On actual UNIX systems like Solaris and macOS, /usr/include/curses.h is either BSD or AT&T curses. Here, ncurses is in /usr/include/ncurses/curses.h. Furthermore, because of this difference, CMake fails to define _HAVE_NCURSES, leading to the blank labels in fig. 1.

I do not have a macOS box to test this patch on, sorry...

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c4aa7b4..2d8b6a4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,6 +11,20 @@ if (CURSES_HAVE_NCURSES_H)
   add_definitions(-D_HAVE_NCURSES)
 endif()

+OPTION(WITH_LED "Enable LEDs" ON)
+
+if (WITH_LED)
+  add_definitions(-DWITH_LED)
+endif()
+
+if ("{CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
+  set(LINUX TRUE)
+endif()
+
+if(UNIX OR APPLE AND NOT LINUX)
+  add_definitions(-D_HAVE_NCURSES)
+endif()
+
 set(SLURM_SOURCES slurm.c)

 # CentOS 6 / CentOS 7 only have very old cmake version where the FindCurses
diff --git a/os.h b/os.h
index a268f86..265311c 100644
--- a/os.h
+++ b/os.h
@@ -158,6 +158,8 @@
 #include <ctype.h>
 #include <signal.h>
 #include <curses.h>
+/* Uncomment if your reguler curses.h is NOT ncurses, and remove previous line */
+/* #include <ncurses/curses.h> */
 #include <ifaddrs.h>
 #include <sys/param.h>
 #include <sys/sysctl.h>
@@ -210,7 +212,7 @@
 #include <time.h>
 #include <ctype.h>
 #include <signal.h>
-#include <curses.h>
+#include <ncurses/curses.h>
 #include <sys/wait.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>

image My local build has the background set to 0 instead of -1 because i use dtterm (and other custom colour-terminals)

mattthias commented 5 years ago

Thank you for the work spend on this! I should craft a new release some when soon with a fix included.

But good to see that "Interface Speed" detection on Solaris works fine :-)

despair86 commented 5 years ago

in retrospect, I probably should have patched the other UNIX sections, but I don't know how the other vendors package ncurses (relevant ncurses config option: --enable-overwrite gets rid of AT&T or BSD curses)

despair86 commented 5 years ago

But good to see that "Interface Speed" detection on Solaris works fine :-)

It's broken for TUN/TAP driver image

slurm 0.4.3+git  - http://www.github.com/mattthias/slurm/
sun-pc% ifconfig tun0
tun0: flags=10008d1<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST,IPv4> mtu 1500 index
41
        inet 10.0.0.1 --> 10.0.0.1 netmask ffff0000

Ah. Turns out the Solaris TAP driver does not export any network card kstats like it should, referring to upstream for advice.