Monitorare l'uptime in Linux con Uptimed

Mattepuffo's logo
Monitorare l'uptime in Linux con Uptimed

Monitorare l'uptime in Linux con Uptimed

Uptimed è una utility da riga di comando che ci permette di tenere traccia dell'uptime della nostra distro Linux.

Per installarlo su Arch Linux:

# pacman -Sy uptimed

Su Debian:

# aptitude install uptimed

Una volta installato:

# systemctl start uptimed

# systemctl status uptimed
● uptimed.service - uptime record daemon
   Loaded: loaded (/lib/systemd/system/uptimed.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2020-02-25 14:22:56 CET; 2min 57s ago
     Docs: man:uptimed(8)
           man:uptimed.conf(5)
 Main PID: 758 (uptimed)
    Tasks: 1 (limit: 4915)
   Memory: 524.0K
   CGroup: /system.slice/uptimed.service
           └─758 /usr/sbin/uptimed -f

feb 25 14:22:56 server-casa systemd[1]: Started uptime record daemon.

Per avere un database di partenza dovete riavviare il pc / server.

Poi vi basterà usare uprecords:

# uprecords
     #               Uptime | System                                     Boot up
----------------------------+---------------------------------------------------
     1     0 days, 05:22:02 | Linux 4.19.0-8-amd64      Tue Feb 25 09:00:24 2020
->   2     0 days, 00:03:57 | Linux 4.19.0-8-amd64      Tue Feb 25 14:22:47 2020
----------------------------+---------------------------------------------------
no1 in     0 days, 05:18:06 | at                        Tue Feb 25 19:44:50 2020
    up     0 days, 05:25:59 | since                     Tue Feb 25 09:00:24 2020
  down     0 days, 00:00:21 | since                     Tue Feb 25 09:00:24 2020
   %up               99.893 | since                     Tue Feb 25 09:00:24 2020

Potete anche visualizzare i records in ordine (crescente e descrescente):

# uprecords -b
     #               Uptime | System                                     Boot up
----------------------------+---------------------------------------------------
     1     0 days, 05:22:02 | Linux 4.19.0-8-amd64      Tue Feb 25 09:00:24 2020
->   2     0 days, 00:04:33 | Linux 4.19.0-8-amd64      Tue Feb 25 14:22:47 2020

# uprecords -B
     #               Uptime | System                                     Boot up
----------------------------+---------------------------------------------------
->   1     0 days, 00:04:36 | Linux 4.19.0-8-amd64      Tue Feb 25 14:22:47 2020
     2     0 days, 05:22:02 | Linux 4.19.0-8-amd64      Tue Feb 25 09:00:24 2020

Oppure possiamo visualizzare i periodi di downtime:

# uprecords -d
     #               Uptime |        Last downtime                       Boot up
----------------------------+---------------------------------------------------
     1     0 days, 05:22:02 |     0 days, 00:00:00      Tue Feb 25 09:00:24 2020
->   2     0 days, 00:06:07 |     0 days, 00:00:21      Tue Feb 25 14:22:47 2020
----------------------------+---------------------------------------------------
no1 in     0 days, 05:15:56 | at                        Tue Feb 25 19:44:50 2020
    up     0 days, 05:28:09 | since                     Tue Feb 25 09:00:24 2020
  down     0 days, 00:00:21 | since                     Tue Feb 25 09:00:24 2020
   %up               99.893 | since                     Tue Feb 25 09:00:24 2020

Diciamo che su un server può essere molto utile.

Enjoy!


Share this Post

Commentami!