System Uptime Tracking #
The system uptime tracking feature monitors when a client system is up. It works on an hourly basis—the system is considered up if it was running at any part of the given hour. The information is stored in SUSE Customer Center (SCC) and Repository Mirroring Tool (RMT), and serves as a source for analytics purposes.
1 Requirements #
The version of the suseconnect-ng package has to be 1.13 or newer. Verify it by running
suseconnect --version
.If the client system is behind RMT, the version of the rmt-server package on the RMT server has to be 2.17 or newer. Verify it by running
rpm -q rmt-server
.
2 Enabling the uptime tracking #
The uptime tracking is disabled by default. To enable it on the client
system, start its systemd
timer and adjust the SUSEConnect
configuration.
systemd
timer #Enable and start the
suse-uptime-tracker
timer.>
sudo
systemctl enable --now suse-uptime-tracker.timerCheck if the service is running.
>
systemctl status suse-uptime-tracker.timer
(Optional) If you do not have a copy of the
/etc/SUSEConnect
file, create it by copying the example file.>
sudo
cp /etc/SUSEConnect.example /etc/SUSEConnectEdit
/etc/SUSEConnect
and enable the uptime tracking.enable_system_uptime_tracking: true
After enabling the uptime tracking, the timer checks if the system is running every 15 minutes and stores the findings in a log file
/etc/zypp/suse-uptime.log
. The log file is uploaded to SCC/RMT by thesuseconnect-keepalive
service, which is triggered by thesuseconnect-keepalive
timer every 24 hours. Verify that the timer is running.>
systemctl status suseconnect-keepalive.timer
3 Viewing and downloading the data from SCC #
The SUSE Customer Center provides visualization of the uptime data for the last 14 days. The data is presented for individual systems in a histogram. You can monitor uptime trends and download CSV files with the uptime data for all owned servers and individual systems.
Uptime data graphs and download capabilities are available only for systems that have reported uptime data. For systems that have not reported any uptime data, there are no uptime tracking widgets in the
section of SCC.Log in to SCC at https://scc.suse.com with your credentials.
In the left panel, select
and click the tab to view the systems in your organization that have uptime data available in the last 14 days.To download a CSV file that contains uptime data for all the systems in your organization, click the
button on the right.Figure 1: Download uptime data for all systems in an organization #Note: Empty CSV fileIf no systems have reported uptime data, the
button is still available but the downloaded CSV file is empty.To view the uptime data histogram for a specific host, click its name from the list. In the host's
section, the 14-day histogram provides a detailed visual representation of the system uptime.Figure 2: Uptime data histogram #To download a CSV file containing the uptime data for the selected system, click the
button located above the histogram.
4 Retrieving the data from the command line #
You can retrieve the data that the uptime tracker collects from SCC and export them to the CSV format via its REST API.
Obtain your organization's mirroring credentials from the https://scc.suse.com.
tab on the SCC Web site atGet the list of all systems for your organization.
>
curl -X 'GET' \ -u'USERNAME:PASSWORD' \ 'https://scc.suse.com/connect/organizations/systems' \ -H 'accept: application/json'In the list of systems, identify the client for which you want to retrieve the uptime data by matching its credentials found in the client's
/etc/zypp/credentials.d/SCCcredentials
file.Retrieve the uptime data. The following examples retrieve uptime data for the system with ID
16300735
from Apr 24th, 2024 to May 1st, 2024. You can use either thecurl
orwget
commands for the retrieval.To retrieve the data using the
curl
command, run the following:>
curl -X 'GET' \ -u'USERNAME:PASSWORD' \ 'https://scc.suse.com/connect/organizations/system_uptimes?system_id=16300735&online_from=2024-04-24&online_to=2024-05-01' \ -H 'accept: text/csv'To retrieve the data using the
wget
command, run the following:>
wget --no-check-certificate \ --user=USERNAME --password=PASSWORD \ 'https://scc.suse.com/connect/organizations/system_uptimes?system_id=16300735&online_from=2024-04-24&online_to=2024-05-01' \ --header='accept: text/csv'
5 Understanding the uptime data #
The uptime data retrieved from SCC has the following structure, where columns are separated by semicolons, for example:
System;Uuid;Online At Day;Online For Hours 15892209;9e818a04-9e82-4584-8f41-b0f39a045526;2024-03-08;15 15892209;9e818a04-9e82-4584-8f41-b0f39a045526;2024-03-09;3 15892209;9e818a04-9e82-4584-8f41-b0f39a045526;2024-03-11;9 15892209;9e818a04-9e82-4584-8f41-b0f39a045526;2024-03-12;14 15892209;9e818a04-9e82-4584-8f41-b0f39a045526;2024-03-13;15 15892209;9e818a04-9e82-4584-8f41-b0f39a045526;2024-03-14;3 15892210;9e818a04-9e82-4584-8f41-b0f39a045526;2024-02-27;20 15892210;9e818a04-9e82-4584-8f41-b0f39a045526;2024-02-28;20 15892210;9e818a04-9e82-4584-8f41-b0f39a045526;2024-02-29;20 15892210;9e818a04-9e82-4584-8f41-b0f39a045526;2024-03-01;13
If the above wget
and curl
commands
include the include_hourly=true
option, you receive more
details about at what hours the host was up, for example:
System;Uuid;Online At Day;Online At Hours;Online For Hours 15892209;9e818a04-9e82-4584-8f41-b0f39a045526;2024-03-08;111111100000000011111111;15 15892209;9e818a04-9e82-4584-8f41-b0f39a045526;2024-03-09;111000000000000000000000;3 15892209;9e818a04-9e82-4584-8f41-b0f39a045526;2024-03-11;000000000000000111111111;9 15892209;9e818a04-9e82-4584-8f41-b0f39a045526;2024-03-12;111110000000000111111111;14 15892209;9e818a04-9e82-4584-8f41-b0f39a045526;2024-03-13;111111000000000111111111;15 15892209;9e818a04-9e82-4584-8f41-b0f39a045526;2024-03-14;111000000000000000000000;3 15892210;9e818a04-9e82-4584-8f41-b0f39a045526;2024-02-27;000011111111111111111111;20 15892210;9e818a04-9e82-4584-8f41-b0f39a045526;2024-02-28;000011111111111111111111;20 15892210;9e818a04-9e82-4584-8f41-b0f39a045526;2024-02-29;000011111111111111111111;20 15892210;9e818a04-9e82-4584-8f41-b0f39a045526;2024-03-01;011111000000000011111111;13
The columns have the following meaning:
- System
All the systems managed by SCC/RMT are uniquely identified by a system ID generated during system registration in SCC/RMT.
- Uuid
A unique hardware identifier.
- Online At Day
The days on which the system was up at least for one hour. See the “Online At Hours” term explanation for deeper understanding.
- Online At Hours
Each bit represents the hour of the day. The leftmost position represents the zeroth hour of the day. “1” indicates that the system was up at any time during an hour, while “0” indicates that the system was offline.
- Online For Hours
Number of hours when the system was up during a given day.
6 Practical tasks #
- 1. Why is the uptime data not available?
On the client host, verify that the
suseconnect-keepalive
timer is running. It controls triggering thesuseconnect-keepalive.service
service automatically every 24 hours.
- 2. Was the host up between 9–10 a.m. on 2024-02-27?
Retrieve the uptime data as described in Section 4, “Retrieving the data from the command line”. Open the data file and search for the line that starts with
2024-02-27
. Inspect that day's bit pattern, for example,000011111111111111111111
and count up to the 10th digit (the bit starts with 0 a.m.) from left. The corresponding bit is1
, therefore the system was up between 9 and 10 a.m.
- 3. What is the total uptime and downtime of the host on 2024-02-27?
The log line related to that date shows the bit pattern
000011111111111111111111
. There are twenty 1's and four 0's in the pattern meaning that the host was up for twenty hours and down for four hours.
- 4. How many days was the host up in February 2024?
To retrieve statistics about the host in a specific month, adjust the
online_from
andonline_to
parameters in the URL query mentioned in Section 4, “Retrieving the data from the command line”, for example:>
curl -X 'GET' \ -u'USERNAME:PASSWORD' \ 'https://scc.suse.com/connect/organizations/system_uptimes?include_hourly=true&system_id=16300735&online_from=2024-02-01&online_to=2024-02-29' \ -H 'accept: text/csv' System;Uuid;Online At Day;Online At Hours;Online For Hours 16300735;78740b8c-7d23-42f8-b5fe-4776c47b9cb9;2024-04-24;000000000000000000000001;1 16300735;78740b8c-7d23-42f8-b5fe-4776c47b9cb9;2024-04-25;110000000000000000000000;2The sum in the rightmost column is 3, indicating the host was up for 3 days in February 2024.
- 5. How do I retrieve the uptime data for all hosts in my organization?
For that purpose, omit the
system_id
,online_from
andonline_to
parameters from the URL query, for example:>
curl -X 'GET' \ -u'USERNAME:PASSWORD' \ 'https://scc.suse.com/connect/organizations/system_uptimes?include_hourly=true \ -H 'accept: text/csv' System;Uuid;Online At Day;Online At Hours;Online For Hours 15892209;9e818a04-9e82-4584-8f41-b0f39a045526;2024-03-08;111111100000000011111111;15 15892209;9e818a04-9e82-4584-8f41-b0f39a045526;2024-03-09;111000000000000000000000;3 15892209;9e818a04-9e82-4584-8f41-b0f39a045526;2024-03-11;000000000000000111111111;9 15892209;9e818a04-9e82-4584-8f41-b0f39a045526;2024-03-12;111110000000000111111111;14 15892209;9e818a04-9e82-4584-8f41-b0f39a045526;2024-03-13;111111000000000111111111;15 15892209;9e818a04-9e82-4584-8f41-b0f39a045526;2024-03-14;111000000000000000000000;3 15892210;9e818a04-9e82-4584-8f41-b0f39a045526;2024-02-27;000011111111111111111111;20 15892210;9e818a04-9e82-4584-8f41-b0f39a045526;2024-02-28;000011111111111111111111;20 15892210;9e818a04-9e82-4584-8f41-b0f39a045526;2024-02-29;000011111111111111111111;20 15892210;9e818a04-9e82-4584-8f41-b0f39a045526;2024-03-01;011111000000000011111111;13As you can see, the list includes system IDs from different hosts.