自用Somokeping配置分享备份

九月 21, 2025 / 3ku / 8阅读 / 0评论

#安装见

https://nanodesu.net/archives/69/ ##config

*** General ***
owner    = xxxx
contact  = xxxx
mailhost = xxxx
imgcache = /usr/local/smokeping/cache
imgurl   = cache
datadir  = /usr/local/smokeping/data
piddir   = /usr/local/smokeping/var
cgiurl   = http://localhost/
smokemail = /usr/local/smokeping/etc/smokemail.dist
tmail = /usr/local/smokeping/etc/tmail.dist
syslogfacility = smokeping

*** Alerts ***
to = alertee@address.somewhere
from = smokealert@company.xy
+someloss
type = loss
pattern = >0%,*12*,>0%,*12*,>0%
comment = loss 3 times  in a row

*** Database ***
step     = 60
pings    = 10
AVERAGE  0.5   1  1008
AVERAGE  0.5  12  4320
    MIN  0.5  12  4320
    MAX  0.5  12  4320
AVERAGE  0.5 144   720
    MAX  0.5 144   720
    MIN  0.5 144   720

*** Presentation ***
template = /usr/local/smokeping/etc/basepage.html.dist
charset  = utf-8

+ overview

width = 600
height = 50
range = 10h

+ detail

width = 600
height = 200
unison_tolerance = 2

"Last 3 Hours"    3h
"Last 24 Hours"   24h
"Last 10 Days"    10d
"Last 90 Days"    90d

*** Slaves ***
secrets=/usr/local/smokeping/etc/smokeping_secrets.dist 

+host1
display_name=xxxx
color=2b4f51

+host2
display_name=xxxxx
color=2b4f51

*** Probes ***
+ FPing
binary = /usr/bin/fping

*** Targets ***
probe = FPing
menu = Top
title = xxxx
remark = 监测中 · · ·


+ xxx
menu = xxxx
title = xxx
slaves = host1
nomasterpoll=yes

++ CloudFlare
menu = CloudFlare
title = 1.1.1.1
host = [REDACTED]

++ Akari-JP
menu =至 Akari-JP
title =至 Akari-JP
host = [REDACTED]

++ Akari-SG
menu =至 Akari-SG
title =至 Akari-SG
host = [REDACTED]

++ Akari-TW
menu =至 Akari-TW
title =至 Akari-TW
host = [REDACTED]

++ Akari-US
menu =至 Akari-US
title =至 Akari-US
host = [REDACTED]

+ xxxx
menu = xxxx
title = xxx
slaves = host2
nomasterpoll=yes

++ CloudFlare
menu = CloudFlare
title = 1.1.1.1
host = [REDACTED]

++ SHCM
menu = 上海移动
title = to SHANGHAI CM
host = [REDACTED]

++ SHCT
menu = 上海电信
title = to SHANGHAI CT
host = [REDACTED]

++ SHCU
menu = 上海联通
title = to SHANGHAI CU
host = [REDACTED]

++ GDCM
menu = 广东移动
title = to GUANGDONG CM
host = [REDACTED]

++ GDCT
menu = 广东电信
title = to GUANGDONG CT
host = [REDACTED]

++ GDCU
menu = 广东联通
title = to GUANGDONG CU
host = [REDACTED]

