PDA

View Full Version : [Solved] Hosts visibles, Services invisibles


DucLeto
31st December 2008, 16:18
Bonjour

J'ai a nouveau un problème sur ma plateforme Nagios3/centreon2.

J'ai un host avec des services associés.
Dans Nagios, le host et les services sont bien visibles.
Dans Centreon dans l'onglet configuration aussi.
Dans l'onglet Monitoring, le host est visible mais pas les services (je clique bien sur "All Services").
Si je clique sur Grids je vois bien les services associés au host.
Ce symptôme est valable pour tous les hosts.

Une idée, une piste, un espoir ?

DucLeto
2nd January 2009, 12:20
Après quelques essais j'ai identifié le problème de manière précise.
J'ai créé un host de test et un service de test associé (check_host_alive).
Je redémarre Nagios, pas de problème le service s'affiche correctement dans Centreon Monitoring (en cliquant sur all services).
J'ajoute ensuite la valeur suivante dans "Action url" sur le service: /nagios/pnp/index.php?host=$HOSTNAME$&srv=$SERVICEDESC$
Je redémarre Nagios et là dans Centreon Monitoring plus moyen de voir le service...
Cela ressemble fortement à un bug non ?

Nagios 3.0.5.
Centreon 2
Nagvis 1.4rc1
Pnp 0.4.12

ttsig
6th January 2009, 17:01
I apologize for replying in English, but trust me, you would not enjoy my French.

I believe that I am experiencing the same problem as this poster. I installed Centreon 2 with Nagios 3.0.6 (compiled). I had been using NDO for a long time for other tools (NagVis) so that was already working in my setup.

Centreon installed fine and the interface seems to work, I was able to import my nagios config. I can see all Hosts without problems, however, the Services view displays nothing, totally blank.

However, if a service has a problem, that service will display in the services screen, also, if a do a "quick search" it will show the host and it's services. The only failure is that I cannot get a list of all "OK" services.

I was also previously using PNP so many of my host have an "action URL" as well.

Any help would be appreciated as otherwise Centreon 2 seems very impressive.

Thanks,
Tom

ttsig
6th January 2009, 20:32
OK, I've found the code in MakeXML_Ndo_service.php which seems to be the source of the problem. I changed to SELECT statement there to always return NULL for the actual value of "action_url" and sure enough, now my services list correctly.

I suspect this may be a problem with the XML is built from the data. Perhaps the ?, & or $ symbols within the action_url are causing some bad behavior.

I'm still looking, but my PHP skills are not particularly strong. Any hints would be appreciated.

Thanks,
Tom

ttsig
6th January 2009, 22:09
OK, so the problem is that the "&" symbol is invalid in XML elements. Since the "action_url" include this character it's causing a problem. The simple solution here is to wrap the "action_url" in the XML output with CDATA so that the XML interpreter will not be confused by the "&" symbol. This is done in the code in other places as well.

This simple one-liner fixes it for me:

--- MakeXML_Ndo_service.php.orig 2009-01-06 15:02:36.000000000 -0500
+++ MakeXML_Ndo_service.php 2009-01-06 15:02:17.000000000 -0500
@@ -331,7 +331,7 @@
$buffer .= '<ac>'. $ndo["active_checks_enabled"] . '</ac>';
$buffer .= '<eh>'. $ndo["event_handler_enabled"] . '</eh>';
$buffer .= '<is>'. $ndo["is_flapping"] . '</is>';
- $buffer .= '<sa>'. $ndo["action_url"] . '</sa>';
+ $buffer .= '<sa><![CDATA['. $ndo["action_url"] . ']]></sa>';

($ndo["notes_url"]) ? $buffer .= '<snu>'. $ndo["notes_url"] . '</snu>' : $buffer .= '<snu>none</snu>';
($ndo["notes"]) ? $buffer .= '<sn>'. $ndo["notes"] . '</sn>' : $buffer .= '<sn>none</sn>';


In the end I'm sure there are probably other places where this needs to be fixed, but this one line gets my services displaying properly.

Later,
Tom

DucLeto
7th January 2009, 15:35
Thanks you very much, I made the modification and it works.
Good job !
I think Merethis must patch Centreon for this bug.

Now I will work on my graph problem...

Je n'arrive pas à mettre [règlé] dans le titre du post.

DonKiShoot
7th January 2009, 21:31
Thanks you very much, I made the modification and it works.
Good job !
I think Merethis must patch Centreon for this bug.

Now I will work on my graph problem...

Je n'arrive pas à mettre [règlé] dans le titre du post.

+1

PS: Je te le fais ;)