/**
  * Generátor konfigurace NSC++
  *
  * @param IEHost $host
  */
 public function __construct($host)
 {
     $this->host = $host;
     $preferences = new IEPreferences();
     $this->prefs = $preferences->getPrefs();
     $this->cfgInit();
     $this->cfgGeneralSet();
     $this->cfgServices();
     $this->cfgEnding();
 }
 /**
  * Generátor konfigurace NSC++
  *
  * @param IEHost $host
  */
 public function __construct($host)
 {
     $this->host = $host;
     $this->setPlatform($host->getDataValue('platform'));
     $preferences = new IEPreferences();
     $this->prefs = $preferences->getPrefs();
     $this->cfgInit();
     $this->cfgGeneralSet();
     $this->hostActiveMode = (bool) $host->getDataValue('active_checks_enabled');
     if ($this->hostActiveMode) {
         $this->cfgActiveSet();
     }
     $this->hostPassiveMode = (bool) $host->getDataValue('passive_checks_enabled');
     if ($this->hostPassiveMode) {
         $this->cfgPassiveSet();
     }
     $this->cfgModules();
     $this->cfgServices();
     $this->cfgEnding();
 }
示例#3
0
 /**
  * Stav senzoru a jeho nastavení
  *
  * @param IEHost $host
  */
 public function __construct($host)
 {
     $commonWell = new EaseTWBWell();
     $commonRow = new EaseTWBRow();
     $hostColumn = $commonRow->addColumn(6, new EaseHtmlATag('host.php?host_id=' . $host->getId(), new EaseHtmlH1Tag($host->getName())));
     $hostColumn->addItem($host);
     $hostColumn->addItem($host->sensorStatusLabel());
     $commonWell->addItem($commonRow);
     $commonRow->addColumn(4, new EaseTWBPanel(_('Ruční nastavení stavu senzoru'), 'info', new IESensorConfirmForm($host)));
     $sensorTabs = new EaseTWBTabs('sensorTabs');
     switch ($host->getDataValue('platform')) {
         case 'windows':
             $pltIco = 'logos/base/win40.gif';
             $cfgGenerator = new IENSCPConfigGenerator($host);
             if ($host->getCfgValue('active_checks_enabled')) {
                 $windowsActiveTab = $sensorTabs->addTab(_('Windows NRPE'));
                 $windowsActiveTab->addItem(new EaseHtmlH1Tag('<img src="' . $pltIco . '">' . _('aktivní NRPE pro NSC++')));
                 $windowsActiveTab->addItem(new EaseTWBLinkButton('http://www.nsclient.org/download/', ' NSC++ ' . EaseTWBPart::GlyphIcon('download'), 'success', array('style' => "background-image:url('img/nscpp.png'); width: 212px; height: 60px; ", 'title' => 'Download')));
                 $windowsActiveTab->addItem(new EaseTWBLinkButton('host.php?action=populate&host_id=' . $host->getID(), _('Oskenovat a sledovat služby'), null, array('onClick' => "\$('#preload').css('visibility', 'visible');")));
                 $windowsActiveTab->addItem(new EaseTWBLinkButton('nscpcfggen.php?host_id=' . $host->getId(), $host->getName() . '_nscp.bat ' . EaseTWBPart::GlyphIcon('download'), 'success'));
                 $windowsActiveTab->addItem(new EaseTWBContainer('<pre>' . htmlspecialchars($cfgGenerator->getCfg(false)) . '</pre>', array('font-face' => 'fixed')));
             }
             if ($host->getCfgValue('passive_checks_enabled')) {
                 $windowsPassiveTab = $sensorTabs->addTab(_('Windows NSCA'));
                 $windowsPassiveTab->addItem(new EaseHtmlH1Tag('<img src="' . $pltIco . '">' . _('pasivní NSCA pro NSC++')));
                 $windowsPassiveTab->addItem(new EaseTWBLinkButton('http://www.nsclient.org/download/', ' NSC++ ' . EaseTWBPart::GlyphIcon('download'), 'success', array('style' => "background-image:url('img/nscpp.png'); width: 212px; height: 60px; ", 'title' => 'Download')));
                 $windowsPassiveTab->addItem(new EaseTWBLinkButton('nscpcfggen.php?host_id=' . $host->getId(), $host->getName() . '_nscp.bat ' . EaseTWBPart::GlyphIcon('download'), 'success'));
                 $windowsPassiveTab->addItem(new EaseTWBWell('<pre>' . htmlspecialchars($cfgGenerator->getCfg(false), ENT_QUOTES) . '</pre>', array('font-face' => 'fixed')));
             }
             break;
         case 'linux':
             $pltIco = 'logos/base/linux40.gif';
             $preferences = new IEPreferences();
             $prefs = $preferences->getPrefs();
             if ($host->getCfgValue('active_checks_enabled')) {
                 $nrpe_cfgGenerator = new IENRPEConfigGenerator($host);
                 $linuxActiveTab = $sensorTabs->addTab(_('Linux NRPE'));
                 $linuxActiveTab->addItem(new EaseHtmlH1Tag('<img src="' . $pltIco . '">' . _('aktivní NRPE pro NRPE Server')));
                 $linuxActiveTab->addItem(new EaseHtmlPTag(_('Nainstalujte nejprve senzor tímto příkazem') . ':'));
                 $linuxActiveTab->addItem(new EaseHtmlDiv('<pre>sudo aptitude -y install nagios-nrpe-server</pre>', array('class' => 'code')));
                 $linuxActiveTab->addItem(new EaseTWBLinkButton('nrpecfggen.php?host_id=' . $host->getId(), $host->getName() . '_nrpe.sh ' . EaseTWBPart::GlyphIcon('download'), 'success'));
                 $linuxActiveTab->addItem(new EaseTWBContainer('<pre>' . htmlspecialchars($nrpe_cfgGenerator->getCfg(false)) . '</pre>', array('font-face' => 'fixed')));
                 $linuxActiveTab->addItem(new EaseTWBLinkButton('host.php?action=populate&host_id=' . $host->getID(), _('Oskenovat a sledovat služby'), null, array('onClick' => "\$('#preload').css('visibility', 'visible');")));
             }
             if ($host->getCfgValue('passive_checks_enabled')) {
                 $linuxPassiveTab = $sensorTabs->addTab(_('Linux NSCA'));
                 $linuxPassiveTab->addItem(new EaseHtmlH1Tag('<img src="' . $pltIco . '">' . _('pasivní NSCA pro NSCP Senzor')));
                 $linuxPassiveTab->addItem(new EaseTWBLinkButton('nscpcfggen.php?host_id=' . $host->getId(), $host->getName() . '_nscp.sh ' . EaseTWBPart::GlyphIcon('download'), 'success'));
                 $cfgGenerator = new IENSCPConfigGenerator($host);
                 $linuxPassiveTab->addItem(new EaseTWBContainer('<pre>' . htmlspecialchars($cfgGenerator->getCfg(false)) . '</pre>', array('font-face' => 'fixed')));
             }
             break;
         default:
             $pltIco = 'logos/unknown.gif';
             if ($host->getCfgValue('active_checks_enabled')) {
                 $genericActiveTab = $sensorTabs->addTab(_('Generic Active'));
                 $genericActiveTab->addItem(new EaseTWBLinkButton('host.php?action=populate&host_id=' . $host->getID(), _('Oskenovat a sledovat služby'), null, array('onClick' => "\$('#preload').css('visibility', 'visible');")));
             }
             if ($host->getCfgValue('passive_checks_enabled')) {
                 $genericPassiveTab = $sensorTabs->addTab(_('Generic Passive'));
             }
             break;
     }
     parent::__construct($commonWell);
     $this->addItem($sensorTabs);
 }
