Closed KarlisSe closed 7 years ago
It seems that I am getting somewhere - use diagnostics;
is the key :)
For my first error:
Use of uninitialized value $name in exists at /usr/local/share/perl/5.14.2/Nagios/Object/Config.pm line 367.
I used solution in #9 after which I used #3. It seems that it all depends on how your nagios config files are configured/structured. If the script encounters an error while reading from cfg files it shows error:
Can't call method "x" without a package or object reference at nagios_reader_to_centreon_clapi.pl line #.
or similar.
By adding use diagnostics
in nagios_reader_to_centreon_clapi.pl
you can see the last step the script was executing before exiting with an error and from there you can start looking at your nagios cfg files for missing attributes or naming problems etc. use diagnostics
gives out quite an output, but most of it is due to missing attributes in cfg files or something with naming or something like that(still troubleshooting).
I got it working by deleting few lines from servicegroups.cfg and most of services.cfg. I restored those files from backup and right now I am troubleshooting what exactly was the problem with those files.
In services.cfg
if you have the same service name for different hosts, you will get error:
Can't call method "register" without a package or object reference at nagios_reader_to_centreon_clapi.pl line 490.
It also applies to service and advanced service names.
When I run
perl nagios_reader_to_centreon_clapi.pl --config /usr/local/nagios/etc/nagios.cfg > /tmp/centreon_clapi_import_commands.txt
I get these 2 errors:I tried writing
Nagios::Object::Config
in front ofregister
method call, which took me a bit further:When I try to provide
Nagios::Object::registered
nothing changes.Do you have any suggestions? If the module Nagios::Object::Config is loaded why
register
is not recognized?