Skip to content

Commit ef7646a

Browse files
committed
migrate old labs blogposts
1 parent a74fe5c commit ef7646a

530 files changed

Lines changed: 40777 additions & 1 deletion

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

assets/scss/_variables_project.scss

Lines changed: 138 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,87 @@ $transition-base: var(--transition-normal);
327327
transition: var(--transition-fast);
328328
}
329329

330+
// --- Fix content overlap with sticky navbar ---
331+
// Add padding to main content area for pages without blocks/cover or blocks/lead
332+
main.td-main {
333+
padding-top: 5rem;
334+
}
335+
336+
// --- Add horizontal padding for pages without sidebar ---
337+
// Pages without sidebar use <main class="td-main">, pages with sidebar use <div class="td-main">
338+
// Target only the main element version (no sidebar pages)
339+
main.td-main {
340+
padding-left: 1.5rem;
341+
padding-right: 1.5rem;
342+
343+
@media (min-width: 768px) {
344+
padding-left: 3rem;
345+
padding-right: 3rem;
346+
}
347+
348+
@media (min-width: 1200px) {
349+
padding-left: 6rem;
350+
padding-right: 6rem;
351+
}
352+
}
353+
354+
// Pages with blocks/cover or blocks/lead handle their own spacing
355+
main.td-main > .td-block:first-child {
356+
margin-top: -5rem;
357+
padding-top: 5rem;
358+
}
359+
360+
// --- Table of Contents Styling ---
361+
// Style TOC links - target lists that immediately follow a "Contents" heading
362+
// Using adjacent sibling selector to be specific
363+
h2#contents + ul {
364+
list-style: none;
365+
padding-left: 0;
366+
367+
> li {
368+
margin-bottom: 0.25rem;
369+
370+
> a {
371+
text-decoration: none;
372+
color: var(--bs-link-color);
373+
display: inline-block;
374+
padding: 0.15rem 0;
375+
transition: color var(--transition-fast);
376+
377+
&:hover {
378+
color: var(--bs-link-hover-color);
379+
}
380+
}
381+
}
382+
383+
// Nested lists (sub-items in TOC)
384+
ul {
385+
list-style: none;
386+
padding-left: 1.25rem;
387+
margin-top: 0.25rem;
388+
389+
li {
390+
position: relative;
391+
392+
&::before {
393+
content: "";
394+
position: absolute;
395+
left: -1rem;
396+
color: var(--bs-secondary-color);
397+
}
398+
399+
a {
400+
text-decoration: none;
401+
color: var(--bs-link-color);
402+
403+
&:hover {
404+
color: var(--bs-link-hover-color);
405+
}
406+
}
407+
}
408+
}
409+
}
410+
330411
// --- Sidebar Navigation Improvements ---
331412
.td-sidebar-nav__section .ul-1 {
332413
font-size: 0.95rem;
@@ -364,7 +445,63 @@ blockquote {
364445

365446
// --- Code Blocks ---
366447
.highlight {
367-
border-radius: $border-radius;
448+
border-radius: var(--border-radius-md);
449+
position: relative;
450+
margin-bottom: 0.5rem;
451+
452+
pre.chroma {
453+
padding: 1.5rem 1.25rem 1rem 1.25rem; // Top padding for copy button
454+
margin: 0;
455+
position: relative;
456+
overflow-x: auto;
457+
overflow-y: visible;
458+
max-height: none;
459+
460+
// Position the click-to-copy container at top left corner
461+
.click-to-copy {
462+
position: absolute;
463+
top: 1px;
464+
left: 1px;
465+
z-index: 10;
466+
467+
button.td-click-to-copy {
468+
padding: 0.2rem 0.4rem;
469+
font-size: 0.75rem;
470+
opacity: 0.5;
471+
transition: opacity 0.2s;
472+
473+
&:hover {
474+
opacity: 1;
475+
}
476+
}
477+
}
478+
479+
code {
480+
display: block;
481+
}
482+
}
483+
}
484+
485+
// Headings before code blocks - more space above, less below
486+
main.td-main h3 {
487+
margin-top: 1.75rem;
488+
margin-bottom: 0.4rem;
489+
}
490+
491+
main.td-main h2 {
492+
margin-top: 2.5rem;
493+
margin-bottom: 0.6rem;
494+
}
495+
496+
// First heading after hr doesn't need extra top margin
497+
main.td-main hr + h2 {
498+
margin-top: 1.5rem;
499+
}
500+
501+
// Reduce space between code block and next heading
502+
main.td-main .highlight + h3,
503+
main.td-main .highlight + h2 {
504+
margin-top: 2rem;
368505
}
369506

370507
// --- Dynamic Button Styling ---

config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ navbar_logo = true
173173
navbar_translucent_over_cover_disable = true
174174
# Enable to show the side bar menu in its compact state.
175175
sidebar_menu_compact = true
176+
# Increase from default 100 to accommodate all blog posts
177+
sidebar_menu_truncate = 400
176178
# Set to true to hide the sidebar search box (the top nav search box will still be displayed if search is enabled)
177179
sidebar_search_disable = true
178180
# Enable dark mode toggle
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
---
2+
author: Admin
3+
date: '2009-07-03T18:08:10+00:00'
4+
slug: check_nfs_ping-ein-nagios-plugin-fur-nfs-filesysteme-das-sich-nicht-aufhangt
5+
tags:
6+
- Nagios
7+
title: check_fs_ping - Ein Nagios-Plugin für NFS-Filesysteme, das sich nicht aufhängt
8+
---
9+
10+
Ein unangenehmes Phänomen bei NFS-gemounteten Filesysteme tritt auf, wenn der Fileserver abstürzt oder ein Netzwerkproblem zwischen NFS-Server und -Client besteht. Sämtliche Prozesse, die auf Dateien auf so einem Filesystem zugreifen wollen, bleiben einfach hängen. Das gilt auch für Nagios-Plugins. Nach Ablauf des Timeouts wird der Nagios-Kernel den Plugin-Prozess zwar abschiessen, jedoch bleibt dieser in der Prozessliste und zwar so lange, bis der NFS-Server wieder antwortet.<!--more-->{% if site.lang == "de" %} Bei einem check_interval von 5 Minuten können sich so eine Menge hängender Prozesse ansammeln. Es gibt jedoch einen Trick, mit dem ein Nagios-Plugin ein hängendes NFS-Filesystem ermitteln und sich trotzdem sauber beenden kann. Man lässt den kritischen Dateizugriff einfach in einem eigenen Thread laufen, der den aufrufenden Prozess nicht blockiert und der am Ende des Plugins einfach zerstört wird. Nicht nur NFS-Filesysteme können auf diese Weise überwacht werden. Auch beispielsweise bei hierarchischen Filesystemen, bei denen externe Datenträger geladen werden müssen, kann man die Reaktionszeiten messe. Das Plugin trägt den Namen check_fs_ping und wird folgendermassen aufgerufen:
11+
12+
```bash
13+
nagsrv$ /usr/local/nagios/libexec/check_fs_ping --path /storage
14+
CRITICAL - /storage did not respond within 5.05s | /storage=5.045139s;3;4
15+
```
16+
17+
Und hier ist der Source-Code dazu:
18+
19+
```perl
20+
#! /usr/bin/perl
21+
22+
use strict;
23+
use Nagios::Plugin;
24+
use threads;
25+
#use threads::shared;
26+
27+
*Nagios::Plugin::Functions::get_shortname = sub {
28+
return undef; # suppress output of shortname
29+
};
30+
my $plugin = Nagios::Plugin->new(
31+
shortname => '',
32+
usage => 'Usage: %s [ -v|--verbose ] [ -t <timeout> ] '.
33+
'--warning <seconds> --critical <seconds> '.
34+
'--path <path to check> [--path <path to check> ...]'
35+
);
36+
$plugin->add_arg(
37+
spec => 'path|p=s@',
38+
help => '--path=STRING . The path leading to the filesystem in question.',
39+
required => 1,
40+
);
41+
$plugin->add_arg(
42+
spec => 'warning|w=s',
43+
help => ['-w, --warning=INTEGER.',
44+
'Minimum "hang" time until warning. (default is 1s)'],
45+
required => 0,
46+
);
47+
$plugin->add_arg(
48+
spec => 'critical|c=s',
49+
help => ['-c, --critical=INTEGER',
50+
'Minimum "hang" time until critical. (default is 5s)'],
51+
required => 0,
52+
);
53+
54+
$plugin->getopts();
55+
$plugin->set_thresholds(
56+
warning => ($plugin->opts->warning() || 1),
57+
critical => ($plugin->opts->critical() || 5),
58+
);
59+
60+
my $threads = {};
61+
foreach (map { split ',' } @{$plugin->opts->path()}) {
62+
$threads->{$_}->{thread} = threads->create(
63+
sub {
64+
if (-e $_) {
65+
return 1;
66+
} else {
67+
return 0;
68+
}
69+
}
70+
);
71+
}
72+
73+
my $sleep = sub { sleep shift };
74+
my $granularity = 1;
75+
eval {
76+
require Time::HiRes;
77+
import Time::HiRes "sleep";
78+
$sleep = sub { Time::HiRes::sleep(shift) };
79+
$granularity = 0.1;
80+
};
81+
my $elapsed = 0;
82+
my $timeout = $plugin->opts->timeout || 15;
83+
while ($elapsed < $timeout) {
84+
last if ! scalar(keys %{$threads});
85+
foreach (keys %{$threads}) {
86+
if ($threads->{$_}->{thread}->is_joinable()) {
87+
if ($threads->{$_}->{thread}->join()) {
88+
my $level = $plugin->check_threshold($elapsed);
89+
$plugin->add_message($level,
90+
sprintf "%s responded within %.2fs", $_, $elapsed);
91+
} else {
92+
$plugin->add_message(CRITICAL,
93+
sprintf "%s does not exist", $_);
94+
}
95+
$plugin->add_perfdata(
96+
label => $_,
97+
value => $elapsed,
98+
uom => 's',
99+
threshold => $plugin->threshold(),
100+
);
101+
delete $threads->{$_};
102+
} elsif ($threads->{$_}->{thread}->is_running()) {
103+
if ($plugin->check_threshold($elapsed) == 2) {
104+
$threads->{$_}->{thread}->detach();
105+
$plugin->add_message(CRITICAL,
106+
sprintf "%s did not respond within %.2fs",
107+
$_, $elapsed);
108+
$plugin->add_perfdata(
109+
label => $_,
110+
value => $elapsed,
111+
uom => 's',
112+
threshold => $plugin->threshold(),
113+
);
114+
delete $threads->{$_};
115+
}
116+
}
117+
}
118+
$elapsed += &$sleep($granularity);
119+
}
120+
my ($code, $message) = $plugin->check_messages(join_all => ', ');
121+
$plugin->nagios_exit($code, $message);
122+
```
123+
124+
{% else if site.lang == "en" %}
125+
this page is not available in english
126+
{% endif %}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
author: Admin
3+
date: '2009-07-03T17:07:29+00:00'
4+
slug: intro
5+
title: Willkommen bei ConSol Labs|Welcome to ConSol Labs
6+
---
7+
8+
9+
Labs is a technical playing field sponsored by <a href="http://www.consol.de">ConSol</a> where we - the employees - can share our
10+
Open Source <a href="/projects">involvement</a>. We use this site to blog about our area of personal interest, from the daily business at work and from our spare time projects.
11+

0 commit comments

Comments
 (0)