##basepage.html.dist

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta charset="UTF-8">
    <title>Kanata.IM for <##title##></title>
    <link rel="icon" href="https://5pw.net/i/2025/07/27/68859c6fad2ae.ico" type="image/x-icon">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link rel="preconnect" href="https://5pw.net"> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet" media="all" onload="this.media='all'">
    <style>
        /* All CSS from the original file, potentially minified in production */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        :root {
            --primary: #2563eb;
            --primary-hover: #1d4ed8;
            --bg-main: #f8fafc;
            --bg-white: #ffffff;
            --bg-gray: #f1f5f9;
            --text-dark: #0f172a;
            --text-gray: #64748b;
            --text-light: #94a3b8;
            --border: #e2e8f0;
            --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
            --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
        }

        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
            background: var(--bg-main);
            color: var(--text-dark);
            line-height: 1.6;
        }

        /* 顶部导航栏 */
        .top-nav {
            background: var(--bg-white);
            border-bottom: 1px solid var(--border);
            padding: 1rem 1.5rem;
            position: sticky;
            top: 0;
            z-index: 100;
            box-shadow: var(--shadow);
        }

        .nav-content {
            display: flex;
            align-items: center;
            justify-content: space-between;
            max-width: 1400px;
            margin: 0 auto;
        }

        .nav-title {
            font-size: 1.25rem;
            font-weight: 600;
            color: var(--text-dark);
        }

        /* 菜单按钮的新样式 */
        .navbar-menu {
            /* 保持 media query 中的 display: block; */
            background: none;
            border: none; /* 移除边框 */
            padding: 0; /* 移除内边距 */
            cursor: pointer;
            display: flex; /* 使用 flexbox 布局来居中 span */
            flex-direction: column; /* 垂直堆叠 span */
            justify-content: center; /* 垂直居中 span */
            align-items: center; /* 水平居中 span */
            width: 30px; /* 调整按钮大小 */
            height: 30px; /* 调整按钮大小 */
            transition: all 0.2s;
            margin-left: auto; /* Push to the right */
        }

        .navbar-menu:hover {
            background: var(--bg-gray); /* 鼠标悬停时的背景效果 */
            border-color: transparent; /* 悬停时也无边框 */
        }

        .navbar-menu span {
            display: block;
            width: 24px; /* 稍微宽一点的条 */
            height: 2px;
            background: var(--text-dark);
            margin: 4px 0; /* 条之间的间距 */
            transition: 0.3s;
        }

        .navbar-menu.active span:nth-child(1) {
            transform: rotate(-45deg) translate(-5px, 6px);
        }

        .navbar-menu.active span:nth-child(2) {
            opacity: 0;
        }

        .navbar-menu.active span:nth-child(3) {
            transform: rotate(45deg) translate(-5px, -6px);
        }

        /* 主要布局 */
        .main-layout {
            display: flex;
            max-width: 1400px;
            margin: 0 auto;
            min-height: calc(100vh - 80px);
        }

        /* 侧边栏 */
        .sidebar {
            width: 280px;
            background: var(--bg-white);
            border-right: 1px solid var(--border);
            padding: 2rem 1.5rem;
            overflow-y: auto;
            height: calc(100vh - 80px);
            position: sticky;
            top: 80px;
        }

        /* sidebar-header 和 logo 样式已被删除,保留容器以防未来需要 */
        .sidebar-header {
            text-align: center;
            margin-bottom: 1.5rem;
        }

        .sidebar-menu {
            list-style: none;
        }

        .sidebar-menu li {
            margin-bottom: 0.5rem;
        }

        .sidebar-menu a {
            display: block;
            padding: 0.75rem 1rem;
            color: var(--text-gray);
            text-decoration: none;
            border-radius: 8px;
            transition: all 0.2s;
            font-weight: 500;
        }

        .sidebar-menu a:hover {
            background: var(--bg-gray);
            color: var(--text-dark);
            transform: translateX(4px);
        }

        .sidebar-menu .menuactive .menulinkactive {
            background: var(--text-dark);
            color: white;
            font-weight: 600;
        }

        .sidebar-menu .menuactive .menulinkactive:hover {
            background: var(--text-dark);
            color: white;
        }

        /* 子菜单 */
        .sidebar-menu ul {
            list-style: none;
            margin-top: 0.5rem;
            padding-left: 1rem;
        }

        .sidebar-menu ul a {
            font-size: 0.9rem;
            padding: 0.5rem 0.75rem;
        }

        /* 主内容区 */
        .main-content {
            flex: 1;
            padding: 2rem;
            background: var(--bg-white);
            margin: 1rem;
            border-radius: 12px;
            box-shadow: var(--shadow-lg);
        }

        .content-header h1 {
            font-size: 2.5rem;
            font-weight: 700;
            margin-bottom: 0.5rem;
            color: var(--text-dark);
        }

        .content-header h2 {
            font-size: 1.125rem;
            color: var(--text-gray);
            margin-bottom: 2rem;
            font-weight: 500;
        }

        /* 表格样式 */
        .table-section {
            margin-bottom: 2rem;
        }

        .table-container {
            overflow-x: auto;
            border-radius: 0;
            border: none;
            background: transparent;
        }

        .table-container table {
            width: 100%;
            border-collapse: collapse;
            min-width: 600px;
            background: transparent;
        }

        .table-container th,
        .table-container td {
            padding: 1rem;
            text-align: left;
            border-bottom: 1px solid var(--border);
        }

        .table-container th {
            background: var(--bg-gray);
            font-weight: 600;
            color: var(--text-dark);
            font-size: 0.875rem;
            text-transform: uppercase;
            letter-spacing: 0.05em;
        }

        .table-container tr:hover {
            background: var(--bg-gray);
        }

        .table-container tr:last-child td {
            border-bottom: none;
        }

        /* 页脚 */
        .footer {
            text-align: center;
            padding: 2rem;
            background: var(--bg-white);
            color: var(--text-light);
            font-size: 0.875rem;
            border-top: 1px solid var(--border);
            margin-top: 2rem;
            border-radius: 0 0 12px 12px;
        }

        .footer p {
            margin-bottom: 0.5rem;
        }

        .footer a {
            color: #374151;
            text-decoration: none;
        }

        .footer a:hover {
            color: #1f2937;
        }

        .footer small {
            color: var(--text-light);
        }

        /* 移动端遮罩 */
        .mobile-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.5);
            z-index: 90;
        }

        .mobile-overlay.show {
            display: block;
        }

        /* 响应式设计 */
        @media (max-width: 1024px) {
            .navbar-menu {
                display: flex; /* Always flex on mobile for icon */
            }

            .main-layout {
                position: relative;
            }

            .sidebar {
                position: fixed;
                top: 80px;
                left: -280px;
                z-index: 95;
                height: calc(100vh - 80px);
                box-shadow: var(--shadow-lg);
                transition: left 0.3s ease;
            }

            .sidebar.show {
                left: 0;
            }

            .main-content {
                margin: 1rem;
                width: calc(100% - 2rem);
            }
        }

        @media (max-width: 768px) {
            .top-nav {
                padding: 1rem;
            }

            .nav-title {
                font-size: 1.125rem;
            }

            .main-content {
                padding: 1.5rem;
                margin: 0.5rem;
                width: calc(100% - 1rem);
            }

            .content-header h1 {
                font-size: 2rem;
            }

            .table-container table {
                min-width: 500px;
                font-size: 0.875rem;
            }

            .table-container th,
            .table-container td {
                padding: 0.75rem 0.5rem;
            }
        }

        @media (max-width: 480px) {
            .main-content {
                padding: 1rem;
            }

            .content-header h1 {
                font-size: 1.75rem;
            }

            .table-container table {
                min-width: 400px;
                font-size: 0.8rem;
            }

            .table-container th,
            .table-container td {
                padding: 0.5rem 0.25rem;
            }

            .sidebar {
                width: 260px;
                left: -260px;
            }
        }

        /* 隐藏过滤器 */
        .filter {
            display: none;
        }

        /* 滚动条样式 */
        ::-webkit-scrollbar {
            width: 6px;
            height: 6px;
        }

        ::-webkit-scrollbar-track {
            background: var(--bg-gray);
        }

        ::-webkit-scrollbar-thumb {
            background: var(--border);
            border-radius: 3px;
        }

        ::-webkit-scrollbar-thumb:hover {
            background: var(--text-light);
        }
    </style>