示例#4
0
 * Icinga Editor - titulní strana
 *
 * @deprecated since version 222
 * @package    IcingaEditor
 * @subpackage WebUI
 * @author     Vitex <*****@*****.**>
 * @copyright  2012 Vitex@hippy.cz (G)
 */
require_once 'includes/IEInit.php';
require_once 'classes/IEHost.php';
require_once 'classes/IECommand.php';
require_once 'classes/IEPreferences.php';
$oPage->onlyForLogged();
$hostId = $oPage->getRequestValue('host_id', 'int');
$host = new IEHost($hostId);
$preferences = new IEPreferences();
$prefs = $preferences->getPrefs();
$nscabat = '
set NSCLIENT="%ProgramFiles%\\NSClient++\\nscp.exe"
%NSCLIENT% service --stop

del "%ProgramFiles%\\NSClient++\\nsclient.ini"
%NSCLIENT% settings --generate --add-defaults --load-all

%NSCLIENT% settings --path "/modules" --key Scheduler --set enabled
%NSCLIENT% settings --path "/modules" --key CheckDisk --set enabled
%NSCLIENT% settings --path "/modules" --key CheckEventLog --set enabled
%NSCLIENT% settings --path "/modules" --key CheckExternalScripts --set enabled
%NSCLIENT% settings --path "/modules" --key CheckHelpers --set enabled
%NSCLIENT% settings --path "/modules" --key CheckNSCP --set enabled
%NSCLIENT% settings --path "/modules" --key CheckSystem --set enabled
示例#5
0
<?php

/**
 * Icinga Editor - nastavení uživatele
 *
 * @package    IcingaEditor
 * @subpackage WebUI
 * @author     Vitex <*****@*****.**>
 * @copyright  2012 Vitex@hippy.cz (G)
 */
require_once 'includes/IEInit.php';
require_once 'classes/IEPreferencesForm.php';
require_once 'classes/IEPreferences.php';
$oPage->onlyForLogged();
$prefs = new IEPreferences();
if ($oPage->isPosted()) {
    //unset($_REQUEST['']);
    if ($prefs->savePrefs($_REQUEST)) {
        $oPage->addStatusMessage(_('Předvolby byly uloženy'), 'success');
    } else {
        $oPage->addStatusMessage(_('Předvolby nebyly uloženy'), 'warning');
    }
}
$oPage->addItem(new IEPageTop(_('Předvolby')));
$oPage->addPageColumns();
$form = new IEPreferencesForm('prefs');
$form->fillUp($prefs->getPrefs());
$oPage->columnII->addItem($form);
$oPage->addItem(new IEPageBottom());
$oPage->draw();