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-118917

skyler's questions

Martin Hope
skyler
Asked: 2020-07-11 12:09:58 +0800 CST

你能帮我理解这个 ElasticSearch 权限错误吗?

  • 1

我正在尝试向 Elastic.co 托管的 ElasticSearch 实例发出请求。我收到此错误:

AuthorizationException(403, 'security_exception', 'action [indices:monitor/stats] is unauthorized for user [my-username]')

这具体告诉我我无法访问的内容是什么?是什么indices:意思,是什么monitor意思monitor/stats?此错误消息试图告诉我什么?

elasticsearch
  • 2 个回答
  • 2176 Views
Martin Hope
skyler
Asked: 2014-04-06 08:49:13 +0800 CST

将管道多行 grep 输出捕获到变量中

  • 1

我正在使用 Zabbix 的zabbix_sender.sh脚本将异常堆栈跟踪推送到我的远程 Zabbix 监控服务器。

zabbix_sender.sh它发送的任何数据都需要一个键和一个值。它可以从 读取数据stdin,但这会覆盖任何指定的键变量。因为我的stdin数据没有像 Zabbix 期望的那样格式化,所以我需要传入“值”作为参数。希望这提供了一些背景信息。

我想要完成的是将多行结果捕获grep到一个变量中,保留换行符,以便我可以zabbix_sender.sh使用该变量作为参数调用脚本。

到目前为止我尝试过的看起来像这样:

tail -Fn0 /var/log/uwsgi.log | grep "Exception:" -A 100 | (read tback; /usr/local/zabbix/bin/zabbix_sender -z myzserver.com -s MyHostName -k uwsgi_traceback -o $tback)

据我所知,这永远不会调用zabbix_sender.sh.

为了测试,我试过使用这个命令,它似乎也不起作用:

tail -Fn0 /var/log/uwsgi.log | grep "Exception:" -A 100 | (read errorlines; echo "$errorlines" > /tmp/errorlines.txt)

永远不会创建该/tmp/errorlines.txt文件。

如何将grep的输出行捕获到变量中,以便我可以使用该变量作为参数调用另一个脚本?

linux
  • 3 个回答
  • 5488 Views
Martin Hope
skyler
Asked: 2013-09-20 06:30:29 +0800 CST

为什么 yum 必须在每个命令上更新其存储库?

  • 2

对我来说,做任何事情yum都慢得令人沮丧。例如,当搜索一个包,找到它,然后尝试安装它时,这两个yum命令似乎运行完全相同的更新,仅相隔几秒钟!

我能做些什么来加快速度?

(oldcfft)~/workspace/panel (live)> yum search bz2
Loaded plugins: fastestmirror, presto
Determining fastest mirrors
epel/metalink                                                                               |  14 kB     00:00
 * base: mirror.5ninesolutions.com
 * epel: mirror.metrocast.net
 * extras: centos.unmeteredvps.net
 * updates: mirrors-pa.sioru.com
10gen                                                                                       |  951 B     00:00
10gen/primary                                                                               |  12 kB     00:00
10gen                                                                                                      105/105
base                                                                                        | 3.7 kB     00:00
base/primary_db                                                                             | 4.4 MB     00:09
epel                                                                                        | 4.2 kB     00:00
epel/primary_db                                                                             | 5.5 MB     00:13
extras                                                                                      | 3.4 kB     00:00
extras/primary_db                                                                           |  18 kB     00:00
nginx                                                                                       | 2.9 kB     00:00
nginx/primary_db                                                                            |  24 kB     00:00
pgdg91                                                                                      | 2.8 kB     00:00
pgdg91/primary_db                                                                           | 123 kB     00:00
pgdg92                                                                                      | 2.8 kB     00:00
pgdg92/primary_db                                                                           | 112 kB     00:00
updates                                                                                     | 3.4 kB     00:00
updates/primary_db                                                                          | 4.4 MB     00:15
epel/pkgtags                                                                                | 588 kB     00:01
======================================================================== N/S Matched: bz2 =========================
bzip2.x86_64 : A file compression utility

  Name and summary matches only, use "search all" for everything.
