mrlesmithjr / ansible-zabbix

MIT License
2 stars 0 forks source link

Hi, #4

Closed usergoodvery closed 7 years ago

usergoodvery commented 7 years ago

Hi, Unfortunately, I hit so many issues with this role as per below. Still couldnt get it to work... I'll try again later thought I let you know for the time being

environment: ubuntu 6.1

I had to add:

Also, in configure_zabbix_frontend.yml at task "Configuring Zabbix Frontend" you are referencing the wrong file "/etc/apache2/conf-available/zabbix.conf". I had to use "/etc/apache2/conf-available/zabbix-frontend-php.conf". Not sure if it is the right substitution...

Also, task "configuring server web" the expected folder 'web' in '/etc/zabbix/', which wasn't present

Also, your defaults specifiy 'zabbix_server_logfile: /var/log/zabbix/zabbix_server.log' but the server could not create that: zabbix_server [997]: unable to open log file [/var/log/zabbix/zabbix_server.log]: [2] No such file or directory. The directory was there though. Eventually i had to: chmod g+x,g+s zabbix

Also, I had to manual systemctl enable and start, even though you have a handler for that.

Now, some how it starts, only to hit the error below: 6329:20170705:215928.657 Starting Zabbix Server. Zabbix 3.0.4 (revision 61185). 6329:20170705:215928.657 ** Enabled features ** 6329:20170705:215928.657 SNMP monitoring: YES 6329:20170705:215928.657 IPMI monitoring: YES 6329:20170705:215928.657 Web monitoring: YES 6329:20170705:215928.657 VMware monitoring: YES 6329:20170705:215928.657 SMTP authentication: YES 6329:20170705:215928.657 Jabber notifications: YES 6329:20170705:215928.657 Ez Texting notifications: YES 6329:20170705:215928.657 ODBC: YES 6329:20170705:215928.657 SSH2 support: YES 6329:20170705:215928.657 IPv6 support: YES 6329:20170705:215928.657 TLS support: YES 6329:20170705:215928.657 ** 6329:20170705:215928.657 using configuration file: /etc/zabbix/zabbix_server.conf 6329:20170705:215928.660 [Z3005] query failed: [1146] Table 'zabbix.users' doesn't exist [select userid from users limit 1] 6329:20170705:215928.660 cannot use database "zabbix": database is not a Zabbix database

The db is there, but it is empty of tables.

usergoodvery commented 7 years ago

I failed to mention I used: zabbix_version: 3.2 because I could not get 3.0 on ubuntu 6.1 it chocked on the repo setup, but as per the log above it still installed 3.0

mrlesmithjr commented 7 years ago

@usergoodvery Thanks for the info, I will do some testing and figure out where this has for some reason stopped working. What version of Ubuntu are you attempting to install on?

mrlesmithjr commented 7 years ago

@usergoodvery Also did you reference the following info:

I want to ensure I can reproduce your issues so any of that info would be great.

mrlesmithjr commented 7 years ago

@usergoodvery Using Ubuntu 16.04 I just installed without any issues using zabbix_version: 3.0

mrlesmithjr commented 7 years ago

zabbix_version: 3.0

screen shot 2017-07-05 at 8 59 05 am screen shot 2017-07-05 at 9 15 42 am
mrlesmithjr commented 7 years ago

And changed to zabbix_version: 3.2 installed without any issues as well.

screen shot 2017-07-05 at 9 07 39 am screen shot 2017-07-05 at 9 06 24 am
usergoodvery commented 7 years ago

Thanks for following through with this. I am on ubuntu 6.1 and yes I have all the requirements in place, using your roles, which went without a hitch. I just checked and the location of the mysql schema files are under /usr/share/zabbix-server-mysql, which is different from the one you have in your defaults...

usergoodvery commented 7 years ago

there is a good chance it is to do with ubuntu 6.1 because there is no repo specifically for that at zabbix but ubuntu seems ti have one according to https://www.ubuntuupdates.org/package/core/yakkety/universe/base/zabbix

mrlesmithjr commented 7 years ago

What is Ubuntu 6.1? This? :) Or do you mean 16.10?

