Announcement

Collapse

New version of forum

Hi,

As you can see, the forum has been updated.

We took advantage of this migration to change the theme of the forum and to reorganize sections.

These new sections allow better classify subjects discussed. The old topics have been classified in the "Archives" section of the forum and remains accessible.

We reclassified the recent topics (since the 1st of July) in the news sections. To find your topics, please use search menu. We will reclassify active topics from Archives section to the new ones frequently.

Enjoy reading and discussions
See more
See less

Alert when changing !!

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Alert when changing !!

    There is the possibility of Centreon email every time you make a change (Insert, Modify, delete) on any host or service?

    If you can not, someone could help me create it, nor having to change my Centreon?

  • #2
    Hi,

    There si no possibility to send email for notification but you can see modification using "Aministration -> Log".
    You can get this information of changes from Centreon_storage table.
    Centreon Syslog Module Manager/Developper
    Centreon E2S Module Manager/Developper
    Centreon Enterprise Server (2.x / 3.x) : Centreon Engine 1.3.x / 1.4.x, Centreon Broker 2.6.x / 2.8.x , Centreon 2.x, Centreon-Syslog 1.5.x, Centreon E2S 2.0
    Nagios 3.x et NDOutil 1.x

    Comment


    • #3
      [Resolved] - I got a solution !!

      I got it, I made the modification in the file:
      vi /usr/local/centreon/www/class/centreonLogAction.class.php

      Insert the following functions before the function insertLog:
      /*
      * returns the contact name
      */
      function getContactname1($id)
      {
      global $pearDB;

      $DBRESULT = $pearDB->query("SELECT contact_name FROM `contact` WHERE contact_id = '$id' LIMIT 1");
      while ($data = $DBRESULT->fetchRow())
      $name = $data["contact_name"];
      unset($data);
      $DBRESULT->free();
      return $name;
      }


      /*
      * Display clear action labels
      */
      function replaceActiontype1($action)
      {
      $actionList = array();
      $actionList["d"] = "Delete";
      $actionList["c"] = "Change";
      $actionList["a"] = "Create";
      $actionList["disable"] = "Disable";
      $actionList["enable"] = "Enable";
      $actionList["mc"] = "Massive change";

      foreach ($actionList as $key => $value) {
      if ($action == $key)
      $action = $value;
      }
      return $action;
      }

      Insert inside the function insertLog :

      $contactName = $this->getContactname1($this->logUser->user_id);
      $actionTypeEx = $this->replaceActiontype1($action_type);
      $alteracoes = "Nome: ". $object_name . " Tipo: " . $object_type . " Action: " . $actionTypeEx . " Alterado por: " . $contactNamae;

      Insert the following line below the line $ this-> insertFieldsNameValue ($ LogId ["MAX (action_log_id)"], $ fields);:
      system('echo -ne "' . $alteracoes . '" | nail -r seuEmail@XXXX.com -s "Alteração no Centreon ['. $actionTypeEx .'] - ' . $object_name . '" -S smtp=smtp.XXXX.com destino@XXXXX.com');

      You must have nail installed
      !

      Any changes made to Centreon, it will send email to recipients. It was helpful to us because we have many analysts and sometimes we are not aware of the changes made.
      Last edited by Tomassoni; 16th April 2012, 14:31.

      Comment

      Working...
      X