vulogov / zas_agent

Zabbix Agent Simulator
GNU General Public License v2.0
43 stars 16 forks source link

No handlers could be found for logger "zas_agent" #5

Open alexanderzobnin opened 7 years ago

alexanderzobnin commented 7 years ago

Hi! I'm trying to run zas-agent in docker container, but get error:

root@6a6bc2d2dd98:/zas/zas_agent# zas_agent.py --start
No handlers could be found for logger "zas_agent"

Seems, it's problem with logging module, but I really don't understand why it causes only in docker.

vulogov commented 7 years ago

Can you attach Dockerfile ? I'll try to check and provide a fix.

All the best, Vladimir

On Jun 9, 2017, at 16:30, Alexander Zobnin notifications@github.com wrote:

Hi! I'm trying to run zas-agent in docker container, but get error:

root@6a6bc2d2dd98:/zas/zas_agent# zas_agent.py --start No handlers could be found for logger "zas_agent" Seems, it's problem with logging module, but I really don't understand why it causes only in docker.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

alexanderzobnin commented 7 years ago

For sure. https://gist.github.com/alexanderzobnin/acc8270832098f3316b6072023db5209

alexanderzobnin commented 7 years ago

Hm, seems, I've found a reason - default user and group is zabbix. And inside a container is always root. So I should specify it explicitly. So I was confused by this unobvious error. Anyway, thanks for your attention!

vulogov commented 7 years ago

I can add parameter like --docker which will take care of this. What do you think ?

On Jun 10, 2017, at 06:15, Alexander Zobnin notifications@github.com wrote:

Hm, seems, I've found a reason - default user and group is zabbix. And inside a container is always root. So I should specify it explicitly. So I was confused by this unobvious error. Anyway, thanks for your attention!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

alexanderzobnin commented 7 years ago

Sounds good. I tested it again and see, that this error still exist. But, seems, agent works. And I don't see this error on my centos 7 server, that's strange.

Docker:

root@99606fda5a38:/zas# zas_agent.py --start --user root --group root
No handlers could be found for logger "zas_agent"
INFO:root:Reading configuration file /etc/zas_scenario.cfg
INFO:root:Listening 0.0.0.0:10050
DEBUG:zas_server:listening

Centos 7:

[root@grafana-zabbix ~]# zas_agent.py --start --port 10600
INFO:root:Reading configuration file /etc/zas_scenario.cfg
INFO:root:Listening 0.0.0.0:10600
DEBUG:zas_server:listening
vulogov commented 7 years ago

Try to specify --log sample: --log=/zas.log

The default location of the logs is /tmp and you may or may not have /tmp in container

alexanderzobnin commented 7 years ago

I have /tmp in container, so --log options doesn't change anything.

vulogov commented 7 years ago

Hmm,

I’m initializing logger, users are in place. Let me see what else is missing.

vulogov commented 7 years ago

The only option I see, is to "reinvent wheel", i.e. to stop using logging module. Will be in the next release.