kalaksi / lightkeeper

GNU General Public License v3.0
122 stars 5 forks source link

Ping issue on 0.4.4 version #3

Closed oktay454 closed 1 year ago

oktay454 commented 1 year ago
$> flatpak run io.github.kalaksi.Lightkeeper 
[2023-09-10T09:57:46Z INFO  lightkeeper] Lightkeeper starting...
[2023-09-10T09:57:46Z INFO  lightkeeper::module::module_factory] Validating modules
[2023-09-10T09:57:46Z INFO  lightkeeper::module::module_factory] Loaded 28 command modules, 19 monitoring modules and 2 connector modules
[2023-09-10T09:57:46Z INFO  lightkeeper::configuration] Reading main configuration from /home/oktay454/.var/app/io.github.kalaksi.Lightkeeper/config/config.yml
[2023-09-10T09:57:46Z INFO  lightkeeper::configuration] Reading host configuration from /home/oktay454/.var/app/io.github.kalaksi.Lightkeeper/config/hosts.yml
[2023-09-10T09:57:46Z INFO  lightkeeper::configuration] Reading group configuration from /home/oktay454/.var/app/io.github.kalaksi.Lightkeeper/config/groups.yml
Gtk-Message: 12:57:46.408: Failed to load module "xapp-gtk3-module"
Gtk-Message: 12:57:46.427: Failed to load module "canberra-gtk-module"
Gtk-Message: 12:57:46.428: Failed to load module "canberra-gtk-module"
[2023-09-10T09:57:46Z WARN  default] Qt: Session management error: Could not open network socket
[2023-09-10T09:57:46Z INFO  lightkeeper::module::connection::ssh] Connected to 127.0.0.1:22
[2023-09-10T09:57:46Z WARN  lightkeeper::module::connection::ssh] Password is not set, trying authentication with first key found in SSH agent
[2023-09-10T09:57:47Z ERROR lightkeeper::monitor_manager] [example-host] Error from monitor ping: oping::PingError::LibOpingError: İşleme izin verilmedi

image

kalaksi commented 1 year ago

I've been wrangling with this issue for a while. Basically, due to the flatpak sandbox, it's currently not really possible to run ping when using flatpak (without breaking the sandbox).

Therefore, I recommend removing the ping monitor from the "defaults" group. If you really need ping to work, let me know.

oktay454 commented 1 year ago

Actually, it's not directly necessary. I might even suggest this instead: (We use this method in our self-developed commercial software) We send a TCP packet to the SSH port with Netcat. Thus, we do not have problems in environments where ping packets are blocked. We also understand whether there is access to the SSH port defined for the machine. According to the return response of the package; We check whether the machine is on, the port is closed, or is blocked by the firewall.

For example in Bash: nc -w 1 -z "IP_ADDRESS" "PORT" && echo 'Open' || echo 'Close' -w is timeout value -z is for listening daemons, without sending any data to them

kalaksi commented 1 year ago

Good idea! I just implemented "tcp-connect" monitoring module for checking a TCP port's openness (port 22 by default). It'll replace ping in the default configuration.

It will be included in the next release (I'll publish in a week or so).

kalaksi commented 1 year ago

0.5.0 is now out. Since new default configuration will not overwrite your current configuration, you'll want to switch "ping" to "tcp-connect" in the "defaults" config group yourself.

oktay454 commented 1 year ago

I deleted all configurations and ran it again. But it gave a different error.

[2023-09-17T20:48:04Z WARN  default] Qt: Session management error: Could not open network socket
[2023-09-17T20:48:06Z ERROR lightkeeper::connection_manager] [example-host] Error while connecting 127.0.0.1: Bağlantı reddedildi (os error 111)
[2023-09-17T20:48:06Z WARN  lightkeeper::monitor_manager] No response messages received for monitor _internal-platform-info-ssh
[2023-09-17T20:48:06Z ERROR lightkeeper::monitor_manager] [example-host] Error from monitor _internal-platform-info-ssh: Error while connecting: Bağlantı reddedildi (os error 111)
[2023-09-17T20:48:06Z WARN  default] file:///app/qml/DetailsView/HostDetailsMainView.qml:213:25: QML PropertyTable: the delegate's implicitWidth needs to be greater than zero

image

kalaksi commented 1 year ago

That's just the default example-host (localhost) that isn't responding. You'll have to edit it or remove it to add the real hosts that you want.

oktay454 commented 1 year ago

I am testing on my own machine. =D

oktay454 commented 1 year ago

We can turn this off. Since another control mechanism was preferred instead of ping, it is no longer necessary.