AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-185467

Rovanion's questions

Martin Hope
Rovanion
Asked: 2020-12-16 02:56:05 +0800 CST

如何配置 Prometheus 的 Alertmanager 的日志级别?

  • 2

我已经设置了 Prometheus 的 Alertmanager 来管理来自 Prometheus 的警报。我收到了从 Prometheus 到 Alertmanager 的警报,但故事到此结束。Alertmanager 永远不会将警报发送到我的电子邮件端点。

为了弄清楚警报在 Alertmanager 内部的确切位置结束了它们的旅程,我想将日志级别从 info 转换为 debug,但一直无法弄清楚如何。即使现在找到日志似乎也是一个艰难的问题,它不在/var/log并且journalctl -u alertmanager包含的​​内容太少,以至于可能在某个地方还有另一个日志。

配置 Alertmanager的手册页没有提到调试级别。我查看了提到 log 的源代码,发现该设置应该命名为log.level. 将以下代码段添加到配置 YAML 也无济于事:

log:
  level: debug

因为 Alertmanager 无法启动,无法解析其配置文件。

prometheus
  • 2 个回答
  • 10477 Views
Martin Hope
Rovanion
Asked: 2015-12-06 10:13:02 +0800 CST

具有 ACL 组读取权限的用户拒绝读取权限

  • 1

介绍

Web 应用程序的一个常见场景是它有两个通用文件夹。一种是由应用程序服务器执行的代码,例如 uwsgi,另一种是由 Web 服务器直接交付的静态内容,例如 nginx。

在 Debian 服务器上,Web 服务器的用户帐户是 www-data,而应用程序服务器通常每个应用程序都是唯一的。这意味着在代码文件中可以有如下的acl:

# file: code/main.py
# owner: user
# group: user
user::rwx
group::rwx
group:app-server:rwx
other::---

静态文件可以具有以下 ACL:

# file: static/bootstrap.css
# owner: user
# group: user
user::rwx
group::rwx
group:app-server:rwx
group:www-data:r--
other::---

实际问题

具有这些权限的文件怎么可能:

$ sudo getfacl /srv/domain/django/static_files/bootstrap/css/bootstrap.css
getfacl: Removing leading '/' from absolute path names
# file: srv/domain/django/static_files/bootstrap/css/bootstrap.css
# owner: user
# group: user
user::rwx
group::rwx
group:www-data:r--
group:app-server:rwx
group:user-organization:rwx
mask::rwx
other::---

www-data 不可读:

$ sudo -u www-data cat /srv/domain/django/static_files/bootstrap/css/bootstrap.css
cat: /srv/domain/django/static_files/bootstrap/css/bootstrap.css: Permission denied

当用户 www-data 明确是同名组的成员时:

$ id www-data
uid=33(www-data) gid=33(www-data) groups=33(www-data)

事实上,放弃所有控制权并允许任何人阅读对这种情况没有任何帮助:

$ sudo chmod 774 /srv/domain/django/static_files/bootstrap/css/bootstrap.css
$ sudo getfacl /srv/domain/django/static_files/bootstrap/css/bootstrap.css
getfacl: Removing leading '/' from absolute path names
# file: srv/domain/django/static_files/bootstrap/css/bootstrap.css
# owner: user
# group: user
user::rwx
group::rwx
group:www-data:r--
group:app-server:rwx
group:user-organization:rwx
mask::rwx
other::r--
$ cat /srv/domain/django/static_files/bootstrap/css/bootstrap.css
cat: /srv/domain/django/static_files/bootstrap/css/bootstrap.css: Permission denied

使用 chown 和 chgrp 将文件的所有权和组更改为 www-data 不会改变结果。我对 dmesg、messages 或 auth.log 没有任何兴趣。

所以有些事情正在发生,但我完全没有想法。

file-permissions
  • 1 个回答
  • 1322 Views
Martin Hope
Rovanion
Asked: 2014-11-09 14:36:55 +0800 CST

什么是 status_of_proc,我该如何称呼它?

  • 12

在 Debian 7 (Wheezy) 中 nginx 的初始化脚本中,我阅读了以下摘录:

status)
            status_of_proc -p /var/run/$NAME.pid "$DAEMON" nginx && exit 0 || exit $?
            ;;

此代码运行良好并sudo service nginx status输出[ ok ] nginx is running。然而status_of_proc没有在 bash 中定义,也没有在破折号中定义:

$ type status_of_proc
status_of_proc: not found

虽然如果我在 nginx-script 中插入相同的检查,我会得到以下结果:

status_of_proc is a shell function

并且在初始化文件本身上运行 bash 提供了进一步的解释:

status_of_proc is a function
status_of_proc () 
{ 
    local pidfile daemon name status OPTIND;
    pidfile=;
    OPTIND=1;
    while getopts p: opt; do
        case "$opt" in 
            p)
                pidfile="$OPTARG"
            ;;
        esac;
    done;
    shift $(($OPTIND - 1));
    if [ -n "$pidfile" ]; then
        pidfile="-p $pidfile";
    fi;
    daemon="$1";
    name="$2";
    status="0";
    pidofproc $pidfile $daemon > /dev/null || status="$?";
    if [ "$status" = 0 ]; then
        log_success_msg "$name is running";
        return 0;
    else
        if [ "$status" = 4 ]; then
            log_failure_msg "could not access PID file for $name";
            return $status;
        else
            log_failure_msg "$name is not running";
            return $status;
        fi;
    fi
}

然而,将相同的函数调用插入到我自己制作的初始化脚本中返回该函数未定义。所以它与初始化脚本的特殊性无关。之前在 init 脚本中也没有声明它。在网上我读到它是 LSB 的一部分,但我不知道如何称呼它。有人可以帮我弄清楚如何使用这个奇妙的功能吗?

debian-wheezy
  • 1 个回答
  • 13266 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve