Skip to content

Instantly share code, notes, and snippets.

@higebu
Last active August 29, 2015 14:09
Show Gist options
  • Save higebu/05b6ba490ae8a2f82c30 to your computer and use it in GitHub Desktop.
Save higebu/05b6ba490ae8a2f82c30 to your computer and use it in GitHub Desktop.
ニフティクラウド上の Debian7 で mackerel-agent の起動に失敗する

原因

  • ニフティクラウド上のサーバはローカルにbindを立てており、それをnameserverとして参照しているが、mackerel-agent(golangのnetパッケージ?)はローカルのbindを参照してくれない。

解決方法

sudo su -
/etc/init.d/bind9 stop
insserv -r bind9
cat <<EOF > /etc/resolv.conf
nameserver 8.8.8.8
EOF
/etc/init.d/mackerel-agent start

環境

  • OS
# cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux 7 (wheezy)"
NAME="Debian GNU/Linux"
VERSION_ID="7"
VERSION="7 (wheezy)"
ID=debian
ANSI_COLOR="1;31"
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support/"
BUG_REPORT_URL="http://bugs.debian.org/"
  • kernel
# uname -a
Linux mirror.vyos-users.jp 3.2.0-4-amd64 #1 SMP Debian 3.2.54-2 x86_64 GNU/Linux
  • cpu
# cat /proc/cpuinfo 
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 45
model name	: Intel(R) Xeon(R) CPU E5-2690 0 @ 2.90GHz
stepping	: 7
microcode	: 0x710
cpu MHz		: 2899.999
cache size	: 20480 KB
fpu		: yes
fpu_exception	: yes
cpuid level	: 13
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss syscall nx rdtscp lm constant_tsc up arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf pni pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes hypervisor lahf_lm ida arat epb pln pts dtherm
bogomips	: 5799.99
clflush size	: 64
cache_alignment	: 64
address sizes	: 40 bits physical, 48 bits virtual
power management:

現象

  • 起動に失敗する
# /etc/init.d/mackerel-agent start
[FAIL] Starting mackerel-agent: failed!
  • mackerel-agent.log
# cat /var/log/mackerel-agent.log 
2014/11/09 13:58:59 INFO main Starting mackerel-agent version:0.12.3, rev:3b74df6
2014/11/09 13:58:59 CRITICAL main Failed to preapre host: Failed to register this host: Post https://mackerel.io/api/v0/hosts: dial tcp: lookup mackerel.io: no DNS servers
  • ping は通る
# ping -c3 mackerel.io
PING mackerel.io (59.106.194.79) 56(84) bytes of data.
64 bytes from 59.106.194.79: icmp_req=1 ttl=52 time=9.53 ms
64 bytes from 59.106.194.79: icmp_req=2 ttl=52 time=9.49 ms
64 bytes from 59.106.194.79: icmp_req=3 ttl=52 time=9.56 ms

--- mackerel.io ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 9.491/9.529/9.566/0.030 ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment