summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2023-04-29 12:27:53 +0300
committerPaul Buetow <paul@buetow.org>2023-04-29 12:27:53 +0300
commit6d4a5cfee616250e689f952d27ad08607254fe43 (patch)
tree01c6b8efcf9ac1dc561616265e4ca7376cf62de2
parent4be98d39f0a956e9263d41fd5a489125ad98b35a (diff)
finishing draft
-rw-r--r--gemfeed/DRAFT-unveiling-guprecords:-uptime-records-with-raku.gmi103
1 files changed, 103 insertions, 0 deletions
diff --git a/gemfeed/DRAFT-unveiling-guprecords:-uptime-records-with-raku.gmi b/gemfeed/DRAFT-unveiling-guprecords:-uptime-records-with-raku.gmi
new file mode 100644
index 00000000..b3afc09c
--- /dev/null
+++ b/gemfeed/DRAFT-unveiling-guprecords:-uptime-records-with-raku.gmi
@@ -0,0 +1,103 @@
+# Unveiling `guprecords`: Global Uptime Records with Raku
+
+```
++-----+-----------------+-----------------------------+
+| Pos | Host | Lifespan |
++-----+-----------------+-----------------------------+
+| 1. | dionysus | 8 years, 6 months, 17 days |
+| 2. | uranus | 7 years, 2 months, 16 days |
+| 3. | alphacentauri | 6 years, 9 months, 13 days |
+| 4. | *vulcan | 4 years, 5 months, 6 days |
+| 5. | sun | 3 years, 10 months, 2 days |
+| 6. | uugrn | 3 years, 5 months, 5 days |
+| 7. | deltavega | 3 years, 1 months, 21 days |
+| 8. | pluto | 2 years, 10 months, 30 days |
+| 9. | tauceti | 2 years, 3 months, 22 days |
+| 10. | callisto | 2 years, 3 months, 13 days |
++-----+-----------------+-----------------------------+
+```
+
+# 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.
+
+Guprecords, or global uptime records, is a Raku script designed to generate a consolidated uptime report from multiple hosts:
+
+=> https://codeberg.org/snonux/guprecords
+
+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.
+
+## Implementation
+
+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:
+
+```sh
+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 analyze the data.
+
+Guprecords supports the following features:
+
+* Supports multiple categories: Host, Kernel, KernelMajor, and KernelName
+* Supports multiple metrics: Boots, Uptime, Score, Downtime, and Lifespan
+* Output formats available: Plaintext, Markdown, and Gemtext
+* Provides top entries based on the specified limit
+* Allows generating reports for all possible combinations of categories and metrics
+
+## Example
+
+You have already seen an example at the very top of this post, where the hosts were grouped by their total lifespans (uptime+downtime). Here's an example of what the global uptime report (grouped by total host uptimes) might look like:
+
+```
+Top 20 Uptime's by Host
+
++-----+-----------------+-----------------------------+
+| Pos | Host | Uptime |
++-----+-----------------+-----------------------------+
+| 1. | *vulcan | 4 years, 5 months, 6 days |
+| 2. | uranus | 3 years, 11 months, 21 days |
+| 3. | sun | 3 years, 9 months, 26 days |
+| 4. | uugrn | 3 years, 5 months, 5 days |
+| 5. | deltavega | 3 years, 1 months, 21 days |
+| 6. | pluto | 2 years, 10 months, 29 days |
+| 7. | tauceti | 2 years, 3 months, 19 days |
+| 8. | tauceti-f | 1 years, 9 months, 18 days |
+| 9. | *ultramega15289 | 1 years, 8 months, 17 days |
+| 10. | *earth | 1 years, 5 months, 22 days |
+| 11. | *blowfish | 1 years, 4 months, 20 days |
+| 12. | ultramega8477 | 1 years, 3 months, 25 days |
+| 13. | host0 | 1 years, 3 months, 9 days |
+| 14. | tauceti-e | 1 years, 2 months, 20 days |
+| 15. | makemake | 1 years, 1 months, 6 days |
+| 16. | callisto | 0 years, 10 months, 31 days |
+| 17. | alphacentauri | 0 years, 10 months, 28 days |
+| 18. | london | 0 years, 9 months, 16 days |
+| 19. | twofish | 0 years, 8 months, 31 days |
+| 20. | *fishfinger | 0 years, 8 months, 17 days |
++-----+-----------------+-----------------------------+
+```
+
+This table ranks the top 20 hosts based on their total uptime, with the host having the highest uptime at the top. The hosts marked with `*` are still active, means stats were collected within the last couple of months.
+
+My up to date stats can be seen here:
+
+=> ../uptime-stats.gmi My machine uptime stats
+
+## Conclusion
+
+Guprecords is a powerful tool who track uptime statistics for fun with a simple implementation and comprehensive reports. About Raku,
+
+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.
+
+E-Mail your comments to hi@paul.cyou :-)
+
+=> ../ Back to the main site