From 353e42a9f5f4a6febf2129d31c5da4050cf09269 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 30 Apr 2023 12:58:05 +0300 Subject: new draft --- ...eiling-guprecords:-uptime-records-with-raku.gmi | 66 +++++++++++++++++++--- 1 file changed, 58 insertions(+), 8 deletions(-) diff --git a/gemfeed/DRAFT-unveiling-guprecords:-uptime-records-with-raku.gmi b/gemfeed/DRAFT-unveiling-guprecords:-uptime-records-with-raku.gmi index 77056e19..6d13d4cf 100644 --- a/gemfeed/DRAFT-unveiling-guprecords:-uptime-records-with-raku.gmi +++ b/gemfeed/DRAFT-unveiling-guprecords:-uptime-records-with-raku.gmi @@ -1,4 +1,4 @@ -# Unveiling `guprecords`: Global Uptime Records with Raku +# Unveiling `guprecords.raku`: Global Uptime Records with Raku ``` +-----+-----------------+-----------------------------+ @@ -19,7 +19,9 @@ # Introduction -For fun, I am tracking the uptime of various machines. I am hereby introducing `guprecords`, a handy Raku script that helps me to combine uptime statistics from multiple machines into one comprehensive report. In this blog post, we'll explore what `guprecords` is, its use case, implementation, and some examples of its application. +For fun, I am tracking the uptime of various personal machines (servers, laptops, workstations...). I have been doing this for over ten years now, so I have a lot of statistics collected. + +As a result of this, I am introducing `guprecords.raku`, a handy Raku script that helps me combine uptime statistics from multiple servers into one comprehensive report. In this blog post, I'll explore what Guprecords is and some examples of its application. I will also add some notes on Raku. Guprecords, or global uptime records, is a Raku script designed to generate a consolidated uptime report from multiple hosts: @@ -27,16 +29,25 @@ Guprecords, or global uptime records, is a Raku script designed to generate a co A previous version of Guprecords was actually written in Perl, the older and more established language from which Raku was developed. One of the primary motivations for rewriting Guprecords in Raku was to learn the language and explore its features. Raku is a more modern and powerful language compared to Perl, and working on a real-world project like Guprecords provided a practical and engaging way to learn the language. -## How it works +Over the last years, I have been reading the following books and resources about Raku: + +* Raku Guide (at raku.guide) +* Think Perl 6 +* Raku Fundamentals +* Raku Recipes + +And I have been following the Raku newsletter, and sometimes I have been lurking around in the IRC channels, too. Watching Raku coding challenges on YouTube was pretty fun, too. However, nothing beats actually using Raku to learn the language. After reading all of these resources, I may have a good idea about the features and paradigms, but I am by far not an expert. + +## How Guprecords works Guprecords works in three stages: * 1. Generating uptime statistics using `uptimed`: First, I need to install and run `uptimed` on each host to generate uptime statistics. This tool is available for most common Linux and *BSD distributions and macOS via Homebrew. * 2. Collecting uptime records to a central location: The next step involves collecting the raw uptime statistics files generated by `uptimed` on each host. It's a good idea to store all record files in a central git repository. The records file contains information about the total uptime since boot, boot time, and the operating system and kernel version. Guprecords itself does not do the collection part, but have a look at the `README.md` in the git repository for some guidance. -* 3. Generating global uptime stats: Finally, run the `guprecords` script with the appropriate flags to create a global uptime report. For example, I can use the following command: +* 3. Generating global uptime stats: Finally, run the `guprecords.raku` script with the appropriate flags to create a global uptime report. For example, I can use the following command: ```sh -raku guprecords.raku --stats=dir=$HOME/git/uprecords/stats --all +$ raku guprecords.raku --stats=dir=$HOME/git/uprecords/stats --all ``` This command will generate a comprehensive uptime report from the collected statistics, making it easy to review and enjoy the data. @@ -87,16 +98,55 @@ My up to date stats can be seen here: => ../uptime-stats.gmi My machine uptime stats -## Conclusion +Just recently, I decommissioned `vulcan` (the number one stop from above), which used to be my CentOS 7 (initially CentOS 6) VM hosting my personal NextCloud and Wallabag (which I modernised just recently with a new VM). This was the last `uptimed` output before shutting it down: -Guprecords is a powerful tool who track uptime statistics for fun with a simple implementation and comprehensive reports. About Raku, +``` + # Uptime | System Boot up +----------------------------+--------------------------------------------------- + 1 545 days, 17:58:15 | Linux 3.10.0-1160.15.2.e Sun Jul 25 19:32:25 2021 + 2 279 days, 10:12:14 | Linux 3.10.0-957.21.3.el Sun Jun 30 12:43:41 2019 + 3 161 days, 06:08:43 | Linux 3.10.0-1160.15.2.e Sun Feb 14 11:05:38 2021 + 4 107 days, 01:26:35 | Linux 3.10.0-957.1.3.el7 Thu Dec 20 09:29:13 2018 + 5 96 days, 21:13:49 | Linux 3.10.0-1127.13.1.e Sat Jul 25 17:56:22 2020 +-> 6 89 days, 23:05:32 | Linux 3.10.0-1160.81.1.e Sun Jan 22 12:39:36 2023 + 7 63 days, 18:30:45 | Linux 3.10.0-957.10.1.el Sat Apr 27 18:12:43 2019 + 8 63 days, 06:53:33 | Linux 3.10.0-1127.8.2.el Sat May 23 10:41:08 2020 + 9 48 days, 11:44:49 | Linux 3.10.0-1062.18.1.e Sat Apr 4 22:56:07 2020 + 10 42 days, 08:00:13 | Linux 3.10.0-1127.19.1.e Sat Nov 7 11:47:33 2020 + 11 36 days, 22:57:19 | Linux 3.10.0-1160.6.1.el Sat Dec 19 19:47:57 2020 + 12 21 days, 06:16:28 | Linux 3.10.0-957.10.1.el Sat Apr 6 11:56:01 2019 + 13 12 days, 20:11:53 | Linux 3.10.0-1160.11.1.e Mon Jan 25 18:45:27 2021 + 14 7 days, 21:29:18 | Linux 3.10.0-1127.13.1.e Fri Oct 30 14:18:04 2020 + 15 6 days, 20:07:18 | Linux 3.10.0-1160.15.2.e Sun Feb 7 14:57:35 2021 + 16 1 day , 21:46:41 | Linux 3.10.0-957.1.3.el7 Tue Dec 18 11:42:19 2018 + 17 0 days, 01:25:57 | Linux 3.10.0-957.1.3.el7 Tue Dec 18 10:16:08 2018 + 18 0 days, 00:42:34 | Linux 3.10.0-1160.15.2.e Sun Jul 25 18:49:38 2021 + 19 0 days, 00:08:32 | Linux 3.10.0-1160.81.1.e Sun Jan 22 12:30:52 2023 +----------------------------+--------------------------------------------------- +1up in 6 days, 22:08:18 | at Sat Apr 29 10:53:25 2023 +no1 in 455 days, 18:52:44 | at Sun Jul 21 07:37:51 2024 + up 1586 days, 00:20:28 | since Tue Dec 18 10:16:08 2018 + down 0 days, 01:08:32 | since Tue Dec 18 10:16:08 2018 + %up 99.997 | since Tue Dec 18 10:16:08 2018 +``` -While developing Guprecords, I have come to truly appreciate and love Raku's expressiveness. The language is designed to be both powerful and flexible, allowing developers to express their intentions and logic more clearly and concisely. +## Conclusion + +Guprecords is a small, yet powerful tool for analyzing uptime statistics. While developing Guprecords, I have come to truly appreciate and love Raku's expressiveness. The language is designed to be both powerful and flexible, allowing developers to express their intentions and logic more clearly and concisely. Raku's expressive syntax, support for multiple programming paradigms, and unique features, such as grammars and lazy evaluation, make it a joy to work with. The language's strong emphasis on readability and maintainability allows for the creation of elegant code that is easy to understand and modify. Working on Guprecords in Raku has been an enjoyable experience, and I've found that Raku's expressiveness has significantly contributed to the overall quality and effectiveness of the script. The language's ability to elegantly express complex logic and data manipulation tasks makes it an excellent choice for developing tools like these, where clarity and efficiency are of the utmost importance. +So far, I have only scratched the surface of what Raku can do. I hope to find more time to become a regular Rakoon (a Raku Programmer). I have many Ideas for other small tools like Guprecords, but the challenge is finding the time. I'd love to explore Raku Grammars and also I would love to explore writing concurrent code in Raku (I also love Go (Golang), btw!). Ideas for future Raku personal projects are: + +* A log file analyzer, for generating `foo.zone` visitor stats for both, the Web and Gemini. +* A social media sharing scheduler a la `buffer.com`. I am using Buffer at the moment, but it is proprietary and also it's not really reliable. + +You might also be interested reading this: + +=> ./2022-05-27-perl-is-still-a-great-choice.gmi Perl is still a great choice + E-Mail your comments to hi@paul.cyou :-) => ../ Back to the main site -- cgit v1.2.3