usergoodvery commented 7 years ago

sorry yes 6.10 :)

usergoodvery commented 7 years ago

sorry one sec mine is yakkety the one you referenced in link is (Edgy Eft) which I never heard of before

mrlesmithjr commented 7 years ago

I figured out what you meant :) You are using 16.10. I am testing right now with that and will also test with 17.04. My guess is that these are not supported from Zabbix repos yet.

mrlesmithjr commented 7 years ago

And there we go!

screen shot 2017-07-05 at 9 31 59 am
usergoodvery commented 7 years ago

yes I remember coming across that... cant remember what I did to get it to keep going... what about the package referenced https://www.ubuntuupdates.org/package/core/yakkety/universe/base/zabbix-server-mysql?

mrlesmithjr commented 7 years ago

Unfortunately, quite a bit of code changes will need to be implemented around this to support Zabbix from the default Ubuntu repos. I will see what I can do here as soon as I have a bit of free time.

usergoodvery commented 7 years ago

yes it is a slightly different setup... I'll just down grade my VPS to 16.04 for now I need to keep going :)

BTW love your work on ansible... easily the best library out there in terms of coverage, simplicity and consistency...

mrlesmithjr commented 7 years ago

Much appreciated @usergoodvery

BTW, I am very close to having a working solution around this. Should have something for you to test here shortly.

mrlesmithjr commented 7 years ago

@usergoodvery Changes are now ready for testing on Ubuntu versions >16.04.

usergoodvery commented 7 years ago

Thanks i gave that a go and the role now runs the entire course; however: 1)It did not enable or start the service 2)it created /var/log/zabbix-server directory, whereas the config sets /var/log/zabbix

After I fixed the above the server started correctly but: 3)I couldn't load 127.0.0.1/zabbix. I could see zabbix-frontend-php.conf -> /etc/apache2/conf-available/zabbix-frontend-php.conf in /etc/apache2/conf-available There was nothing ins sites-enabled, i suspect it doesnt rely on that.

mrlesmithjr commented 7 years ago

@usergoodvery Thanks for the feedback. I will look into this some more.

usergoodvery commented 7 years ago

Hi, I tried the role on a fresh ubuntu 6.04 (instance from vultr.com) and I had to include the following packages: python-pkg-resources python-setuptools

Plus, I had to manualy enable and start the service

Is there a variable that is potentially defaulting to false somewhere that I need to be aware of?

regards,

mrlesmithjr commented 7 years ago

Man that is strange. I can definitely add those packages as pre-reqs but I have yet to see the service not get enabled and started. You are talking about the zabbix-server service right?

Because this task configures zabbix_server:

- name: configure_zabbix_server | configuring zabbix server
  template:
    src: "etc/zabbix/zabbix_server.conf.j2"
    dest: "/etc/zabbix/zabbix_server.conf"
    owner: "root"
    group: "root"
    mode: "o=rw,g=r,o=r"
  become: true
  notify: "restart zabbix-server"

And then triggers the handler:

- name: restart zabbix-server
  service:
    name: "zabbix-server"
    state: "restarted"
    enabled: true
  become: true

Which will restart and ensure that the service is enabled.

mrlesmithjr commented 7 years ago

Just to add, after just spinning up my Vagrant testing environment which is how I always build/test from

RUNNING HANDLER [ansible-apache2 : restart apache2] ****************************
changed: [node0]

RUNNING HANDLER [ansible-mysql : restart mysql] ********************************
changed: [node0]

RUNNING HANDLER [ansible-zabbix : restart zabbix-server] ***********************
changed: [node0]

PLAY [all] *********************************************************************

TASK [Gathering Facts] *********************************************************
ok: [node0]
ok: [node1]

TASK [ansible-zabbix-agent : debian | adding zabbix package] *******************
ok: [node0]
changed: [node1]

TASK [ansible-zabbix-agent : debian | updating apt-cache (If zabbix package added)] ***
skipping: [node0]
changed: [node1]

TASK [ansible-zabbix-agent : debian | installing agent package] ****************
changed: [node0]
changed: [node1]

