Closed laoshancun closed 7 years ago
You have to uncomment ZBX_SERVER_HOST and specify server's ip or domain name. For example, you can link zabbix-server to zabbix-agent and set ZBX_SERVER_HOST=127.0.0.1
ok,thanks! :-D
@laoshancun Were you able to get this working? Would you be able to share your compose file as I cannot get this to work. I thought I had it correct but now it is saying that it cannot accept connections from 172.18.0.1.
@arnydo just set ZBX_SERVER_HOST=172.18.0.1
, then zabbix server should be able to connect to the agent container.
Is there any way of resolving the connection throught dns? and avoid
failed to accept an incoming connection: connection from "X.X.X.X" rejected, allowed hosts: "zabbix-server"
Hi @dherykw, did you figure out how to specify DNS for zabbix agent by any chance?
We are having the same issue, agent is failing to accept a connection from zabbix proxy, but DNS is specified in ZBX_SERVER_HOST.
But by some reason, IP is rejected:
2021/11/29 19:34:57.397445 cannot accept incoming connection for peer: 10.81.4.85
UPDATE: Figured it out, DNS name is actually resolving into a different IP, because of k8s.
Hi @relgames we are having the same issue in Kubernetes (EKS), how did you solve this?
@guilhermechgas having the same issue in Openshift and it's driving me crazy. Acoarding to the Zabbix documentation (and our Zabbix agents in our current infa) you should be able to use CIDR adresses with the zabbix host paramater. So you should be able to say:
ZBX_SERVER_HOST=Server.Host, 0.0.0.0/0
And it should accept all connections. But because the Zabbix container uses the ENV variable ZBX_SERVER_HOST
to set both the ZBX_SERVER_HOST
and the ACTIVE_SERVER
it keeps on failing with a invalid server name adres
.
It's honestley driving me crazy. I'm trying to run a Zabbix Proxy in cluster and let that do active checks back to the pod's but because you have to expose the Ports by hostPort
or Service
+ nodePort
the incoming adress is different than the proxy adres. Been 8 hours at this, why does this have to be so hard.
@guilhermechgas Yes, I had to make a service and specify clusterIP: None
:
---
apiVersion: v1
kind: Service
metadata:
name: "k8-agent"
spec:
selector:
app.kubernetes.io/component: zabbix-agent
clusterIP: None
ports:
- name: zabbix-agent
protocol: TCP
port: 10050
targetPort: 10050
For the agent, specified service name as a host name:
containers:
- name: zabbix-agent
image: "{{ .Values.image.repository }}/zabbix-agent2:{{ .Chart.AppVersion }}"
env:
- name: ZBX_HOSTNAME
value: "k8-agent"
- name: ZBX_SERVER_HOST
value: "k8-proxy"
Same for proxy:
---
apiVersion: v1
kind: Service
metadata:
name: "k8-proxy"
spec:
selector:
app.kubernetes.io/component: zabbix-proxy
clusterIP: None
ports:
- name: zabbix
protocol: TCP
port: 10051
targetPort: 10051
And proxy container env vars:
containers:
- name: zabbix-proxy
image: "{{ .Values.image.repository }}/zabbix-proxy-sqlite3:{{ .Chart.AppVersion }}"
env:
- name: ZBX_HOSTNAME
value: "k8-proxy"
- name: ZBX_SERVER_HOST
value: support-z
- name: ZBX_PROXYMODE
value: "0"
In case of clusterIP: None
, Kubernetes will resolve DNS names k8-proxy
and k8-agent
to actual pod IP addresses, so the agent and proxy can connect to each other.
I fixed this eveuantly with the following settings:
- name: ZBX_SERVER_HOST
value: "zabbix-proxy.zabbix-monitoring.svc.cluster.local"
- name: ZBX_PASSIVESERVERS
value: "0.0.0.0/0"
By using the 0.0.0.0/0
adres in the ZBX_PASSIVESERVERS
it allows all IP's to connect
Heyy, I have the same problem.. (I think) I want to run a strings store on my Zabbix agent. And the trigger is directly on Zabbix web.
72103:20240307:144604.200 agent #5 started [active checks #1] 72103:20240307:144604.203 Unable to connect to [.21]:10051 [cannot connect to [[.21]:10051]: [113] No route to host] 72103:20240307:144604.204 Unable to send heartbeat message to [.21]:10051 [cannot connect to [[.21]:10051]: [113] No route to host] 72103:20240307:144604.206 Unable to connect to [.21]:10051 [cannot connect to [[.21]:10051]: [113] No route to host] 72103:20240307:144604.207 Active check configuration update started to fail 72102:20240307:145045.799 failed to accept an incoming connection: connection from ".90" rejected, allowed hosts: "10.129.102.21" 72102:20240307:145344.605 Executing command 'sudo -u lmtest /etc/zabbix/zabbix_shells/start_all_lmxt.ksh'
.90 = This is my old Zabbix server (which I no longer use and I have in no case put its IP address in my new configurations) .21 = This is my new Zabbix server The logs come from my Zabbix agent (.27)
In the last line, we see that he is launching himself. But in fact, it is like "blocked" and cannot launch this and therefore cannot restart my tasks
72102:20240307:145344.605 Executing command 'sudo -u lmtest /etc/zabbix/zabbix_shells/start_all_lmxt.ksh'
If someone has an idea ty
zabbix-agent:log
docker-compose.yml