</head>
<body id="body">
    <nav class="top-nav">
        <div class="nav-content">
            <h1 class="nav-title">Kanata.IM for <##title##></h1>
            <div class="navbar-menu" id="menu-button">
                <span></span>
                <span></span>
                <span></span>
            </div>
            <div class="navbar-user"><div class="icon-person"></div></div>
        </div>
    </nav>

    <div class="mobile-overlay" id="overlay"></div>

    <div class="main-layout">
        <aside class="sidebar" id="sidebar">
            <div class="sidebar-header">
                </div>
            <nav class="sidebar-menu">
                <##menu##>
                </nav>
        </aside>

        <main class="main-content">
            <div class="content-header">
                <h1><##title##></h1>
                <h2><##remark##></h2>
            </div>

            <section class="table-section">
                <div class="table-container">
                    <##overview##>
                </div>
            </section>

            <section class="table-section">
                <div class="table-container">
                    <##body##>
                </div>
            </section>

            <footer class="footer">
                <p><small>Running on <##smokeping##> by <##author##></small></p>
                <p><small>Maintained by <a href="mailto:<##contact##>"><##owner##></a></small></p>
            </footer>
        </main>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            const menuBtn = document.getElementById('menu-button');
            const sidebar = document.getElementById('sidebar');
            const overlay = document.getElementById('overlay');
            const body = document.body;

            let isOpen = false;

            function toggleMenu() {
                isOpen = !isOpen;

                if (isOpen) {
                    sidebar.classList.add('show');
                    overlay.classList.add('show');
                    menuBtn.classList.add('active');
                    body.style.overflow = 'hidden';
                } else {
                    sidebar.classList.remove('show');
                    overlay.classList.remove('show');
                    menuBtn.classList.remove('active');
                    body.style.overflow = '';
                }
            }

            function closeMenu() {
                if (isOpen) {
                    isOpen = false;
                    sidebar.classList.remove('show');
                    overlay.classList.remove('show');
                    menuBtn.classList.remove('active');
                    body.style.overflow = '';
                }
            }

            // 菜单按钮点击
            menuBtn.addEventListener('click', toggleMenu);

            // 遮罩点击关闭
            overlay.addEventListener('click', closeMenu);

            // 侧边栏链接点击后关闭菜单
            sidebar.addEventListener('click', function(e) {
                if (e.target.tagName === 'A') {
                    // Using setTimeout to allow the click event to fully propagate before closing
                    setTimeout(closeMenu, 100);
                }
            });

            // 窗口大小改变时关闭菜单
            window.addEventListener('resize', function() {
                if (window.innerWidth > 1024) {
                    closeMenu();
                }
            });

            // ESC键关闭菜单
            document.addEventListener('keydown', function(e) {
                if (e.key === 'Escape') {
                    closeMenu();
                }
            });
        });
    </script>

    <script src="js/prototype.js" type="text/javascript"></script>
    <script src="js/scriptaculous/scriptaculous.js?load=builder,effects,dragdrop" type="text/javascript"></script>
    <script src="js/cropper/cropper.js" type="text/javascript"></script>
    <script src="js/smokeping.js" type="text/javascript"></script>
</body>
</html>

文章作者:3ku

文章链接:http://nanodesu.net/archives/72

版权声明:本博客所有文章除特别声明外,均采用CC BY-NC-SA 4.0 许可协议,转载请注明出处!


评论