TASK [ansible-zabbix-agent : configure_zabbix_agent | configuring agent] *******
changed: [node0]
changed: [node1]

RUNNING HANDLER [ansible-zabbix-agent : restart zabbix-agent] ******************
changed: [node0]
changed: [node1]

PLAY RECAP *********************************************************************
node0                      : ok=41   changed=28   unreachable=0    failed=0
node1                      : ok=6    changed=5    unreachable=0    failed=0
vagrant@node0:~$ sudo systemctl status zabbix-server.service
● zabbix-server.service - Zabbix Server
   Loaded: loaded (/lib/systemd/system/zabbix-server.service; disabled; vendor preset: enabled)
   Active: active (running) since Sat 2017-07-08 13:21:26 UTC; 8min ago
 Main PID: 22235 (zabbix_server)
   CGroup: /system.slice/zabbix-server.service
           ├─22235 /usr/sbin/zabbix_server -c /etc/zabbix/zabbix_server.conf
           ├─22238 /usr/sbin/zabbix_server: configuration syncer [synced configuration in 0.004343 sec, idle 60 sec
           ├─22239 /usr/sbin/zabbix_server: db watchdog [synced alerts config in 0.001655 sec, idle 60 sec
           ├─22240 /usr/sbin/zabbix_server: poller #1 [got 0 values in 0.000004 sec, idle 5 sec
           ├─22241 /usr/sbin/zabbix_server: poller #2 [got 0 values in 0.000002 sec, idle 5 sec
           ├─22242 /usr/sbin/zabbix_server: poller #3 [got 0 values in 0.000002 sec, idle 5 sec
           ├─22243 /usr/sbin/zabbix_server: poller #4 [got 0 values in 0.000002 sec, idle 5 sec
           ├─22244 /usr/sbin/zabbix_server: poller #5 [got 0 values in 0.000003 sec, idle 5 sec
           ├─22245 /usr/sbin/zabbix_server: unreachable poller #1 [got 0 values in 0.000002 sec, idle 5 sec
           ├─22246 /usr/sbin/zabbix_server: trapper #1 [processed data in 0.000000 sec, waiting for connection
           ├─22247 /usr/sbin/zabbix_server: trapper #2 [processed data in 0.000000 sec, waiting for connection
           ├─22248 /usr/sbin/zabbix_server: trapper #3 [processed data in 0.000000 sec, waiting for connection
           ├─22249 /usr/sbin/zabbix_server: trapper #4 [processed data in 0.000005 sec, waiting for connection
           ├─22250 /usr/sbin/zabbix_server: trapper #5 [processed data in 0.000000 sec, waiting for connection
           ├─22251 /usr/sbin/zabbix_server: icmp pinger #1 [got 0 values in 0.000004 sec, idle 5 sec
           ├─22252 /usr/sbin/zabbix_server: alerter [sent alerts: 0 success, 0 fail in 0.000683 sec, idle 30 sec
           ├─22253 /usr/sbin/zabbix_server: housekeeper [startup idle for 30 minutes
           ├─22263 /usr/sbin/zabbix_server: timer #1 [processed 0 triggers, 0 events in 0.000013 sec, 0 maintenances in 0.000000 sec, idle 30 sec
           ├─22264 /usr/sbin/zabbix_server: http poller #1 [got 0 values in 0.000368 sec, idle 5 sec
           ├─22265 /usr/sbin/zabbix_server: discoverer #1 [processed 0 rules in 0.000408 sec, idle 60 sec
           ├─22266 /usr/sbin/zabbix_server: history syncer #1 [synced 0 items in 0.000001 sec, idle 1 sec
           ├─22267 /usr/sbin/zabbix_server: history syncer #2 [synced 0 items in 0.000001 sec, idle 1 sec
           ├─22275 /usr/sbin/zabbix_server: history syncer #3 [synced 0 items in 0.000001 sec, idle 1 sec
           ├─22276 /usr/sbin/zabbix_server: history syncer #4 [synced 0 items in 0.000001 sec, idle 1 sec
           ├─22277 /usr/sbin/zabbix_server: escalator #1 [processed 0 escalations in 0.000507 sec, idle 3 sec
           ├─22279 /usr/sbin/zabbix_server: proxy poller #1 [exchanged data with 0 proxies in 0.000004 sec, idle 5 sec
           └─22280 /usr/sbin/zabbix_server: self-monitoring [processed data in 0.000005 sec, idle 1 sec

Jul 08 13:21:26 node0 systemd[1]: Starting Zabbix Server...
Jul 08 13:21:26 node0 systemd[1]: zabbix-server.service: Supervising process 22235 which is not our child. We'll most likely not notice when it exits.
Jul 08 13:21:26 node0 systemd[1]: Started Zabbix Server.
vagrant@node0:~$ sudo systemctl status zabbix-agent.service
● zabbix-agent.service - Zabbix Agent
   Loaded: loaded (/lib/systemd/system/zabbix-agent.service; disabled; vendor preset: enabled)
   Active: active (running) since Sat 2017-07-08 13:21:41 UTC; 8min ago
  Process: 22837 ExecStart=/usr/sbin/zabbix_agentd -c $CONFFILE (code=exited, status=0/SUCCESS)
 Main PID: 22840 (zabbix_agentd)
   CGroup: /system.slice/zabbix-agent.service
           ├─22840 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
           ├─22841 /usr/sbin/zabbix_agentd: collector [idle 1 sec]
           ├─22842 /usr/sbin/zabbix_agentd: listener #1 [waiting for connection
           ├─22843 /usr/sbin/zabbix_agentd: listener #2 [waiting for connection
           ├─22844 /usr/sbin/zabbix_agentd: listener #3 [waiting for connection
           └─22845 /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]

Jul 08 13:21:41 node0 systemd[1]: Starting Zabbix Agent...
Jul 08 13:21:41 node0 systemd[1]: Started Zabbix Agent.
usergoodvery commented 7 years ago

Not sure why it's not enabling/starting the service, as the role did not produce any errors and yes I can see the logic there in the code to do that... In fact, I rerun the role again and I now had to restart apache as well to get to zabbix page... Could be some environmental stuffup... I don't use vagrant unfortunately, so I cannot verify that from my end At the end of the day it is not fatal...

this is what I get: root@ufrsv-monit1:~# systemctl status zabbix-server ● zabbix-server.service - Zabbix Server Loaded: loaded (/lib/systemd/system/zabbix-server.service; disabled; vendor preset: enabled) Active: inactive (dead)

mrlesmithjr commented 7 years ago

That is very strange. I can add a task to ensure both of the services are running to see if that helps.

usergoodvery commented 7 years ago

For sure... happy to test that for you

mrlesmithjr commented 7 years ago

Can you checkout branch issue-#4 and test?

usergoodvery commented 7 years ago

Hi, That worked better, but unfortunately, I had to manually start apache2... I really have no explanation for that. You may want to test the scenario where the variable 'zabbix_manage_groups' is set, because in my case that failed because the the webserver wasn't running and managing groups requires live connection with the webserver and that tripped up the task.

Also, I noticed that under your other role, zabbix-agent, the service wasn't enabled or started (using ubuntu 16.04)

mrlesmithjr commented 7 years ago

Good info again. Hopefully will have something else for you to test here soon. Not sure why your scenario is so unique but nonetheless a good exercise.

usergoodvery commented 7 years ago

I'd not want to be characterized as unique.. I treat all my servers as average 'cattle' :) I just spin up fresh instances off my provider and zero- hand-handle them beyond my ansible based orchestration... all your other roles I used worked fine for me; this zabbix is one of the more complex ones, as it abstracts out ton of sh**... thank you again for undertaking that...

mrlesmithjr commented 7 years ago

Feel free to pull down the latest in branch issue-#4 and test. I will address the zabbix-agent here shortly as well.

mrlesmithjr commented 7 years ago

@usergoodvery We good to go now? Or still having issues?

usergoodvery commented 7 years ago

we are good thanks for your help

mrlesmithjr commented 7 years ago

Awesome, glad everything is working for you now