How to install Tuptime on OpenSUSE Leap 42.3
To install Tuptime on OpenSUSE Leap 42.3
Tuptime is a tool used for reporting the historical and statistical running time of a Linux system. This tool workds more less like the uptime command but provides a more advanced output. It also contains features such as register used kernels, first boot time, system startups, calculate uptime and downtime from first boot time, print current uptime and calculate the accumulated system uptime,downtime and total. This tutorial covers the installation procedure of Tuptime on OpenSUSE Leap 42.3.
Pre- Requisite
- Python modules (sys, OS, optparse, sqlite3, datetime, locale, platform, subprocess, time).
- Python 2.7 or 3.x installed but latest version is recommended.
Installation procedure
To proceed with the installation procedure, install the “ git” in the target system by entering into the tmp directory and executing the following command.
linuxhelp:~ # cd /tmp/
linuxhelp:/tmp # zypper in git
Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following 18 NEW packages are going to be installed:
cvs cvsps git git-core git-cvs git-email git-gui git-svn git-web gitk libserf-1-1 libsvn_auth_gnome_keyring-1-0 perl-Authen-SASL
perl-Error perl-Net-SMTP-SSL subversion subversion-bash-completion subversion-perl
The following 8 recommended packages were automatically selected:
git-cvs git-email git-gui git-svn gitk perl-Authen-SASL perl-Net-SMTP-SSL subversion-bash-completion
The following package is suggested, but will not be installed:
git-daemon
.
.
.
(14/18) Installing: git-2.13.6-7.1.x86_64 ....................................................................................[done]
(15/18) Installing: subversion-perl-1.9.7-8.1.x86_64 .........................................................................[done]
(16/18) Installing: subversion-bash-completion-1.9.7-8.1.noarch ..............................................................[done]
(17/18) Installing: libsvn_auth_gnome_keyring-1-0-1.9.7-8.1.x86_64 ...........................................................[done]
(18/18) Installing: git-svn-2.13.6-7.1.x86_64 ................................................................................[done]
Execute the below command to clone the tuptime repository.
linuxhelp:/tmp # git clone https://github.com/rfrail3/tuptime.git
Cloning into ' tuptime' ...
remote: Counting objects: 2563, done.
remote: Total 2563 (delta 0), reused 0 (delta 0), pack-reused 2563
Receiving objects: 100% (2563/2563), 804.22 KiB | 443.00 KiB/s, done.
Resolving deltas: 100% (1344/1344), done.
To use tuptime Tool
Move to the tuptime directory and list the files. The installed files will be displayed on the screen.
linuxhelp:/tmp # cd tuptime/
linuxhelp:/tmp/tuptime # ll
total 72
drwxr-xr-x 8 root root 4096 Oct 24 11:21 .git
-rw-r--r-- 1 root root 5124 Oct 24 11:21 CHANGELOG
-rw-r--r-- 1 root root 18047 Oct 24 11:21 LICENSE
-rw-r--r-- 1 root root 5114 Oct 24 11:21 README.md
drwxr-xr-x 3 root root 4096 Oct 24 11:21 debian
drwxr-xr-x 2 root root 4096 Oct 24 11:21 scripts
drwxr-xr-x 7 root root 4096 Oct 24 11:21 src
-rw-r--r-- 1 root root 3070 Oct 24 11:21 tuptime-install.sh
-rw-r--r-- 1 root root 15507 Oct 24 11:21 tuptime-manual.txt
Next install the Tuptime by executing the following script.
linuxhelp:/tmp/tuptime # sh tuptime-install.sh
Tuptime installation script
Clonning repository...
Cloning into ' /tmp/tmp.NDL0D3Shxj' ...
remote: Counting objects: 2563, done.
remote: Total 2563 (delta 0), reused 0 (delta 0), pack-reused 2563
Receiving objects: 100% (2563/2563), 804.22 KiB | 376.00 KiB/s, done.
Resolving deltas: 100% (1344/1344), done.
Copying files...
Creating tuptime user...
Creating tuptime db
Setting tuptime db ownership
.
.
.
.
Largest downtime: 0 seconds
Shortest downtime: 0 seconds
Average downtime: 0 seconds
Current uptime: 4 hours, 56 minutes and 40 seconds since 06:25:39 10/24/17
If the user executes the tuptime without any options, then a list of reports of System' s details will be displayed as shown below.
linuxhelp:/tmp/tuptime # tuptime
System startups: 1 since 06:25:39 10/24/17
System shutdowns: 0 ok - 0 bad
System uptime: 100.0 % - 4 hours, 57 minutes and 4 seconds
System downtime: 0.0 % - 0 seconds
System life: 4 hours, 57 minutes and 4 seconds
Largest uptime: 4 hours, 57 minutes and 4 seconds from 06:25:39 10/24/17
Shortest uptime: 4 hours, 57 minutes and 4 seconds from 06:25:39 10/24/17
Average uptime: 4 hours, 57 minutes and 4 seconds
Largest downtime: 0 seconds
Shortest downtime: 0 seconds
Average downtime: 0 seconds
Current uptime: 4 hours, 57 minutes and 4 seconds since 06:25:39 10/24/17
To display output with date and time
Run the following command to display the system' s output along with date and time.
linuxhelp:/tmp/tuptime # tuptime --date=' %H:%M:%S%d-%m-%Y'
System startups: 1 since 06:25:3924-10-2017
System shutdowns: 0 ok - 0 bad
System uptime: 100.0 % - 4 hours, 57 minutes and 20 seconds
System downtime: 0.0 % - 0 seconds
System life: 4 hours, 57 minutes and 20 seconds
Largest uptime: 4 hours, 57 minutes and 20 seconds from 06:25:3924-10-2017
Shortest uptime: 4 hours, 57 minutes and 20 seconds from 06:25:3924-10-2017
Average uptime: 4 hours, 57 minutes and 20 seconds
Largest downtime: 0 seconds
Shortest downtime: 0 seconds
Average downtime: 0 seconds
Current uptime: 4 hours, 57 minutes and 20 seconds since 06:25:3924-10-2017
Execute the following command to print system life as a list.
linuxhelp:/tmp/tuptime # tuptime --list
Startup: 1 at 06:25:39 10/24/17
Uptime: 4 hours, 57 minutes and 49 seconds
To create an alternative database file
Now create an alternative database file for Tuptime. Execute the following command to create the database which will be created in a SQLite format along with System' s details will also be displayed as shown below.
linuxhelp:/tmp/tuptime # tuptime --filedb /tmp/tuptime_db.db
System startups: 1 since 06:25:39 10/24/17
System shutdowns: 0 ok - 0 bad
System uptime: 100.0 % - 4 hours, 58 minutes and 17 seconds
System downtime: 0.0 % - 0 seconds
System life: 4 hours, 58 minutes and 17 seconds
Largest uptime: 4 hours, 58 minutes and 17 seconds from 06:25:39 10/24/17
Shortest uptime: 4 hours, 58 minutes and 17 seconds from 06:25:39 10/24/17
Average uptime: 4 hours, 58 minutes and 17 seconds
Largest downtime: 0 seconds
Shortest downtime: 0 seconds
Average downtime: 0 seconds
Current uptime: 4 hours, 58 minutes and 17 seconds since 06:25:39 10/24/17
Move back a directory and list the files to check the created database.
linuxhelp:/tmp/tuptime # cd ..
linuxhelp:/tmp # ll
drwxr-xr-x 6 root root 4096 Oct 24 11:21 tuptime
-rw-r--r-- 1 root root 2048 Oct 24 11:23 tuptime_db.db
Execute the following command to order output information.
linuxhelp:/tmp # tuptime --end --table
No. Startup Date Uptime Shutdown Date End Downtime
1 06:25:39 10/24/17 4 hours, 58 minutes and 58 seconds
To get the uptime information with system kernel, run the following command. The Kernel information is shown as follows.
linuxhelp:/tmp # tuptime --kernel
System startups: 1 since 06:25:39 10/24/17
System shutdowns: 0 ok - 0 bad
System uptime: 100.0 % - 4 hours, 59 minutes and 14 seconds
System downtime: 0.0 % - 0 seconds
System life: 4 hours, 59 minutes and 14 seconds
System kernels: 1
Largest uptime: 4 hours, 59 minutes and 14 seconds from 06:25:39 10/24/17
...with kernel: Linux-4.4.76-1-default-x86_64-with-SuSE-42.3-x86_64
Shortest uptime: 4 hours, 59 minutes and 14 seconds from 06:25:39 10/24/17
...with kernel: Linux-4.4.76-1-default-x86_64-with-SuSE-42.3-x86_64
Average uptime: 4 hours, 59 minutes and 14 seconds
Largest downtime: 0 seconds
...with kernel:
Shortest downtime: 0 seconds
Average downtime: 0 seconds
Current uptime: 4 hours, 59 minutes and 14 seconds since 06:25:39 10/24/17
...with kernel: Linux-4.4.76-1-default-x86_64-with-SuSE-42.3-x86_64
To check the version of the installed version, run the following command. The latest version of Tuptime is displayed.
linuxhelp:/tmp # tuptime --version
tuptime version 3.3.1
Next to know more about the options that can be used in Tuptime, execute the following command and the list of options is displayed.
linuxhelp:/tmp # tuptime --help
Usage: tuptime [options]
Options:
-h, --help show this help message and exit
-c, --ckernel classify / order by kernel
--csv csv output
-d DATE_FORMAT, --date=DATE_FORMAT
date format output
-e, --end order by end state
-f FILE, --filedb=FILE
database file
-g, --graceful register a gracefully shutdown
-k, --kernel print kernel information
-l, --list enumerate system life as list
-n, --noup avoid update values
-o, --offtime order by offtime / downtime
-r, --reverse reverse order
-s, --seconds output time in seconds and epoch
-S SINCE, --since=SINCE
restric since this register number
-t, --table enumerate system life as table
--tsince=TIMESTAMP restrict since this timestamp
--tuntil=TIMESTAMP restrict until this timestamp
-U UNTIL, --until=UNTIL
restrict until this register number
-u, --uptime order by uptime
-v, --verbose verbose output
-V, --version show version
-x, --silent update values into db without output
Thus we conclude the installation procedure of Tuptime on OpenSUSE Leap 42.3.
Comments ( 0 )
No comments available