skunkie / glpi_sync

Check_MK extension to synchronize information from GLPI
GNU General Public License v2.0
2 stars 1 forks source link

Internal Server Error: ImportError: No module named defaults #3

Closed emc369 closed 7 years ago

emc369 commented 7 years ago

Hi

I love the idea of glpi_sync and wanted to test your plugin. After I install it, stop the site and start it, I get this error below.

My system: Debian Jessie check-mk-raw-1.4.0.p13 core Icinga With nagios core I have a similar error.

https://pastebin.com/MmzEmhJk

I'm no coder but if you need testing, or I can help some other way, please let me know. Thanks for your help!

Best regards Eduardo

skunkie commented 7 years ago

Hi Eduardo. This pligin is for v1.2.8. I will make a commit for v.1.4.0 this week.

emc369 commented 7 years ago

Hi skunkie, sorry, I didn't realise that. Thank you for your commit. I'll gladly test it!

skunkie commented 7 years ago

Hi Eduardo, Please check this release: https://github.com/skunkie/glpi_sync/releases/tag/v1.2

emc369 commented 7 years ago

Hi skunkie,

Thank you!

I created a new site test2 in omd. Now I get a different error. ImportError: No module named reporting

https://pastebin.com/NKsNFPZQ

Do I need to install some python lib/module?

cheers

skunkie commented 7 years ago

No, you need not. I use the enterprise version and it has a reporting module, so I used some code from it. I'll make a change to get independent of the reporting module.

skunkie commented 7 years ago

Hi Eduardo, Please check again, now it should be OK. I tested the plugin with Check_MK Raw Edition

emc369 commented 7 years ago

Hi skunkie,

Perfect! Thank you! Yes, I could login without any issues.

Somehow I missed something. I filled out user for glpi DB. Save. And then I pressed Sync now. And I get this error. 2017-10-05 13_54_42-check_mk local site test2 - glpi sync

So I check Host Tags and default site has this: 2017-10-05 14_02_05-check_mk local site test2 - host tag groups

I did test connection with mysql -u .... -p -h glpihost and it works from omd.

What do I need to do?

Best regards Eduardo

skunkie commented 7 years ago

Hi Eduardo, The error message shows wrong info. I guess you are my beta tester) I have this plugin in production for a year already, but the tags had been present before the plugin was installed. Let me make some changes, and then please reinstall the plugin.

skunkie commented 7 years ago

Please check now. You should create Host Tag groups os and type, and then add the Tag IDs you have in the plugins config, e.g.: image

emc369 commented 7 years ago

Hi skunkie,

Beta tester, cool! New experience for me ;)

I did create Host Tag Groups os and type with the Tag IDs. Was exactly what was needed.

After that I got error and I could fix it myself: Internal error: libmysqlclient.so.18: cannot open shared object file: No such file or directory For debian apt install libmysqlclient18

And now I can't get farther. It tries to connect to my omd ip instead of the glpi one that is in the settings. 2017-10-05 17_53_02-check_mk local site test2 - glpi sync

cheers

skunkie commented 7 years ago

This is a common mysql message for 'access denied'. The IP address after @ is part of the mysql username. Please see the official documentation for MySQL for granting access.

emc369 commented 7 years ago

Sorry perhaps I was unclear.

My GLPI server has IP 192.168.10.21. My omd server has IP 192.168.10.25.

Now as you see in the access denied, it tries to connect to 192.168.10.25 instead it should connect to 192.168.10.21(GLPI Server). It doesn't use the Field Value 192.168.10.21 from GLPI Server Setting.

Because mysql -u cmk_sync -p -h 192.168.10.21 from omd works just fine.

skunkie commented 7 years ago

Eduardo, could you show how you granted access to the glpi database? Here is an example: GRANT SELECT ON glpidb.* TO 'glpiuser'@'%';

emc369 commented 7 years ago

I think you could be right with the direction. I'll check tomorrow morning, and let you know.

emc369 commented 7 years ago

Hi skunkie,

you were right. I had two mysql users respective privileges. Short it was a mess. The sync has now no issues.

But I don't see my Hosts in wato. What exactly do I need to setup in glpi that it works?

In the GLPI sync settings it mentions: Add new hosts with these states

I tried to put in this in Status in glpi host, but don't know if it's the same as states? 2017-10-06 11_22_59-glpi - computers - 1 But still no sync.

As I want to give something back, I'm writing a little walk through so that others can profit from it too. What is the procedure exactly to do it. I mean with github/git. I forked the project, and I can change the Readme.md file. It asks me if I want to change master or PullRequest with new branch. As you see I'm quite new to github. If you know a howto or manual that would be good to.

skunkie commented 7 years ago

Hi Eduardo,

I guess this is specific to my environment and it can be different in yours, but I have such states as 'PROD', 'UAT' and 'DEV' in GLPI and only computers with these states are queried by the plugin. You can change it in the sql query if you like, if it more suitable. As for github, its documentation is great, please refer to it.