Jump to contentJump to page navigation: previous page [access key p]/next page [access key n]
documentation.suse.com / System uptime tracking in SUSE Customer Center and RMT
SUSE Linux Enterprise Server

System Uptime Tracking

Publication Date: September 27, 2024

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.10 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.

Procedure 1: Enabling the systemd timer
  1. Install the suse-uptime-tracker package.

    > sudo zypper install suse-uptime-tracker
    Tip
    Tip

    If the package is not available from the SUSE Linux Enterprise Server repositories yet, download it from https://build.opensuse.org/package/show/systemsmanagement:SCC/uptime-tracker.

  2. Enable and start the suse-uptime-tracker service.

    > sudo systemctl enable --now suse-uptime-tracker
  3. Check if the service is running.

    > systemctl status suse-uptime-tracker
Procedure 2: Adjusting the SUSEConnect configuration
  1. (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/SUSEConnect
  2. Edit /etc/SUSEConnect and enable the uptime tracking.

    enable_system_uptime_tracking: true
  3. 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 the suseconnect-keepalive service, which is triggered by the suseconnect-keepalive timer every 24 hours. Verify that the timer is running.

    > systemctl status suseconnect-keepalive.timer

3 Retrieving the uptime tracker data

You can retrieve the data that the uptime tracker collects from SCC and export them to the CSV format via its REST API.

  1. Obtain your organization mirroring credentials from the Proxies tab in the SCC website at https://scc.suse.com.

  2. Get 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.

  3. 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 the curl or wget commands for the retrieval.

    1. 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?SystemId=16300735&OnlineFrom=2024-04-24&OnlineTo=2024-05-01' \
      -H 'accept: text/csv'
    2. 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?SystemId=16300735&OnlineFrom=2024-04-24&OnlineTo=2024-05-01' \
      --header='accept: text/csv'

4 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 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.

5 Practical tasks

1. Was the host up between 9–10 a.m. on 2024-02-27?

Retrieve the uptime data as described in Section 3, “Retrieving the uptime tracker data”. 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 is 1, therefore the system was up between 9 and 10 a.m.

2. 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.

3. How many days was the host up in February 2024?

To retrieve statistics about the host in a specific month, adjust the OnlineFrom and OnlineTo parameters in the URL query mentioned in Section 3, “Retrieving the uptime tracker data”, for example:

> curl -X 'GET' \
-u'USERNAME:PASSWORD' \
'https://scc.suse.com/connect/organizations/system_uptimes?SystemId=16300735&OnlineFrom=2024-02-01&OnlineTo=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;2

The sum in the rightmost column is 3, indicating the host was up for 3 days in February 2024.

4. How do I retrieve the uptime data for all hosts in my organization?

For that purpose, omit the SystemId, OnlineFrom and OnlineTo parameters from the URL query, for example:

> curl -X 'GET' \
-u'USERNAME:PASSWORD' \
'https://scc.suse.com/connect/organizations/system_uptimes \
-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;13

As you can see, the list includes system IDs from different hosts.