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

Ashish Karpe's questions

Martin Hope
Ashish Karpe
Asked: 2020-01-06 19:46:27 +0800 CST

日志旋转无法正常工作

  • 2

我已经创建了日志轮换,但它似乎对我不起作用,因为它正在创建大量文件,例如“smartfox.log.2020-01-05-07.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1 .1.1"

此外,rotate 3 和 maxsize 100M 也不起作用,因为我看到文件超过 3 天且超过 100M。

如果以下日志轮换没有错误,则应删除 3 天以上的文件并仅保留 100M 日志文件:

admin@ip-172-20-44-75:/etc/logrotate.d$ cat   /etc/logrotate.d/smartfox-qa
/var/log/cog-qa/smartfox-qa/*{

        rotate 3
        copytruncate
        missingok
        notifempty
        delaycompress
        maxsize 100M
        daily
        create 0644 root root
}

admin@ip-172-20-44-75:/var/log/cog-qa/smartfox-qa$ ls -lthr

-rw-r--r-- 1 root root    0 Jan  6 03:18 smartfox.log.2020-01-05-13.1.1.1.1.1.1.1.1.1.1.1.1.1
-rw-r--r-- 1 root root 655M Jan  6 03:18 smartfox.log.2020-01-05-14.1.1.1.1.1.1.1.1.1.1.1.1.1
-rw-r--r-- 1 root root    0 Jan  6 03:18 smartfox.log.2020-01-05-14.1.1.1.1.1.1.1.1.1.1.1.1
-rw-r--r-- 1 root root 656M Jan  6 03:18 smartfox.log.2020-01-05-15.1.1.1.1.1.1.1.1.1.1.1.1
-rw-r--r-- 1 root root    0 Jan  6 03:18 smartfox.log.2020-01-05-15.1.1.1.1.1.1.1.1.1.1.1
-rw-r--r-- 1 root root 653M Jan  6 03:18 smartfox.log.2020-01-05-16.1.1.1.1.1.1.1.1.1.1.1
-rw-r--r-- 1 root root    0 Jan  6 03:18 smartfox.log.2020-01-05-16.1.1.1.1.1.1.1.1.1.1
-rw-r--r-- 1 root root 661M Jan  6 03:18 smartfox.log.2020-01-05-17.1.1.1.1.1.1.1.1.1.1
-rw-r--r-- 1 root root    0 Jan  6 03:18 smartfox.log.2020-01-05-17.1.1.1.1.1.1.1.1.1
-rw-r--r-- 1 root root 660M Jan  6 03:19 smartfox.log.2020-01-05-18.1.1.1.1.1.1.1.1.1
-rw-r--r-- 1 root root    0 Jan  6 03:19 smartfox.log.2020-01-05-18.1.1.1.1.1.1.1.1
-rw-r--r-- 1 root root 665M Jan  6 03:19 smartfox.log.2020-01-05-19.1.1.1.1.1.1.1.1
-rw-r--r-- 1 root root    0 Jan  6 03:19 smartfox.log.2020-01-05-19.1.1.1.1.1.1.1
-rw-r--r-- 1 root root 658M Jan  6 03:19 smartfox.log.2020-01-05-20.1.1.1.1.1.1.1
-rw-r--r-- 1 root root    0 Jan  6 03:19 smartfox.log.2020-01-05-20.1.1.1.1.1.1
-rw-r--r-- 1 root root 675M Jan  6 03:19 smartfox.log.2020-01-05-21.1.1.1.1.1.1
-rw-r--r-- 1 root root    0 Jan  6 03:19 smartfox.log.2020-01-05-21.1.1.1.1.1
-rw-r--r-- 1 root root 656M Jan  6 03:19 smartfox.log.2020-01-05-22.1.1.1.1.1
-rw-r--r-- 1 root root    0 Jan  6 03:20 smartfox.log.2020-01-05-22.1.1.1.1
-rw-r--r-- 1 root root 660M Jan  6 03:20 smartfox.log.2020-01-05-23.1.1.1.1
-rw-r--r-- 1 root root    0 Jan  6 03:20 smartfox.log.2020-01-05-23.1.1.1
-rw-r--r-- 1 root root 649M Jan  6 03:20 smartfox.log.2020-01-06-00.1.1.1
-rw-r--r-- 1 root root    0 Jan  6 03:20 smartfox.log.2020-01-06-00.1.1
-rw-r--r-- 1 root root 662M Jan  6 03:20 smartfox.log.2020-01-06-01.1.1
-rw-r--r-- 1 root root    0 Jan  6 03:20 smartfox.log.2020-01-06-01.1
-rw-r--r-- 1 root root 661M Jan  6 03:20 smartfox.log.2020-01-06-02.1
-rw-r--r-- 1 root root    0 Jan  6 03:20 smartfox.log.2020-01-06-02

请让我知道我错在哪里!

logrotate
  • 1 个回答
  • 554 Views
Martin Hope
Ashish Karpe
Asked: 2017-04-14 03:58:29 +0800 CST

运行 opensuse:13.1 docker image 但它向我展示了 ubuntu

  • 0

我正在运行 opensuse:13.1 docker image 但它在“uname -a”命令中向我显示 ubuntu。只想知道这个问题是 SuSe 的 docker 图像还是我这边的东西。

root@ip-172-31-22-20:~/docker-emr# docker run -it opensuse:13.1                                      bash
bash-4.2# uname -a
Linux 3e52b37a2610 3.13.0-92-generic #139-Ubuntu SMP Tue Jun 28 20:42:26 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
bash-4.2#

甚至尝试使用 Dockerfile :

# cat Dockerfile
FROM opensuse:13.1

#MAINTAINER <your name> "<your email>"

# make sure the repositories are up to date
RUN zypper --non-interactive --gpg-auto-import-keys ref

RUN zypper in -y vim

建造:

root@ip-172-31-22-20:~/docker-opensuse# docker build -t ashishkarpe/my-opensuse:1.0 .
Sending build context to Docker daemon  2.048kB
Step 1/1 : FROM opensuse:13.1
 ---> b8cb6b50a4a2
Successfully built b8cb6b50a4a2

命令:

root@ip-172-31-22-20:~/docker-opensuse# docker run -it ashishkarpe/my-opensuse:1.0 bash
bash-4.2# uname -a
Linux febbf7acc931 3.13.0-92-generic #139-Ubuntu SMP Tue Jun 28 20:42:26 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

参考:https ://news.opensuse.org/2014/08/07/official-docker-containers/

PS:zypper 是否仅在 suse 中可用?

linux
  • 1 个回答
  • 216 Views
Martin Hope
Ashish Karpe
Asked: 2017-03-24 00:30:26 +0800 CST

詹金斯构建错误:没有这样的文件或目录

  • 0

我的问题:当我使用 jenkins 构建时,我收到没有这样的文件的错误。但是那个文件是存在的。

jenkins@ip-172-31-22-20:~/jobs$ ls -lthr /var/lib/jenkins/jobs/github-commit-status-api/builds/43/build.xml
-rw-r--r-- 1 jenkins jenkins 2.5K Mar 23 08:13 /var/lib/jenkins/jobs/github-commit-status-api/builds/43/build.xml
jenkins@ip-172-31-22-20:~/jobs$

我的错误:

 cat: /var/lib/jenkins/jobs/github-commit-status-api/builds/43/build.xml: No such file or directory

我来自 Jenkins 仪表板的构建后操作:

postsuccess()
{
  cat <<EOF
{  
    "state": "success",
    "target_url": "https://github.com/HSarode-Compumatrice/money-1",
    "description": "The build succeeded!",
    "context": "continuous-integration/jenkins"
}
EOF
}
postfailure()
{
  cat <<EOF
{  
    "state": "failure",
    "target_url": "https://github.com/HSarode-Compumatrice/money-1",
    "description": "Build Failure!",
    "context": "continuous-integration/jenkins"
}
EOF
}







echo "$BUILD_NUMBER"
BUILD_STATUS=`sudo cat /var/lib/jenkins/jobs/github-commit-status-api/builds/$BUILD_NUMBER/build.xml | grep -oP '(?<=<result>).*?(?=</result>)'`
echo $BUILD_STATUS 

if [ "$BUILD_STATUS" = "SUCCESS" ]
then
`curl -X POST -H "Authorization: Basic f69a042ad72594792950fecc8ca4539d2fff7b75" -H "Content-Type: application/json" 
-d  "$(postsuccess)" "https://api.github.com/repos/HSarode-Compumatrice/money-1/statuses/$GIT_COMMIT"` 
else
#`curl -X POST -H "Authorization: Basic f69a042ad72594792950fecc8ca4539d2fff7b75" -H "Content-Type: application/json" 
#-d  "$(postfailure)" "https://api.github.com/repos/HSarode-Compumatrice/money-1/statuses/$GIT_COMMIT"` 
echo "In Failed"
fi

詹金斯控制台输出:

Started by user Harshal Sarode
[EnvInject] - Loading node environment variables.
Building on master in workspace /var/lib/jenkins/workspace/github-commit-status-api
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url https://github.com/HSarode-Compumatrice/money-1.git # timeout=10
Fetching upstream changes from https://github.com/HSarode-Compumatrice/money-1.git
 > git --version # timeout=10
using GIT_ASKPASS to set credentials 
 > git fetch --tags --progress https://github.com/HSarode-Compumatrice/money-1.git +refs/heads/*:refs/remotes/origin/*
 > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
 > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision b159d0e0d0f71f3d1e399c877705c9d698cd9e14 (refs/remotes/origin/master)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f b159d0e0d0f71f3d1e399c877705c9d698cd9e14
 > git rev-list b159d0e0d0f71f3d1e399c877705c9d698cd9e14 # timeout=10
[github-commit-status-api] $ /bin/bash -xe /tmp/jenkins5873807540526862643.sh
+ echo 'Before Building!!'
Before Building!!
[PostBuildScript] - Execution post build scripts.
[github-commit-status-api] $ /bin/bash -xe /tmp/jenkins982148387285704643.sh
+ echo 43
43
++ sudo cat /var/lib/jenkins/jobs/github-commit-status-api/builds/43/build.xml
++ grep -oP '(?<=<result>).*?(?=</result>)'
cat: /var/lib/jenkins/jobs/github-commit-status-api/builds/43/build.xml: No such file or directory
+ BUILD_STATUS=
Build step 'Execute a set of scripts' changed build result to FAILURE
Build step 'Execute a set of scripts' marked build as failure
Finished: FAILURE
jenkins
  • 1 个回答
  • 12167 Views
Martin Hope
Ashish Karpe
Asked: 2017-01-10 02:59:07 +0800 CST

码头工人 npm 错误!安装无法读取依赖项

  • 0

尝试 Docker 教程https://prakhar.me/docker-curriculum/#dockerrun 在运行 root@ip-172-31-22-20:~/docker-curriculum# docker build -t ashishkarpe/foodtrucks-web 时出错。

root@ip-172-31-22-20:~/docker-curriculum# docker build -t ashishkarpe/foodtrucks-web .
Sending build context to Docker daemon 5.32 MB
Step 1 : FROM ubuntu:14.04
---> 3f755ca42730
Step 2 : MAINTAINER Prakhar Srivastav [email protected]
---> Using cache
---> ca0cf0254114
Step 3 : RUN apt-get -yqq update
---> Using cache
---> 4952fb95a34d
Step 4 : RUN apt-get -yqq install python-pip python-dev
---> Using cache
---> 73bd849c6164
Step 5 : RUN apt-get -yqq install nodejs npm
---> Using cache
---> c48d602eccda
Step 6 : RUN ln -s /usr/bin/nodejs /usr/bin/node
---> Using cache
---> 221206c99a7f
Step 7 : ADD flask-app /opt/flask-app
---> Using cache
---> 7ddfac0cdf0e
Step 8 : WORKDIR /opt/flask-app
---> Using cache
---> 451217e08677
Step 9 : RUN npm install
---> Running in 547c36e97297

npm ERR! install Couldn't read dependencies
npm ERR! Error: ENOENT, open '/opt/flask-app/package.json'
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]

npm ERR! System Linux 3.13.0-92-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /opt/flask-app
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /opt/flask-app/package.json
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /opt/flask-app/npm-debug.log
npm ERR! not ok code 0

我的 Docker 文件:

# cat Dockerfile
# start from base
FROM ubuntu:14.04
MAINTAINER Prakhar Srivastav <[email protected]>

# install system-wide deps for python and node
RUN apt-get -yqq update
RUN apt-get -yqq install python-pip python-dev
RUN apt-get -yqq install nodejs npm
RUN ln -s /usr/bin/nodejs /usr/bin/node

# copy our application code
ADD flask-app /opt/flask-app
WORKDIR /opt/flask-app

# fetch app specific deps
RUN npm install
RUN npm run build
RUN pip install -r requirements.txt

# expose port
EXPOSE 5000
ubuntu dependencies docker npm
  • 1 个回答
  • 558 Views
Martin Hope
Ashish Karpe
Asked: 2016-10-19 13:18:10 +0800 CST

我可以在启动实例后将 IAM 角色附加到实例吗?

  • 0

得到错误:

root@omp_affiliate_backend ~]# s3cmd get s3://admarvel-noc/all-users/nrpe-plugins.tar.gz .
s3://admarvel-noc/all-users/nrpe-plugins.tar.gz -> ./nrpe-plugins.tar.gz  [1 of 1]
ERROR: S3 error: 403 (Forbidden):

是因为IAM角色吗?由于没有将 iam 角色分配给 omp_affiliate_backend 服务器,因为另一台服务器具有 iam 角色(AmazonS3FullAccess)可以轻松下载该 tar。

如果是,我可以在启动实例后将 Iam 角色附加到实例吗?如果不是,我如何从该存储桶下载?

amazon-s3 amazon-web-services amazon-iam s3cmd
  • 1 个回答
  • 107 Views
Martin Hope
Ashish Karpe
Asked: 2015-08-25 00:28:22 +0800 CST

如何使用 shell 脚本为 VPC 中的所有实例创建排除所有附加卷的 AMI

  • 0

我编写了脚本来从 VP​​C 中查找 instance-id n 创建每个 instance-id 的 AMI:

#!/bin/bash
#Script to Automate AMI backup

echo "----------------------------------\n   `date`   \n----------------------------------"

aws ec2 describe-instances --filters Name=vpc-id,Values=vpc-1c927479 |   awk '{ print $8 }' | sort -n   | grep  "i-" > /tmp/instanceid.txt


echo "Starting the Daily AMI creation: "

#To create AMI from instance-id 

for i in $(cat /tmp/instanceid.txt); do
        echo "Creating AMI for Instance id $i ......."

echo "instance-`date +%d%b%y`-$i" > /tmp/aminame.txt

aws ec2 create-image --instance-id $i --name "`cat /tmp/aminame.txt`" --description "This is created by ami-backup.sh" --no-reboot | grep -ir ami | awk '{print $4}' > /tmp/amiID.txt

echo  "AMI Name is: `cat /tmp/aminame.txt`\n"

echo done 

done

但我想创建 AMI,不包括每个卷的附加卷!

ec2-create-image --block-device-mapping /dev/sdh=none

这将在没有附加卷的情况下创建 ami,但 /dev/sdh 对于每个实例都会有所不同,那么我该如何自动化这部分呢?任何提示!

amazon-web-services
  • 1 个回答
  • 423 Views
Martin Hope
Ashish Karpe
Asked: 2015-08-21 06:21:38 +0800 CST

如何使用命令行在不同 aws 帐户的 s3 存储桶之间传输数据

  • 2

如何使用 s3cmd 在不同 aws 帐户的 s3 存储桶之间传输数据?

command will be like this: s3cmd rsync s3://acc1_bucket/folder/ s3://acc2_bucket/folder --recursive 

但是那么它将如何识别第二个存储桶环境呢?这样做的正确方法是什么?

amazon-web-services
  • 3 个回答
  • 3837 Views
Martin Hope
Ashish Karpe
Asked: 2015-08-19 06:20:33 +0800 CST

ec2 create-image 会备份附加的 ebs 卷吗?

  • 1
$aws ec2 create-image --instance-id xxx --name yyy --description "zzzz" --no-reboot 

这创建了 EC2 实例的 AMI 映像,但没有创建额外附加卷的快照!

那么在创建映像时有什么方法可以备份 EBS 卷?或者我们必须使用单独创建卷快照

$ec2-create-snapshot i-xxxx  
amazon-ec2
  • 1 个回答
  • 661 Views
Martin Hope
Ashish Karpe
Asked: 2015-08-14 03:13:15 +0800 CST

没有为 nrpe 插件的 check_iostat 获得正确的输出

  • 0

我的 iostat 给出以下输出

$ iostat 
Linux 3.13.0-29-generic (Inksedge)  08/13/2015  _x86_64_    (4 CPU)
Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
xvdap1            0.62         0.13         9.01    3282841  226020852
xvdb              0.03         0.00         0.12       7721    2999916
xvdc              0.00         0.00         0.00       1376          0

check_iostat 不适用于设备 xvdap1 !我也试过xvda,xvda1但没用!

# /usr/lib/nagios/plugins/check_iostat -d xvda1 -w 100,100,100 -c 200,200,200
(standard_in) 1: syntax error
(standard_in) 1: syntax error
(standard_in) 1: syntax error
(standard_in) 1: syntax error
(standard_in) 1: syntax error
(standard_in) 1: syntax error
OK - I/O stats tps= MB_read/s= MB_written/s= | 'tps'=; 'MB_read/s'=; 'MB_written/s'=;

那么我应该给设备名称以获得正确的输出?

它适用于 xvdb :

# /usr/lib/nagios/plugins/check_iostat -d xvdb -w 100,100,100 -c 200,200,200
OK - I/O stats tps=0.00 MB_read/s=0.00 MB_written/s=0.00 | 'tps'=0.00; 'MB_read/s'=0.00; 'MB_written/s'=0.00;
nagios
  • 1 个回答
  • 776 Views
Martin Hope
Ashish Karpe
Asked: 2015-08-07 23:01:25 +0800 CST

如何理解 top 命令的输出

  • -2

如何理解顶部的输出,因为平均负载不断增加,但无法理解哪个进程正在占用 cpu,因为进程的 %cpu 利用率最大为 0.7,但平均负载显示高值!那么如何知道瓶颈在哪里呢!

#top 

top - 06:47:14 up 302 days, 21:14,  5 users,  load average: 151.51, 142.09, 116.27
Tasks: 570 total,   1 running, 568 sleeping,   0 stopped,   1 zombie
%Cpu(s):  0.5 us,  0.5 sy,  0.0 ni,  0.0 id, 99.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem:   3838696 total,  3221216 used,   617480 free,    67004 buffers
KiB Swap:        0 total,        0 used,        0 free.   349404 cached Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                           
 7188 mysql     20   0 1794140 266584   1084 S   0.7  6.9 511:44.15 mysqld                                                            
 7591 ubuntu    20   0   23964   2008   1176 R   0.7  0.1   0:08.87 top                                                               
10983 root      20   0  277124  20132   1252 S   0.7  0.5 634:22.01 php                                                               
 3382 root      20   0  282768  22020   1828 S   0.3  0.6 126:43.32 php                                                               
 8570 root      20   0   17872    180      0 S   0.3  0.0 172:52.24 wrapper                                                           
 8572 root      20   0 1958428 479468    304 S   0.3 12.5 538:40.04 java                                                              
11043 root      20   0  277116  20020   1232 S   0.3  0.5 361:08.73 php                                                               
    1 root      20   0   37344   5944    760 S   0.0  0.2  11:53.34 init                                                              
    2 root      20   0       0      0      0 S   0.0  0.0   0:06.09 kthreadd                                                          
    3 root      20   0       0      0      0 S   0.0  0.0   0:18.23 ksoftirqd/0                                                       
    5 root       0 -20       0      0      0 S   0.0  0.0   0:00.00 kworker/0:0H                                                      
    7 root      20   0       0      0      0 S   0.0  0.0  46:22.19 rcu_sched                                                         
    8 root      20   0       0      0      0 S   0.0  0.0  38:55.10 rcuos/0            
cpu-usage
  • 1 个回答
  • 359 Views
Martin Hope
Ashish Karpe
Asked: 2015-08-07 01:25:41 +0800 CST

出现错误:ec2 中的 URL 格式错误

  • 1

我收到错误的 URL 格式错误

ec2-describe-instances instance_id  xxx
Malformed URL: 'ec2.ap-southeast-1.amazonaws.com'

但是,我可以通过命令行访问存储桶:

s3cmd  ls s3://edgeproductionlb-logs
DIR   s3://edgeproductionlb-logs/AWSLogs/

谁能帮我?

amazon-ec2
  • 1 个回答
  • 286 Views
Martin Hope
Ashish Karpe
Asked: 2015-08-04 06:14:21 +0800 CST

sysctl:无法统计 /proc/sys/kernel/exec-shield:没有这样的文件或目录

  • 1

启用 ExecShield 保护 - ExecShield 是用于避免蠕虫和其他问题的安全 Linux 内核补丁。

添加到后

/etc/sysctl 
kernel.exec-shield = 1

收到此错误 sysctl: cannotstat /proc/sys/kernel/exec-shield: No such file or directory

输出 :

root@ashishk:/home/ashish/MyScripts# sysctl -p

sysctl: cannot stat /proc/sys/kernel/exec-shield: No such file or directory

kernel.randomize_va_space = 1

net.ipv4.conf.all.rp_filter = 1

net.ipv4.conf.default.rp_filter = 1

net.ipv4.icmp_echo_ignore_broadcasts = 1

net.ipv4.conf.all.accept_source_route = 0

net.ipv4.conf.default.accept_source_route = 0

net.ipv4.conf.all.send_redirects = 0

net.ipv4.conf.default.send_redirects = 0

net.ipv4.tcp_syncookies = 1

net.ipv4.tcp_max_syn_backlog = 2048

net.ipv4.tcp_synack_retries = 2

net.ipv4.tcp_syn_retries = 5

net.ipv4.conf.all.log_martians = 1

net.ipv4.icmp_ignore_bogus_error_responses = 1

net.ipv4.conf.all.accept_redirects = 0

net.ipv4.conf.default.accept_redirects = 0

net.ipv4.icmp_echo_ignore_all = 1

net.ipv6.conf.all.disable_ipv6 = 1

net.ipv6.conf.default.disable_ipv6 = 1

net.ipv6.conf.lo.disable_ipv6 = 1

我能知道什么是错的吗?

security
  • 1 个回答
  • 18051 Views
Martin Hope
Ashish Karpe
Asked: 2015-07-07 02:04:51 +0800 CST

连接已建立。仍然是 Ubuntu ec2 实例的 ssh 登录问题

  • -1

我无法登录到我的服务器(ec2 实例)。在此之前,我能够登录。没有对服务器或安全组进行任何更改!这个问题来自aws方面吗?是否突然发生有时您无法连接到您的 ec2 实例并需要重新启动,或者这是一个安全漏洞,因为有人可能会篡改我在服务器上的密钥?

ashish@ashishk:~/MyScripts$ ./test.ssh 

OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014

debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to test.ige.com [ipxxxxx] port 22.
debug1: Connection established.
debug1: identity file /home/ashish/Keys/igepune.pem type -1
debug1: identity file /home/ashish/Keys/igepune.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2

我的登录脚本:

ashish@ashishk:~/MyScripts$ cat ./test.ssh 
ssh ubunt@ipxxxxx -v -i ~/Keys/igepune.pem 

输出-vvv:

ashish@ashishk:~/MyScripts$ ./test.ssh 

OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to test.ige.com [ipxxxx] port 22.
debug1: Connection established.
debug3: Incorrect RSA1 identifier
debug3: Could not load "/home/ashish/Keys/igepune.pem" as a RSA1 public key
debug1: identity file /home/ashish/Keys/igepune.pem type -1
debug1: identity file /home/ashish/Keys/igepune.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2

**ashish@ashishk:~/MyScripts$ ll /home/ashish/Keys/igepune.pem**

-r-------- 1 ashish ashish 1679 Apr 21 18:56 /home/ashish/Keys/igepune.pem

我怀疑亚马逊是否会在一段时间后过期 pem 密钥?

ubuntu
  • 3 个回答
  • 1628 Views
Martin Hope
Ashish Karpe
Asked: 2015-06-10 05:56:41 +0800 CST

check_mysql_slavestatus RPE:无法读取输出

  • 2

我在 Ubuntu 上使用来自 nagios 交换 check_mysql_slavestatus 的 Nrpe 插件。

手动工作:

root@Bastion-01:/usr/local/nagios/libexec# ./check_mysql_slavestatus -H Slave-ip -P 3306 -u root -p xxxxx -w 10 -c 20

OK: Slave SQL running: Yes Slave IO running: Yes / master: 172.31.20.9 / slave is 0 seconds behind master | delay=0s

同样,它适用于 Master DB

root@DB-01:/usr/lib/nagios/plugins# ./check_mysql_slavestatus -H Slave-ip  -P 3306 -u root -p xxxxx -w 10 -c 20

OK: Slave SQL running: Yes Slave IO running: Yes / master: 172.31.20.9 / slave is 0 seconds behind master | delay=0s

出现错误

root@Bastion-01:/usr/local/nagios/libexec# ./check_nrpe -H Master-ip -c check_mysql_slavestatus  
NRPE: Unable to read output

在 Nagios 服务器上

在 Command.cfg 中

define command{
        command_name check_mysql_slavestatus
        command_line $USER1$/check_mysql_slavestatus -H $HOSTADDRESS$ -P $ARG1$ -u $ARG2$ -p $ARG3$ -w $ARG4$ -c $ARG5$
}

vim /usr/local/nagios/etc/objects/nagios_DB1.cfg

define service{
        use                             generic-service 
        host_name                       DB-01
        service_description             check_mysql_slavestatus
     check_command check_nrpe!check_mysql_slavestatus!hostname!portnumber!username!passwd!15!50
}

Nagios 上的输出

check_mysql_slavestatus
CRITICAL    06-09-2015 13:51:51 0d 2h 45m 12s   3/3 (No output on stdout) stderr: execvp(/check_nrpe, ...) failed. errno is 2: No such file or directory 

请让我知道我错在哪里

遵循故障排除文档https://assets.nagios.com/downloads/nagiosxi/docs/NRPE-Troubleshooting-and-Common-Solutions.pdf

vim /etc/sudoers

nagios ALL= NOPASSWD: sudo /usr/lib/nagios/plugins/check_mysql_slavestatus
nagios
  • 1 个回答
  • 1725 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