(oldcfft)~/workspace/panel (live)> sudo yum install -y bzip2
Loaded plugins: fastestmirror, presto
Determining fastest mirrors
epel/metalink                                                                               |  14 kB     00:00
 * base: mirror.es.its.nyu.edu
 * epel: mirror.us.leaseweb.net
 * extras: centos.unmeteredvps.net
 * updates: mirrors-pa.sioru.com
10gen                                                                                       |  951 B     00:00
10gen/primary                                                                               |  12 kB     00:00
10gen                                                                                                      105/105
base                                                                                        | 3.7 kB     00:00
epel                                                                                        | 4.2 kB     00:00
epel/primary_db                                                                             | 5.5 MB     00:15
extras                                                                                      | 3.4 kB     00:00
nginx                                                                                       | 2.9 kB     00:00
nginx/primary_db                                                                            |  24 kB     00:00
pgdg91                                                                                      | 2.8 kB     00:00
pgdg91/primary_db                                                                           | 123 kB     00:00
pgdg92                                                                                      | 2.8 kB     00:00
pgdg92/primary_db                                                                           | 112 kB     00:00
updates                                                                                     | 3.4 kB     00:00
updates/primary_db                                                                          | 4.4 MB     00:10
Setting up Install Process
Package bzip2-1.0.5-7.el6_0.x86_64 already installed and latest version
Nothing to do
centos
  • 2 个回答
  • 1033 Views
Martin Hope
skyler
Asked: 2013-05-21 15:19:11 +0800 CST

允许通过内部接口进行 Nimsoft 连接的 iptables 规则

  • 1

我托管的公司 (Softlayer) 要求我为他们的监控服务打开 48000 到 48020 的端口范围。

在 ifconfig 中,这些是我的接口:

eth0      Link encap:Ethernet  HWaddr 06:3F:74:F6:7F:0C
          inet addr:10.54.12.130
          ...

eth1      Link encap:Ethernet  HWaddr 06:0C:1E:65:0E:A8
          inet addr:50.23.75.242
          ....

这些是我当前的 iptables 规则:

Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination
1    ACCEPT     all  --  anywhere             anywhere
2    REJECT     all  --  anywhere             loopback/8          reject-with icmp-port-unreachable
3    ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
4    ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:http
5    ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:https
6    ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ici
7    REJECT     all  --  anywhere             anywhere            reject-with icmp-port-unreachable

Chain FORWARD (policy ACCEPT)
num  target     prot opt source               destination
1    REJECT     all  --  anywhere             anywhere            reject-with icmp-port-unreachable

Chain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination
1    ACCEPT     all  --  anywhere             anywhere

我试过这个 iptables 命令: iptables -I INPUT 7 -i eth0 -p tcp -s 10.54.12.130 --dport 48000:48020 -j ACCEPT

结果是:

Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination
1    ACCEPT     all  --  anywhere             anywhere
2    REJECT     all  --  anywhere             loopback/8          reject-with icmp-port-unreachable
3    ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
4    ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:http
5    ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:https
6    ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ici
7    ACCEPT     tcp  --  10.54.12.130         anywhere            tcp dpts:nimcontroller:48020
8    REJECT     all  --  anywhere             anywhere            reject-with icmp-port-unreachable

Chain FORWARD (policy ACCEPT)
num  target     prot opt source               destination
1    REJECT     all  --  anywhere             anywhere            reject-with icmp-port-unreachable

Chain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination
1    ACCEPT     all  --  anywhere             anywhere

但是Softlayer提供的Nimsoft-monitor-testing工具显示无法连接。

我究竟做错了什么?

iptables
  • 1 个回答
  • 736 Views
Martin Hope
skyler
Asked: 2013-03-30 11:24:20 +0800 CST

找不到 inn2 的 ckpasswd

  • 1

我正在尝试设置一个 Intranet 新闻服务器 inn2,但我一直在设置用户身份验证。

我的 readers.conf 文件如下所示:

