Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Problème dans le fichier centreon-poller-display-sync.php #3

Open
jben94 opened this issue Sep 27, 2016 · 0 comments
Open

Problème dans le fichier centreon-poller-display-sync.php #3

jben94 opened this issue Sep 27, 2016 · 0 comments

Comments

@jben94
Copy link

jben94 commented Sep 27, 2016

Bonjour,

J'ai rencontré un problème lié à la partie configuration de centreon-engine (Ligne 68).
J'ai une insertion à chaque passage du script. Je pense qu'il manque une condition.

while ($row = $DBRESULT->fetchRow()) {
    $request = "INSERT INTO nagios_server (id, name, localhost, ns_activate, ns_status, ns_ip_address) VALUES ('".$row['instance_id']."', '".$row["name"]."', '1', 1, 1, '127.0.0.1')";
    $DB->query($request);

    $request = "INSERT INTO cfg_nagios (nagios_name, nagios_server_id, interval_length, nagios_activate, command_file) VALUES ('Main file for ".$row["name"]."', '".$row["instance_id"]."', 60, '1', '/var/lib/centreon-engine/rw/centengine.cmd')";
    $DB->query($request);
}

Voici ma modification:

while ($row = $DBRESULT->fetchRow()) {
    $request = "INSERT INTO nagios_server (id, name, localhost, ns_activate, ns_status, ns_ip_address) VALUES ('".$row['instance_id']."', '".$row["name"]."', '1', 1, 1, '127.0.0.1')";
    $DB->query($request);

  $request = "SELECT * FROM cfg_nagios WHERE nagios_server_id='".$row["instance_id"]."' LIMIT 1";
  $DBRESULT2 = $DB->query($request);
  if ($DBRESULT2->numRows()>0){
      $request = "UPDATE cfg_nagios SET interval_length='60', nagios_activate='1', command_file='/var/lib/centreon-engine/rw/centengine.cmd' WHERE nagios_server_id='".$row["instance_id"]."'";
  }else{
      $request = "INSERT INTO cfg_nagios (nagios_name, nagios_server_id, interval_length, nagios_activate, command_file) VALUES ('Main file for ".$row["name"]."', '".$row["instance_id"]."', 60, '1', '/var/lib/centreon-engine/rw/centengine.cmd')";
  }
  $DB->query($request);
}
@jben94 jben94 mentioned this issue Dec 7, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant