Search This Blog

Showing posts with label systemd. Show all posts
Showing posts with label systemd. Show all posts

Tuesday, October 11, 2022

Fix Ubuntu/Debian server [Systemd Timesyncd Time] checkmk alert [Cannot reasonably calculate time since last synchronization (hosts time is running ahead)]

My checkmk server through alert on Ubuntu/Debian servers: Cannot reasonably calculate time since last synchronization (hosts time is running ahead)
# systemctl status systemd-timesyncd.service
● systemd-timesyncd.service - Network Time Synchronization
   Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
  Drop-In: /usr/lib/systemd/system/systemd-timesyncd.service.d
           └─disable-with-time-daemon.conf
   Active: active (running) since Mon 2022-09-26 17:47:50 EDT; 2 weeks 1 days ago
     Docs: man:systemd-timesyncd.service(8)
 Main PID: 443 (systemd-timesyn)
   Status: "Synchronized to time server for the first time 208.81.1.244:123 (0.debian.pool.ntp.org)."
    Tasks: 2 (limit: 4722)
   Memory: 1.7M
   CGroup: /system.slice/systemd-timesyncd.service
           └─443 /lib/systemd/systemd-timesyncd

Sep 26 17:47:50 Minecraft systemd[1]: Starting Network Time Synchronization...
Sep 26 17:47:50 Minecraft systemd[1]: Started Network Time Synchronization.
Sep 26 17:47:50 Minecraft systemd-timesyncd[443]: Synchronized to time server for the first time 208.81.1.244:123 (0.debian.pool.ntp.org).
Update the configuration: /etc/systemd/timesyncd.conf
[Time]
NTP=ca.pool.ntp.org
FallbackNTP=0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org 3.debian.pool.ntp.org
RootDistanceMaxSec=5
PollIntervalMinSec=32
PollIntervalMaxSec=2048
Restart the systemd-timesyncd.service
root@Minecraft:~# systemctl restart systemd-timesyncd.service
root@Minecraft:~# systemctl status systemd-timesyncd.service
● systemd-timesyncd.service - Network Time Synchronization
   Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
  Drop-In: /usr/lib/systemd/system/systemd-timesyncd.service.d
           └─disable-with-time-daemon.conf
   Active: active (running) since Tue 2022-10-11 20:11:36 EDT; 3s ago
     Docs: man:systemd-timesyncd.service(8)
 Main PID: 1796 (systemd-timesyn)
   Status: "Synchronized to time server for the first time 209.115.181.110:123 (ca.pool.ntp.org)."
    Tasks: 2 (limit: 4722)
   Memory: 1.3M
   CGroup: /system.slice/systemd-timesyncd.service
           └─1796 /lib/systemd/systemd-timesyncd

Oct 11 20:11:36 Minecraft systemd[1]: Starting Network Time Synchronization...
Oct 11 20:11:36 Minecraft systemd[1]: Started Network Time Synchronization.
Oct 11 20:11:36 Minecraft systemd-timesyncd[1796]: Synchronized to time server for the first time 209.115.181.110:123 (ca.pool.ntp.org).

Friday, March 22, 2019

Amazon Linux 2 Systemctl commands timeout - systemd issue

A long live AWS EC2 vm gave me this when I try to check the httpd running status:
systemctl status httpd
Failed to get properties: Connection timed out
According google search: https://serverfault.com/questions/712928/systemctl-commands-timeout-when-ran-as-root I tried both:
kill -9 1
systemctl daemon-reexec
None of them works. The [reboot] only flack a bit and kick me out of system but did not really reboot. I have to run:
systemctl --force --force reboot
To force it reboot. Love systemd!

Wednesday, April 19, 2017

check_mk agent install on CentOS 7 by systemd

Here is the steps I install check_mk agent on CentOS 7 by systemd only without xinit.

first scp the rpm package to CentOS server, then install it:
rpm -ivh check-mk-agent-1.2.8p18-1.noarch.rpm

Open the port 6556:
firewall-cmd --permanent --add-port=6556/tcp
firewall-cmd --reload

Double check the status:
firewall-cmd --list-ports
firewall-cmd --list-services

Restart to make sure the check_mk_agent start on boot.

Hope this helps.