auth all {
    auth: "ckpasswd -d <pathdb in inn.conf>/newsusers"
    auth: "ckpasswd -s"
}

access full {
    users: *
    newsgroups: *
}

我使用从某处获取的名为 dbmpasswd 的 Perl 脚本创建了一个密码数据库。该脚本创建了两个文件,newsusers.pag和newsusers.dir.

在上面的auth all块中,我引用了一个名为的程序,ckpasswd但我无法在我的系统 (CentOS 6.2) 上的任何地方找到这个程序。yum whatprovides什么都不返回,它不在我的路径中。谷歌也没有出现太多。

我想在哪里可以找到ckpasswd更重要的信息——这是为 inn2 设置身份验证的正确方法吗?

linux
  • 2 个回答
  • 266 Views
Martin Hope
skyler
Asked: 2012-08-01 05:07:04 +0800 CST

uWSGI 无法使用 Flask 和 Virtualenv 找到“应用程序”

  • 7

使用 uWSGI 提供一个简单的 wsgi 应用程序(一个简单的“Hello, World”)我的配置有效,但是当我尝试运行 Flask 应用程序时,我在 uWSGI 的错误日志中得到了这个:

current working directory: /opt/python-env/coefficient/lib/python2.6/site-packages
writing pidfile to /var/run/uwsgi.pid
detected binary path: /opt/uwsgi/uwsgi
setuid() to 497
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
uwsgi socket 0 bound to TCP address 127.0.0.1:3031 fd 3
Python version: 2.6.6 (r266:84292, Jun 18 2012, 14:18:47)  [GCC 4.4.6 20110731 (Red Hat 4.4.6-3)]
Set PythonHome to /opt/python-env/coefficient/
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0xbed3b0
your server socket listen backlog is limited to 100 connections
*** Operational MODE: single process ***
added /opt/python-env/coefficient/lib/python2.6/site-packages/ to pythonpath.
unable to find "application" callable in file /var/www/coefficient/flask.py
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***`

特别注意日志的这一部分:

无法在文件 /var/www/coefficient/flask.py 中找到可调用的“应用程序”

无法加载应用程序 0 (mountpoint='')(找不到可调用文件或导入错误)

******没有加载应用程序。进入全动态模式******

这是我的烧瓶应用程序:

from flask import Flask

app = Flask(__name__)

@app.route("/")
def hello():
    return "Hello, World, from Flask!"

在我将我的 Virtualenv 的 pythonpath 添加到我的配置文件之前,我收到了 Flask 的 ImportError。虽然我解决了这个问题,但我相信(我不再收到有关它的错误)这是我完整的配置文件:

uwsgi:
  #socket: /tmp/uwsgi.sock 
  socket: 127.0.0.1:3031
  daemonize: /var/log/uwsgi.log
  pidfile: /var/run/uwsgi.pid
  master: true
  vacuum: true
  #wsgi-file: /var/www/coefficient/coefficient.py
  wsgi-file: /var/www/coefficient/flask.py
  processes: 1
  virtualenv: /opt/python-env/coefficient/
  pythonpath: /opt/python-env/coefficient/lib/python2.6/site-packages

这就是我从 rc 脚本启动 uWSGI 的方式:

/opt/uwsgi/uwsgi --yaml /etc/uwsgi/conf.yaml --uid uwsgi

如果我尝试在浏览器中查看 Flask 程序,我会得到:

**uWSGI Error**

Python application not found

任何帮助表示赞赏。

python
  • 2 个回答
  • 38928 Views
Martin Hope
skyler
Asked: 2012-05-14 17:53:46 +0800 CST

将根位置引用为服务器 {} 块中的变量

  • 13

在我的 nginx server {} 块中,我用路径定义了 root。以后如何引用此路径?

这就是我要实现的目标:

server {
    listen 80;
    root /var/www/foosite;

    ...

    include $root/*.ngaccess;
}

不幸的是,使用 $root 不起作用(因为我还没有定义它)。Nginx 是否提供了访问根值的方法?

nginx
  • 1 个回答
  • 16849 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