mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 07:19:18 +01:00
Merge pull request #3255 from xenserver/feature/nrpe
Merge branch feature/nrpe to master
This commit is contained in:
commit
f92e988866
7
XenAdmin/Dialogs/GraphDetailsDialog.Designer.cs
generated
7
XenAdmin/Dialogs/GraphDetailsDialog.Designer.cs
generated
@ -96,9 +96,8 @@
|
||||
//
|
||||
this.dataGridView.AllowUserToAddRows = false;
|
||||
this.dataGridView.AllowUserToDeleteRows = false;
|
||||
this.dataGridView.AllowUserToResizeColumns = false;
|
||||
this.dataGridView.AllowUserToResizeRows = false;
|
||||
this.dataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
|
||||
this.dataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
|
||||
this.dataGridView.BackgroundColor = System.Drawing.SystemColors.Window;
|
||||
this.dataGridView.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.dataGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None;
|
||||
@ -237,6 +236,7 @@
|
||||
//
|
||||
// ColumnDisplayOnGraph
|
||||
//
|
||||
this.ColumnDisplayOnGraph.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
|
||||
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
|
||||
dataGridViewCellStyle1.NullValue = false;
|
||||
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Window;
|
||||
@ -250,14 +250,12 @@
|
||||
//
|
||||
// ColumnName
|
||||
//
|
||||
this.ColumnName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
resources.ApplyResources(this.ColumnName, "ColumnName");
|
||||
this.ColumnName.Name = "ColumnName";
|
||||
this.ColumnName.ReadOnly = true;
|
||||
//
|
||||
// Description
|
||||
//
|
||||
this.Description.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
resources.ApplyResources(this.Description, "Description");
|
||||
this.Description.Name = "Description";
|
||||
this.Description.ReadOnly = true;
|
||||
@ -271,6 +269,7 @@
|
||||
//
|
||||
// ColumnEnabled
|
||||
//
|
||||
this.ColumnEnabled.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells;
|
||||
resources.ApplyResources(this.ColumnEnabled, "ColumnEnabled");
|
||||
this.ColumnEnabled.Name = "ColumnEnabled";
|
||||
this.ColumnEnabled.ReadOnly = true;
|
||||
|
@ -82,6 +82,7 @@ namespace XenAdmin.Dialogs
|
||||
private ClusteringEditPage ClusteringEditPage;
|
||||
private SrReadCachingEditPage SrReadCachingEditPage;
|
||||
private PoolAdvancedEditPage _poolAdvancedEditPage;
|
||||
private NRPEEditPage NRPEEditPage;
|
||||
#endregion
|
||||
|
||||
private readonly IXenObject _xenObjectBefore, _xenObjectCopy;
|
||||
@ -317,6 +318,12 @@ namespace XenAdmin.Dialogs
|
||||
dialog.ShowDialog(Program.MainWindow);
|
||||
}
|
||||
}
|
||||
if (isPoolOrStandalone && Helpers.XapiEqualOrGreater_23_27_0(connection)
|
||||
&& (connection.Session.IsLocalSuperuser || connection.Session.Roles.Any(r => r.name_label == Role.MR_ROLE_POOL_ADMIN)))
|
||||
{
|
||||
NRPEEditPage = new NRPEEditPage();
|
||||
ShowTab(NRPEEditPage);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
213
XenAdmin/SettingsPanels/NRPEEditPage.CheckGroup.cs
Normal file
213
XenAdmin/SettingsPanels/NRPEEditPage.CheckGroup.cs
Normal file
@ -0,0 +1,213 @@
|
||||
/* Copyright (c) Cloud Software Group, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace XenAdmin.SettingsPanels
|
||||
{
|
||||
public partial class NRPEEditPage
|
||||
{
|
||||
public class CheckGroup
|
||||
{
|
||||
private const decimal THRESHOLD_MINIMUM = 0.01M;
|
||||
private const decimal THRESHOLD_MAXIMUM = 100M;
|
||||
|
||||
public string Name { get; }
|
||||
|
||||
public DataGridViewRow CheckThresholdRow { get; }
|
||||
|
||||
public DataGridViewTextBoxCell NameCell { get; }
|
||||
|
||||
public DataGridViewTextBoxCell WarningThresholdCell { get; }
|
||||
|
||||
public DataGridViewTextBoxCell CriticalThresholdCell { get; }
|
||||
|
||||
public CheckGroup(string name, string labelName)
|
||||
{
|
||||
Name = name;
|
||||
NameCell = new DataGridViewTextBoxCell { Value = labelName, ToolTipText = string.Format(Messages.NRPE_METRIC_TOOLTIP, name) };
|
||||
WarningThresholdCell = new DataGridViewTextBoxCell { Value = "" };
|
||||
CriticalThresholdCell = new DataGridViewTextBoxCell { Value = "" };
|
||||
CheckThresholdRow = new DataGridViewRow();
|
||||
CheckThresholdRow.Cells.AddRange(NameCell, WarningThresholdCell, CriticalThresholdCell);
|
||||
CheckThresholdRow.DefaultCellStyle.Format = "N2";
|
||||
CheckThresholdRow.DefaultCellStyle.NullValue = 0;
|
||||
WarningThresholdCell.Style.ForeColor = Color.FromKnownColor(KnownColor.ControlDark);
|
||||
CriticalThresholdCell.Style.ForeColor = Color.FromKnownColor(KnownColor.ControlDark);
|
||||
}
|
||||
|
||||
public void UpdateThreshold(string warningThreshold, string criticalThreshold)
|
||||
{
|
||||
WarningThresholdCell.Value = warningThreshold;
|
||||
CriticalThresholdCell.Value = criticalThreshold;
|
||||
WarningThresholdCell.Style.ForeColor = Color.FromKnownColor(KnownColor.ControlText);
|
||||
CriticalThresholdCell.Style.ForeColor = Color.FromKnownColor(KnownColor.ControlText);
|
||||
}
|
||||
|
||||
public virtual bool CheckValue()
|
||||
{
|
||||
WarningThresholdCell.ErrorText = "";
|
||||
CriticalThresholdCell.ErrorText = "";
|
||||
|
||||
return CheckEachValue(WarningThresholdCell) &&
|
||||
CheckEachValue(CriticalThresholdCell) &&
|
||||
CompareWarningAndCritical();
|
||||
}
|
||||
|
||||
protected virtual bool CheckEachValue(DataGridViewTextBoxCell cell)
|
||||
{
|
||||
string thresholdStr = cell.Value.ToString().Trim();
|
||||
if (thresholdStr.Equals(""))
|
||||
{
|
||||
cell.ErrorText = string.Format(Messages.NRPE_THRESHOLD_SHOULD_NOT_BE_EMPTY);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!decimal.TryParse(thresholdStr, out decimal threshold))
|
||||
{
|
||||
cell.ErrorText = string.Format(Messages.NRPE_THRESHOLD_SHOULD_BE_NUMBER);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (threshold < THRESHOLD_MINIMUM || threshold > THRESHOLD_MAXIMUM)
|
||||
{
|
||||
cell.ErrorText = string.Format(Messages.NRPE_THRESHOLD_RANGE_ERROR, THRESHOLD_MINIMUM,
|
||||
THRESHOLD_MAXIMUM);
|
||||
return false;
|
||||
}
|
||||
|
||||
cell.ErrorText = "";
|
||||
return true;
|
||||
}
|
||||
|
||||
protected virtual bool CompareWarningAndCritical()
|
||||
{
|
||||
decimal.TryParse(WarningThresholdCell.Value.ToString().Trim(), out decimal warningDecimal);
|
||||
decimal.TryParse(CriticalThresholdCell.Value.ToString().Trim(), out decimal criticalDecimal);
|
||||
if (warningDecimal < criticalDecimal)
|
||||
{
|
||||
WarningThresholdCell.ErrorText = "";
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
WarningThresholdCell.ErrorText =
|
||||
string.Format(Messages.NRPE_THRESHOLD_WARNING_SHOULD_LESS_THAN_CRITICAL);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class FreeCheckGroup : CheckGroup
|
||||
{
|
||||
public FreeCheckGroup(string name, string labelName)
|
||||
: base(name, labelName)
|
||||
{
|
||||
}
|
||||
|
||||
protected override bool CompareWarningAndCritical()
|
||||
{
|
||||
decimal.TryParse(WarningThresholdCell.Value.ToString().Trim(), out decimal warningDecimal);
|
||||
decimal.TryParse(CriticalThresholdCell.Value.ToString().Trim(), out decimal criticalDecimal);
|
||||
if (warningDecimal > criticalDecimal)
|
||||
{
|
||||
WarningThresholdCell.ErrorText = "";
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
WarningThresholdCell.ErrorText =
|
||||
string.Format(Messages.NRPE_THRESHOLD_WARNING_SHOULD_BIGGER_THAN_CRITICAL);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class HostLoadCheckGroup : CheckGroup
|
||||
{
|
||||
public HostLoadCheckGroup(string name, string labelName)
|
||||
: base(name, labelName)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class Dom0LoadCheckGroup : CheckGroup
|
||||
{
|
||||
public Dom0LoadCheckGroup(string name, string labelName)
|
||||
: base(name, labelName)
|
||||
{
|
||||
}
|
||||
|
||||
protected override bool CompareWarningAndCritical()
|
||||
{
|
||||
string[] warningArray = WarningThresholdCell.Value.ToString().Split(',');
|
||||
string[] criticalArray = CriticalThresholdCell.Value.ToString().Split(',');
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
decimal.TryParse(warningArray[i].Trim(), out decimal warningDecimal);
|
||||
decimal.TryParse(criticalArray[i].Trim(), out decimal criticalDecimal);
|
||||
if (warningDecimal > criticalDecimal)
|
||||
{
|
||||
WarningThresholdCell.ErrorText =
|
||||
string.Format(Messages.NRPE_THRESHOLD_WARNING_SHOULD_LESS_THAN_CRITICAL);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
WarningThresholdCell.ErrorText = "";
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool CheckEachValue(DataGridViewTextBoxCell cell)
|
||||
{
|
||||
cell.ErrorText = string.Format(Messages.NRPE_THRESHOLD_SHOULD_BE_3_NUMBERS);
|
||||
string[] loadArray = cell.Value.ToString().Split(',');
|
||||
if (loadArray.Length != 3)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (string load in loadArray)
|
||||
{
|
||||
bool isDecimal = decimal.TryParse(load, out _);
|
||||
if (!isDecimal)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
cell.ErrorText = "";
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
218
XenAdmin/SettingsPanels/NRPEEditPage.Designer.cs
generated
Normal file
218
XenAdmin/SettingsPanels/NRPEEditPage.Designer.cs
generated
Normal file
@ -0,0 +1,218 @@
|
||||
namespace XenAdmin.SettingsPanels
|
||||
{
|
||||
partial class NRPEEditPage
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(NRPEEditPage));
|
||||
this.NRPETableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.DescLabelPool = new XenAdmin.Controls.Common.AutoHeightLabel();
|
||||
this.DescLabelHost = new XenAdmin.Controls.Common.AutoHeightLabel();
|
||||
this.EnableNRPECheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.GeneralConfigureGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.GeneralConfigTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.AllowHostsLabel = new System.Windows.Forms.Label();
|
||||
this.AllowHostsTextBox = new System.Windows.Forms.TextBox();
|
||||
this.DebugLogCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.SslDebugLogCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.CheckDataGridView = new XenAdmin.Controls.DataGridViewEx.DataGridViewEx();
|
||||
this.CheckColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.WarningThresholdColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.CriticalThresholdColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.RetrieveNRPEPanel = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.RetrieveNRPELabel = new System.Windows.Forms.Label();
|
||||
this.RetrieveNRPEPicture = new System.Windows.Forms.PictureBox();
|
||||
this.NRPETableLayoutPanel.SuspendLayout();
|
||||
this.GeneralConfigureGroupBox.SuspendLayout();
|
||||
this.GeneralConfigTableLayoutPanel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.CheckDataGridView)).BeginInit();
|
||||
this.RetrieveNRPEPanel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.RetrieveNRPEPicture)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// NRPETableLayoutPanel
|
||||
//
|
||||
resources.ApplyResources(this.NRPETableLayoutPanel, "NRPETableLayoutPanel");
|
||||
this.NRPETableLayoutPanel.Controls.Add(this.DescLabelPool, 0, 0);
|
||||
this.NRPETableLayoutPanel.Controls.Add(this.DescLabelHost, 0, 1);
|
||||
this.NRPETableLayoutPanel.Controls.Add(this.EnableNRPECheckBox, 0, 3);
|
||||
this.NRPETableLayoutPanel.Controls.Add(this.GeneralConfigureGroupBox, 0, 4);
|
||||
this.NRPETableLayoutPanel.Controls.Add(this.CheckDataGridView, 0, 5);
|
||||
this.NRPETableLayoutPanel.Controls.Add(this.RetrieveNRPEPanel, 0, 6);
|
||||
this.NRPETableLayoutPanel.Name = "NRPETableLayoutPanel";
|
||||
//
|
||||
// DescLabelPool
|
||||
//
|
||||
resources.ApplyResources(this.DescLabelPool, "DescLabelPool");
|
||||
this.DescLabelPool.Name = "DescLabelPool";
|
||||
//
|
||||
// DescLabelHost
|
||||
//
|
||||
resources.ApplyResources(this.DescLabelHost, "DescLabelHost");
|
||||
this.DescLabelHost.Name = "DescLabelHost";
|
||||
//
|
||||
// EnableNRPECheckBox
|
||||
//
|
||||
resources.ApplyResources(this.EnableNRPECheckBox, "EnableNRPECheckBox");
|
||||
this.EnableNRPECheckBox.Name = "EnableNRPECheckBox";
|
||||
this.EnableNRPECheckBox.UseVisualStyleBackColor = true;
|
||||
this.EnableNRPECheckBox.CheckedChanged += new System.EventHandler(this.EnableNRPECheckBox_CheckedChanged);
|
||||
//
|
||||
// GeneralConfigureGroupBox
|
||||
//
|
||||
this.GeneralConfigureGroupBox.Controls.Add(this.GeneralConfigTableLayoutPanel);
|
||||
resources.ApplyResources(this.GeneralConfigureGroupBox, "GeneralConfigureGroupBox");
|
||||
this.GeneralConfigureGroupBox.Name = "GeneralConfigureGroupBox";
|
||||
this.GeneralConfigureGroupBox.TabStop = false;
|
||||
//
|
||||
// GeneralConfigTableLayoutPanel
|
||||
//
|
||||
resources.ApplyResources(this.GeneralConfigTableLayoutPanel, "GeneralConfigTableLayoutPanel");
|
||||
this.GeneralConfigTableLayoutPanel.Controls.Add(this.AllowHostsLabel, 0, 0);
|
||||
this.GeneralConfigTableLayoutPanel.Controls.Add(this.AllowHostsTextBox, 1, 0);
|
||||
this.GeneralConfigTableLayoutPanel.Controls.Add(this.DebugLogCheckBox, 0, 1);
|
||||
this.GeneralConfigTableLayoutPanel.Controls.Add(this.SslDebugLogCheckBox, 0, 2);
|
||||
this.GeneralConfigTableLayoutPanel.Name = "GeneralConfigTableLayoutPanel";
|
||||
//
|
||||
// AllowHostsLabel
|
||||
//
|
||||
resources.ApplyResources(this.AllowHostsLabel, "AllowHostsLabel");
|
||||
this.AllowHostsLabel.Name = "AllowHostsLabel";
|
||||
//
|
||||
// AllowHostsTextBox
|
||||
//
|
||||
resources.ApplyResources(this.AllowHostsTextBox, "AllowHostsTextBox");
|
||||
this.AllowHostsTextBox.Name = "AllowHostsTextBox";
|
||||
//
|
||||
// DebugLogCheckBox
|
||||
//
|
||||
resources.ApplyResources(this.DebugLogCheckBox, "DebugLogCheckBox");
|
||||
this.GeneralConfigTableLayoutPanel.SetColumnSpan(this.DebugLogCheckBox, 2);
|
||||
this.DebugLogCheckBox.Name = "DebugLogCheckBox";
|
||||
this.DebugLogCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// SslDebugLogCheckBox
|
||||
//
|
||||
resources.ApplyResources(this.SslDebugLogCheckBox, "SslDebugLogCheckBox");
|
||||
this.GeneralConfigTableLayoutPanel.SetColumnSpan(this.SslDebugLogCheckBox, 2);
|
||||
this.SslDebugLogCheckBox.Name = "SslDebugLogCheckBox";
|
||||
this.SslDebugLogCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// CheckDataGridView
|
||||
//
|
||||
this.CheckDataGridView.BackgroundColor = System.Drawing.SystemColors.Window;
|
||||
this.CheckDataGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None;
|
||||
this.CheckDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
|
||||
this.CheckDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.CheckColumn,
|
||||
this.WarningThresholdColumn,
|
||||
this.CriticalThresholdColumn});
|
||||
resources.ApplyResources(this.CheckDataGridView, "CheckDataGridView");
|
||||
this.CheckDataGridView.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter;
|
||||
this.CheckDataGridView.Name = "CheckDataGridView";
|
||||
this.CheckDataGridView.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
|
||||
this.CheckDataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect;
|
||||
this.CheckDataGridView.ShowCellErrors = true;
|
||||
this.CheckDataGridView.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.CheckDataGridView_EndEdit);
|
||||
//
|
||||
// CheckColumn
|
||||
//
|
||||
this.CheckColumn.FillWeight = 40F;
|
||||
resources.ApplyResources(this.CheckColumn, "CheckColumn");
|
||||
this.CheckColumn.Name = "CheckColumn";
|
||||
this.CheckColumn.ReadOnly = true;
|
||||
//
|
||||
// WarningThresholdColumn
|
||||
//
|
||||
this.WarningThresholdColumn.FillWeight = 30F;
|
||||
resources.ApplyResources(this.WarningThresholdColumn, "WarningThresholdColumn");
|
||||
this.WarningThresholdColumn.Name = "WarningThresholdColumn";
|
||||
//
|
||||
// CriticalThresholdColumn
|
||||
//
|
||||
this.CriticalThresholdColumn.FillWeight = 30F;
|
||||
resources.ApplyResources(this.CriticalThresholdColumn, "CriticalThresholdColumn");
|
||||
this.CriticalThresholdColumn.Name = "CriticalThresholdColumn";
|
||||
//
|
||||
// RetrieveNRPEPanel
|
||||
//
|
||||
resources.ApplyResources(this.RetrieveNRPEPanel, "RetrieveNRPEPanel");
|
||||
this.RetrieveNRPEPanel.Controls.Add(this.RetrieveNRPELabel, 1, 0);
|
||||
this.RetrieveNRPEPanel.Controls.Add(this.RetrieveNRPEPicture, 0, 0);
|
||||
this.RetrieveNRPEPanel.Name = "RetrieveNRPEPanel";
|
||||
//
|
||||
// RetrieveNRPELabel
|
||||
//
|
||||
resources.ApplyResources(this.RetrieveNRPELabel, "RetrieveNRPELabel");
|
||||
this.RetrieveNRPELabel.Name = "RetrieveNRPELabel";
|
||||
//
|
||||
// RetrieveNRPEPicture
|
||||
//
|
||||
resources.ApplyResources(this.RetrieveNRPEPicture, "RetrieveNRPEPicture");
|
||||
this.RetrieveNRPEPicture.Name = "RetrieveNRPEPicture";
|
||||
this.RetrieveNRPEPicture.TabStop = false;
|
||||
//
|
||||
// NRPEEditPage
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.Controls.Add(this.NRPETableLayoutPanel);
|
||||
this.Name = "NRPEEditPage";
|
||||
this.NRPETableLayoutPanel.ResumeLayout(false);
|
||||
this.NRPETableLayoutPanel.PerformLayout();
|
||||
this.GeneralConfigureGroupBox.ResumeLayout(false);
|
||||
this.GeneralConfigureGroupBox.PerformLayout();
|
||||
this.GeneralConfigTableLayoutPanel.ResumeLayout(false);
|
||||
this.GeneralConfigTableLayoutPanel.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.CheckDataGridView)).EndInit();
|
||||
this.RetrieveNRPEPanel.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.RetrieveNRPEPicture)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private System.Windows.Forms.TableLayoutPanel NRPETableLayoutPanel;
|
||||
private XenAdmin.Controls.Common.AutoHeightLabel DescLabelPool;
|
||||
private System.Windows.Forms.GroupBox GeneralConfigureGroupBox;
|
||||
private System.Windows.Forms.TableLayoutPanel GeneralConfigTableLayoutPanel;
|
||||
private System.Windows.Forms.CheckBox EnableNRPECheckBox;
|
||||
private System.Windows.Forms.Label AllowHostsLabel;
|
||||
private System.Windows.Forms.TextBox AllowHostsTextBox;
|
||||
private System.Windows.Forms.CheckBox DebugLogCheckBox;
|
||||
private System.Windows.Forms.CheckBox SslDebugLogCheckBox;
|
||||
private Controls.DataGridViewEx.DataGridViewEx CheckDataGridView;
|
||||
private Controls.Common.AutoHeightLabel DescLabelHost;
|
||||
private System.Windows.Forms.Label RetrieveNRPELabel;
|
||||
private System.Windows.Forms.TableLayoutPanel RetrieveNRPEPanel;
|
||||
private System.Windows.Forms.PictureBox RetrieveNRPEPicture;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn CheckColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn WarningThresholdColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn CriticalThresholdColumn;
|
||||
}
|
||||
}
|
||||
|
384
XenAdmin/SettingsPanels/NRPEEditPage.cs
Normal file
384
XenAdmin/SettingsPanels/NRPEEditPage.cs
Normal file
@ -0,0 +1,384 @@
|
||||
/* Copyright (c) Cloud Software Group, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
using XenAdmin.Actions;
|
||||
using XenAdmin.Core;
|
||||
using XenAdmin.Actions.NRPE;
|
||||
using XenAPI;
|
||||
|
||||
namespace XenAdmin.SettingsPanels
|
||||
{
|
||||
public partial class NRPEEditPage : UserControl, IEditPage
|
||||
{
|
||||
private static readonly Regex REGEX_IPV4 = new Regex("^((25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(25[0-5]|2[0-4]\\d|[01]?\\d\\d?)$");
|
||||
private static readonly Regex REGEX_IPV4_CIDR = new Regex("^([0-9]{1,3}\\.){3}[0-9]{1,3}(\\/([0-9]|[1-2][0-9]|3[0-2]))?$");
|
||||
private static readonly Regex REGEX_DOMAIN = new Regex("^(((?!-))(xn--|_)?[a-z0-9-]{0,61}[a-z0-9]{1,1}\\.)*(xn--)?([a-z0-9][a-z0-9\\-]{0,60}|[a-z0-9-]{1,30}\\.[a-z]{2,})$");
|
||||
|
||||
private bool _isHost;
|
||||
|
||||
private IXenObject _clone;
|
||||
private readonly ToolTip _invalidParamToolTip;
|
||||
private string _invalidParamToolTipText = "";
|
||||
|
||||
private readonly List<CheckGroup> _checkGroupList = new List<CheckGroup>();
|
||||
private readonly Dictionary<string, CheckGroup> _checkGroupDictByName = new Dictionary<string, CheckGroup>();
|
||||
private readonly Dictionary<string, CheckGroup> _checkGroupDictByLabel = new Dictionary<string, CheckGroup>();
|
||||
|
||||
private NRPEHostConfiguration _nrpeOriginalConfig;
|
||||
private NRPEHostConfiguration _nrpeCurrentConfig;
|
||||
|
||||
public Image Image => Images.StaticImages._000_Module_h32bit_16;
|
||||
|
||||
public NRPEEditPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
Text = Messages.NRPE;
|
||||
|
||||
_nrpeOriginalConfig = new NRPEHostConfiguration
|
||||
{
|
||||
EnableNRPE = false,
|
||||
AllowHosts = NRPEHostConfiguration.ALLOW_HOSTS_PLACE_HOLDER,
|
||||
Debug = false,
|
||||
SslLogging = false
|
||||
};
|
||||
|
||||
_checkGroupList.Add(new HostLoadCheckGroup("check_host_load", Messages.NRPE_CHECK_HOST_LOAD));
|
||||
_checkGroupList.Add(new CheckGroup("check_host_cpu", Messages.NRPE_CHECK_HOST_CPU));
|
||||
_checkGroupList.Add(new CheckGroup("check_host_memory", Messages.NRPE_CHECK_HOST_MEMORY));
|
||||
_checkGroupList.Add(new CheckGroup("check_vgpu", Messages.NRPE_CHECK_VGPU));
|
||||
_checkGroupList.Add(new CheckGroup("check_vgpu_memory", Messages.NRPE_CHECK_VGPU_MEMORY));
|
||||
_checkGroupList.Add(new Dom0LoadCheckGroup("check_load", Messages.NRPE_CHECK_LOAD));
|
||||
_checkGroupList.Add(new CheckGroup("check_cpu", Messages.NRPE_CHECK_CPU));
|
||||
_checkGroupList.Add(new CheckGroup("check_memory", Messages.NRPE_CHECK_MEMORY));
|
||||
_checkGroupList.Add(new FreeCheckGroup("check_swap", Messages.NRPE_CHECK_SWAP));
|
||||
_checkGroupList.Add(new FreeCheckGroup("check_disk_root", Messages.NRPE_CHECK_DISK_ROOT));
|
||||
_checkGroupList.Add(new FreeCheckGroup("check_disk_log", Messages.NRPE_CHECK_DISK_LOG));
|
||||
|
||||
foreach (CheckGroup checkGroup in _checkGroupList)
|
||||
{
|
||||
CheckDataGridView.Rows.Add(checkGroup.CheckThresholdRow);
|
||||
_checkGroupDictByName.Add(checkGroup.Name, checkGroup);
|
||||
_checkGroupDictByLabel.Add(checkGroup.NameCell.Value.ToString(), checkGroup);
|
||||
}
|
||||
|
||||
AllowHostsTextBox.Text = NRPEHostConfiguration.ALLOW_HOSTS_PLACE_HOLDER;
|
||||
AllowHostsTextBox.ForeColor = Color.FromKnownColor(KnownColor.ControlDark);
|
||||
AllowHostsTextBox.GotFocus += AllowHostsTextBox_GotFocus;
|
||||
AllowHostsTextBox.LostFocus += AllowHostsTextBox_LostFocus;
|
||||
|
||||
_invalidParamToolTip = new ToolTip
|
||||
{
|
||||
IsBalloon = true,
|
||||
ToolTipIcon = ToolTipIcon.Warning,
|
||||
ToolTipTitle = Messages.INVALID_PARAMETER,
|
||||
Tag = AllowHostsTextBox
|
||||
};
|
||||
}
|
||||
|
||||
public string SubText => Messages.NRPE_EDIT_PAGE_TEXT;
|
||||
|
||||
public bool ValidToSave
|
||||
{
|
||||
get
|
||||
{
|
||||
_invalidParamToolTipText = "";
|
||||
_invalidParamToolTip.ToolTipTitle = "";
|
||||
|
||||
if (!EnableNRPECheckBox.Checked)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool valid = IsAllowHostsValid();
|
||||
|
||||
DataGridViewTextBoxCell focusCellWhenErrorOccurs = null;
|
||||
foreach (CheckGroup checkGroup in _checkGroupList)
|
||||
{
|
||||
if (!checkGroup.CheckValue())
|
||||
{
|
||||
valid = false;
|
||||
if (focusCellWhenErrorOccurs == null)
|
||||
{
|
||||
focusCellWhenErrorOccurs = checkGroup.NameCell;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (focusCellWhenErrorOccurs != null)
|
||||
{
|
||||
CheckDataGridView.CurrentCell = CheckDataGridView.Rows[0].Cells[0];
|
||||
CheckDataGridView.CurrentCell = focusCellWhenErrorOccurs;
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasChanged
|
||||
{
|
||||
get
|
||||
{
|
||||
UpdateCurrentNRPEConfiguration();
|
||||
return !_nrpeCurrentConfig.Equals(_nrpeOriginalConfig);
|
||||
}
|
||||
}
|
||||
|
||||
public void Cleanup()
|
||||
{
|
||||
}
|
||||
|
||||
public void ShowLocalValidationMessages()
|
||||
{
|
||||
if (_invalidParamToolTip.Tag is Control ctrl)
|
||||
{
|
||||
_invalidParamToolTip.Hide(ctrl);
|
||||
if (!_invalidParamToolTipText.Equals(""))
|
||||
{
|
||||
HelpersGUI.ShowBalloonMessage(ctrl, _invalidParamToolTip, _invalidParamToolTipText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void HideLocalValidationMessages()
|
||||
{
|
||||
if (_invalidParamToolTip.Tag is Control ctrl)
|
||||
{
|
||||
_invalidParamToolTip.Hide(ctrl);
|
||||
}
|
||||
}
|
||||
|
||||
public AsyncAction SaveSettings()
|
||||
{
|
||||
return new NRPEUpdateAction(_clone, _nrpeCurrentConfig, _nrpeOriginalConfig, true);
|
||||
}
|
||||
|
||||
public void SetXenObjects(IXenObject orig, IXenObject clone)
|
||||
{
|
||||
_clone = clone;
|
||||
_isHost = _clone is Host;
|
||||
|
||||
DescLabelHost.Visible = _isHost;
|
||||
DescLabelPool.Visible = !_isHost;
|
||||
UpdateRetrievingNRPETip(NRPEHostConfiguration.RetrieveNRPEStatus.Retrieving);
|
||||
DisableAllComponent();
|
||||
|
||||
NRPERetrieveAction action = new NRPERetrieveAction(_clone, _nrpeOriginalConfig, true);
|
||||
action.Completed += ActionCompleted;
|
||||
action.RunAsync();
|
||||
}
|
||||
|
||||
private void ActionCompleted(ActionBase sender)
|
||||
{
|
||||
Program.Invoke(this.Parent, UpdateRetrieveStatus);
|
||||
}
|
||||
|
||||
private void UpdateRetrieveStatus()
|
||||
{
|
||||
if (_nrpeOriginalConfig.Status == NRPEHostConfiguration.RetrieveNRPEStatus.Successful)
|
||||
{
|
||||
EnableNRPECheckBox.Enabled = true;
|
||||
UpdateComponentValueBasedConfiguration();
|
||||
UpdateComponentStatusBasedEnableNRPECheckBox();
|
||||
}
|
||||
UpdateRetrievingNRPETip(_nrpeOriginalConfig.Status);
|
||||
}
|
||||
|
||||
private void UpdateRetrievingNRPETip(NRPEHostConfiguration.RetrieveNRPEStatus status)
|
||||
{
|
||||
switch (status)
|
||||
{
|
||||
case NRPEHostConfiguration.RetrieveNRPEStatus.Retrieving:
|
||||
RetrieveNRPELabel.Text = Messages.NRPE_RETRIEVING_CONFIGURATION;
|
||||
RetrieveNRPEPicture.Image = Images.StaticImages.ajax_loader;
|
||||
RetrieveNRPEPicture.Visible = true;
|
||||
break;
|
||||
case NRPEHostConfiguration.RetrieveNRPEStatus.Successful:
|
||||
RetrieveNRPELabel.Text = "";
|
||||
RetrieveNRPEPicture.Image = Images.StaticImages._000_Tick_h32bit_16;
|
||||
RetrieveNRPEPicture.Visible = false;
|
||||
break;
|
||||
case NRPEHostConfiguration.RetrieveNRPEStatus.Failed:
|
||||
RetrieveNRPELabel.Text = Messages.NRPE_RETRIEVE_FAILED;
|
||||
RetrieveNRPEPicture.Image = Images.StaticImages._000_error_h32bit_16;
|
||||
RetrieveNRPEPicture.Visible = true;
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(status), status, null);
|
||||
}
|
||||
}
|
||||
|
||||
private void DisableAllComponent()
|
||||
{
|
||||
EnableNRPECheckBox.Enabled = false;
|
||||
GeneralConfigureGroupBox.Enabled = false;
|
||||
CheckDataGridView.Enabled = false;
|
||||
}
|
||||
|
||||
private void UpdateComponentValueBasedConfiguration()
|
||||
{
|
||||
EnableNRPECheckBox.Checked = _nrpeOriginalConfig.EnableNRPE;
|
||||
AllowHostsTextBox.Text = AllowHostsWithoutLocalAddress(_nrpeOriginalConfig.AllowHosts);
|
||||
AllowHostsTextBox.ForeColor = AllowHostsTextBox.Text.Equals(NRPEHostConfiguration.ALLOW_HOSTS_PLACE_HOLDER) ?
|
||||
Color.FromKnownColor(KnownColor.ControlDark) : AllowHostsTextBox.ForeColor = Color.FromKnownColor(KnownColor.ControlText);
|
||||
DebugLogCheckBox.Checked = _nrpeOriginalConfig.Debug;
|
||||
SslDebugLogCheckBox.Checked = _nrpeOriginalConfig.SslLogging;
|
||||
|
||||
foreach (KeyValuePair<string, NRPEHostConfiguration.Check> check in _nrpeOriginalConfig.CheckDict)
|
||||
{
|
||||
_checkGroupDictByName.TryGetValue(check.Key, out CheckGroup cg);
|
||||
cg?.UpdateThreshold(check.Value.WarningThreshold, check.Value.CriticalThreshold);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateComponentStatusBasedEnableNRPECheckBox()
|
||||
{
|
||||
GeneralConfigureGroupBox.Enabled = EnableNRPECheckBox.Checked;
|
||||
CheckDataGridView.Enabled = EnableNRPECheckBox.Checked;
|
||||
CheckDataGridView.ScrollBars = ScrollBars.Both;
|
||||
CheckDataGridView.DefaultCellStyle.BackColor = EnableNRPECheckBox.Checked ?
|
||||
Color.FromKnownColor(KnownColor.Window) : Color.FromKnownColor(KnownColor.Control);
|
||||
foreach (var checkGroup in _checkGroupList)
|
||||
{
|
||||
if (EnableNRPECheckBox.Checked)
|
||||
{
|
||||
checkGroup.WarningThresholdCell.Style.ForeColor = Color.FromKnownColor(KnownColor.ControlText);
|
||||
checkGroup.CriticalThresholdCell.Style.ForeColor = Color.FromKnownColor(KnownColor.ControlText);
|
||||
}
|
||||
else
|
||||
{
|
||||
checkGroup.WarningThresholdCell.Style.ForeColor = Color.FromKnownColor(KnownColor.ControlDark);
|
||||
checkGroup.CriticalThresholdCell.Style.ForeColor = Color.FromKnownColor(KnownColor.ControlDark);
|
||||
}
|
||||
}
|
||||
CheckDataGridView.ShowCellToolTips = EnableNRPECheckBox.Checked;
|
||||
CheckDataGridView.ShowCellErrors = EnableNRPECheckBox.Checked;
|
||||
}
|
||||
|
||||
private bool IsAllowHostsValid()
|
||||
{
|
||||
_invalidParamToolTip.ToolTipTitle = Messages.NRPE_ALLOW_HOSTS_ERROR_TITLE;
|
||||
_invalidParamToolTip.Tag = AllowHostsTextBox;
|
||||
|
||||
string str = AllowHostsTextBox.Text;
|
||||
if (str.Trim().Length == 0 || str.Trim().Equals(NRPEHostConfiguration.ALLOW_HOSTS_PLACE_HOLDER))
|
||||
{
|
||||
_invalidParamToolTipText = Messages.NRPE_ALLOW_HOSTS_EMPTY_ERROR;
|
||||
return false;
|
||||
}
|
||||
|
||||
string[] hostArray = str.Split(',');
|
||||
for ( int i = 0; i < hostArray.Length; i++ )
|
||||
{
|
||||
if (!REGEX_IPV4.Match(hostArray[i].Trim()).Success &&
|
||||
!REGEX_IPV4_CIDR.Match(hostArray[i].Trim()).Success &&
|
||||
!REGEX_DOMAIN.Match(hostArray[i].Trim()).Success)
|
||||
{
|
||||
_invalidParamToolTipText = Messages.NRPE_ALLOW_HOSTS_FORMAT_ERROR;
|
||||
return false;
|
||||
}
|
||||
for ( int j = 0; j < i; j++ )
|
||||
{
|
||||
if (hostArray[i].Trim().Equals(hostArray[j].Trim()))
|
||||
{
|
||||
_invalidParamToolTipText = Messages.NRPE_ALLOW_HOSTS_SAME_ADDRESS;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private string AllowHostsWithoutLocalAddress(string allowHosts)
|
||||
{
|
||||
string UpdatedAllowHosts = "";
|
||||
string[] AllowHostArray = allowHosts.Split(',');
|
||||
foreach (string allowHost in AllowHostArray)
|
||||
{
|
||||
if (!allowHost.Trim().Equals("127.0.0.1") &&
|
||||
!allowHost.Trim().Equals("::1"))
|
||||
{
|
||||
UpdatedAllowHosts += allowHost + ",";
|
||||
}
|
||||
}
|
||||
return UpdatedAllowHosts.Length == 0 ? NRPEHostConfiguration.ALLOW_HOSTS_PLACE_HOLDER :
|
||||
UpdatedAllowHosts.Substring(0, UpdatedAllowHosts.Length - 1);
|
||||
}
|
||||
|
||||
private void UpdateCurrentNRPEConfiguration()
|
||||
{
|
||||
_nrpeCurrentConfig = new NRPEHostConfiguration
|
||||
{
|
||||
EnableNRPE = EnableNRPECheckBox.Checked,
|
||||
AllowHosts = AllowHostsTextBox.Text.Replace(" ", string.Empty),
|
||||
Debug = DebugLogCheckBox.Checked,
|
||||
SslLogging = SslDebugLogCheckBox.Checked
|
||||
};
|
||||
foreach (KeyValuePair<string, CheckGroup> item in _checkGroupDictByName)
|
||||
{
|
||||
_nrpeCurrentConfig.AddNRPECheck(new NRPEHostConfiguration.Check(item.Key,
|
||||
item.Value.WarningThresholdCell.Value.ToString().Trim(), item.Value.CriticalThresholdCell.Value.ToString().Trim()));
|
||||
}
|
||||
}
|
||||
|
||||
private void EnableNRPECheckBox_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
UpdateComponentStatusBasedEnableNRPECheckBox();
|
||||
}
|
||||
|
||||
private void AllowHostsTextBox_GotFocus(object sender, EventArgs e)
|
||||
{
|
||||
if (AllowHostsTextBox.Text.Equals(NRPEHostConfiguration.ALLOW_HOSTS_PLACE_HOLDER))
|
||||
{
|
||||
AllowHostsTextBox.Text = "";
|
||||
}
|
||||
AllowHostsTextBox.ForeColor = Color.FromKnownColor(KnownColor.ControlText);
|
||||
}
|
||||
|
||||
private void AllowHostsTextBox_LostFocus(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(AllowHostsTextBox.Text))
|
||||
{
|
||||
AllowHostsTextBox.Text = NRPEHostConfiguration.ALLOW_HOSTS_PLACE_HOLDER;
|
||||
AllowHostsTextBox.ForeColor = Color.FromKnownColor(KnownColor.ControlDark);
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckDataGridView_EndEdit(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
foreach (CheckGroup checkGroup in _checkGroupList)
|
||||
{
|
||||
checkGroup.CheckValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
650
XenAdmin/SettingsPanels/NRPEEditPage.resx
Normal file
650
XenAdmin/SettingsPanels/NRPEEditPage.resx
Normal file
@ -0,0 +1,650 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="NRPETableLayoutPanel.ColumnCount" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="DescLabelPool.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="DescLabelPool.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
<value>Fill</value>
|
||||
</data>
|
||||
<data name="DescLabelPool.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="DescLabelPool.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>3, 0</value>
|
||||
</data>
|
||||
<data name="DescLabelPool.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>3, 0, 3, 10</value>
|
||||
</data>
|
||||
<data name="DescLabelPool.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>644, 26</value>
|
||||
</data>
|
||||
<data name="DescLabelPool.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="DescLabelPool.Text" xml:space="preserve">
|
||||
<value>Nagios Remote Plugin Executor (NRPE) allows you to monitor remotely resource metrics on the servers of your pool.
|
||||
Use this page to review and modify the NRPE configuration and metric threshold settings used for this pool.</value>
|
||||
</data>
|
||||
<data name=">>DescLabelPool.Name" xml:space="preserve">
|
||||
<value>DescLabelPool</value>
|
||||
</data>
|
||||
<data name=">>DescLabelPool.Type" xml:space="preserve">
|
||||
<value>XenAdmin.Controls.Common.AutoHeightLabel, [XenCenter], Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>DescLabelPool.Parent" xml:space="preserve">
|
||||
<value>NRPETableLayoutPanel</value>
|
||||
</data>
|
||||
<data name=">>DescLabelPool.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="DescLabelHost.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="DescLabelHost.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
<value>Fill</value>
|
||||
</data>
|
||||
<data name="DescLabelHost.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="DescLabelHost.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>3, 36</value>
|
||||
</data>
|
||||
<data name="DescLabelHost.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>3, 0, 3, 10</value>
|
||||
</data>
|
||||
<data name="DescLabelHost.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>644, 26</value>
|
||||
</data>
|
||||
<data name="DescLabelHost.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="DescLabelHost.Text" xml:space="preserve">
|
||||
<value>Nagios Remote Plugin Executor (NRPE) allows you to monitor remotely resource metrics on the servers of your pool.
|
||||
Use this page to review and modify the NRPE configuration and metric threshold settings used for this server.</value>
|
||||
</data>
|
||||
<data name=">>DescLabelHost.Name" xml:space="preserve">
|
||||
<value>DescLabelHost</value>
|
||||
</data>
|
||||
<data name=">>DescLabelHost.Type" xml:space="preserve">
|
||||
<value>XenAdmin.Controls.Common.AutoHeightLabel, [XenCenter], Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>DescLabelHost.Parent" xml:space="preserve">
|
||||
<value>NRPETableLayoutPanel</value>
|
||||
</data>
|
||||
<data name=">>DescLabelHost.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="EnableNRPECheckBox.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="EnableNRPECheckBox.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="EnableNRPECheckBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>3, 75</value>
|
||||
</data>
|
||||
<data name="EnableNRPECheckBox.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>3, 3, 3, 8</value>
|
||||
</data>
|
||||
<data name="EnableNRPECheckBox.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>3, 0, 0, 0</value>
|
||||
</data>
|
||||
<data name="EnableNRPECheckBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>95, 17</value>
|
||||
</data>
|
||||
<data name="EnableNRPECheckBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="EnableNRPECheckBox.Text" xml:space="preserve">
|
||||
<value>&Enable NRPE</value>
|
||||
</data>
|
||||
<data name=">>EnableNRPECheckBox.Name" xml:space="preserve">
|
||||
<value>EnableNRPECheckBox</value>
|
||||
</data>
|
||||
<data name=">>EnableNRPECheckBox.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>EnableNRPECheckBox.Parent" xml:space="preserve">
|
||||
<value>NRPETableLayoutPanel</value>
|
||||
</data>
|
||||
<data name=">>EnableNRPECheckBox.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="GeneralConfigTableLayoutPanel.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="GeneralConfigTableLayoutPanel.AutoSizeMode" type="System.Windows.Forms.AutoSizeMode, System.Windows.Forms">
|
||||
<value>GrowAndShrink</value>
|
||||
</data>
|
||||
<data name="GeneralConfigTableLayoutPanel.ColumnCount" type="System.Int32, mscorlib">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="AllowHostsLabel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Left</value>
|
||||
</data>
|
||||
<data name="AllowHostsLabel.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="AllowHostsLabel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="AllowHostsLabel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>3, 6</value>
|
||||
</data>
|
||||
<data name="AllowHostsLabel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>96, 13</value>
|
||||
</data>
|
||||
<data name="AllowHostsLabel.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="AllowHostsLabel.Text" xml:space="preserve">
|
||||
<value>&Monitoring servers:</value>
|
||||
</data>
|
||||
<data name=">>AllowHostsLabel.Name" xml:space="preserve">
|
||||
<value>AllowHostsLabel</value>
|
||||
</data>
|
||||
<data name=">>AllowHostsLabel.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>AllowHostsLabel.Parent" xml:space="preserve">
|
||||
<value>GeneralConfigTableLayoutPanel</value>
|
||||
</data>
|
||||
<data name=">>AllowHostsLabel.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="AllowHostsTextBox.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Left, Right</value>
|
||||
</data>
|
||||
<data name="AllowHostsTextBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>105, 3</value>
|
||||
</data>
|
||||
<data name="AllowHostsTextBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>530, 20</value>
|
||||
</data>
|
||||
<data name="AllowHostsTextBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name=">>AllowHostsTextBox.Name" xml:space="preserve">
|
||||
<value>AllowHostsTextBox</value>
|
||||
</data>
|
||||
<data name=">>AllowHostsTextBox.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>AllowHostsTextBox.Parent" xml:space="preserve">
|
||||
<value>GeneralConfigTableLayoutPanel</value>
|
||||
</data>
|
||||
<data name=">>AllowHostsTextBox.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="DebugLogCheckBox.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="DebugLogCheckBox.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="DebugLogCheckBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>3, 29</value>
|
||||
</data>
|
||||
<data name="DebugLogCheckBox.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>3, 0, 0, 0</value>
|
||||
</data>
|
||||
<data name="DebugLogCheckBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>211, 17</value>
|
||||
</data>
|
||||
<data name="DebugLogCheckBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="DebugLogCheckBox.Text" xml:space="preserve">
|
||||
<value>Record &debugging messages to syslog</value>
|
||||
</data>
|
||||
<data name=">>DebugLogCheckBox.Name" xml:space="preserve">
|
||||
<value>DebugLogCheckBox</value>
|
||||
</data>
|
||||
<data name=">>DebugLogCheckBox.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>DebugLogCheckBox.Parent" xml:space="preserve">
|
||||
<value>GeneralConfigTableLayoutPanel</value>
|
||||
</data>
|
||||
<data name=">>DebugLogCheckBox.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="SslDebugLogCheckBox.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="SslDebugLogCheckBox.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="SslDebugLogCheckBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>3, 52</value>
|
||||
</data>
|
||||
<data name="SslDebugLogCheckBox.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>3, 0, 0, 0</value>
|
||||
</data>
|
||||
<data name="SslDebugLogCheckBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>181, 17</value>
|
||||
</data>
|
||||
<data name="SslDebugLogCheckBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="SslDebugLogCheckBox.Text" xml:space="preserve">
|
||||
<value>Record &SSL messages to syslog</value>
|
||||
</data>
|
||||
<data name=">>SslDebugLogCheckBox.Name" xml:space="preserve">
|
||||
<value>SslDebugLogCheckBox</value>
|
||||
</data>
|
||||
<data name=">>SslDebugLogCheckBox.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>SslDebugLogCheckBox.Parent" xml:space="preserve">
|
||||
<value>GeneralConfigTableLayoutPanel</value>
|
||||
</data>
|
||||
<data name=">>SslDebugLogCheckBox.ZOrder" xml:space="preserve">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="GeneralConfigTableLayoutPanel.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
<value>Top</value>
|
||||
</data>
|
||||
<data name="GeneralConfigTableLayoutPanel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>3, 16</value>
|
||||
</data>
|
||||
<data name="GeneralConfigTableLayoutPanel.RowCount" type="System.Int32, mscorlib">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="GeneralConfigTableLayoutPanel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>638, 72</value>
|
||||
</data>
|
||||
<data name="GeneralConfigTableLayoutPanel.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name=">>GeneralConfigTableLayoutPanel.Name" xml:space="preserve">
|
||||
<value>GeneralConfigTableLayoutPanel</value>
|
||||
</data>
|
||||
<data name=">>GeneralConfigTableLayoutPanel.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>GeneralConfigTableLayoutPanel.Parent" xml:space="preserve">
|
||||
<value>GeneralConfigureGroupBox</value>
|
||||
</data>
|
||||
<data name=">>GeneralConfigTableLayoutPanel.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="GeneralConfigTableLayoutPanel.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
|
||||
<value><?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="AllowHostsLabel" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="AllowHostsTextBox" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="DebugLogCheckBox" Row="1" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="SslDebugLogCheckBox" Row="2" RowSpan="1" Column="0" ColumnSpan="2" /></Controls><Columns Styles="AutoSize,0,Percent,100" /><Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,Absolute,20" /></TableLayoutSettings></value>
|
||||
</data>
|
||||
<data name="GeneralConfigureGroupBox.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
<value>Fill</value>
|
||||
</data>
|
||||
<data name="GeneralConfigureGroupBox.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>3, 103</value>
|
||||
</data>
|
||||
<data name="GeneralConfigureGroupBox.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>3, 3, 3, 10</value>
|
||||
</data>
|
||||
<data name="GeneralConfigureGroupBox.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>3, 3, 3, 0</value>
|
||||
</data>
|
||||
<data name="GeneralConfigureGroupBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>644, 100</value>
|
||||
</data>
|
||||
<data name="GeneralConfigureGroupBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="GeneralConfigureGroupBox.Text" xml:space="preserve">
|
||||
<value>General Configuration</value>
|
||||
</data>
|
||||
<data name=">>GeneralConfigureGroupBox.Name" xml:space="preserve">
|
||||
<value>GeneralConfigureGroupBox</value>
|
||||
</data>
|
||||
<data name=">>GeneralConfigureGroupBox.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>GeneralConfigureGroupBox.Parent" xml:space="preserve">
|
||||
<value>NRPETableLayoutPanel</value>
|
||||
</data>
|
||||
<data name=">>GeneralConfigureGroupBox.ZOrder" xml:space="preserve">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="CheckColumn.HeaderText" xml:space="preserve">
|
||||
<value>Metric</value>
|
||||
</data>
|
||||
<data name="CheckColumn.MinimumWidth" type="System.Int32, mscorlib">
|
||||
<value>100</value>
|
||||
</data>
|
||||
<metadata name="WarningThresholdColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<data name="WarningThresholdColumn.HeaderText" xml:space="preserve">
|
||||
<value>Warning Threshold</value>
|
||||
</data>
|
||||
<data name="WarningThresholdColumn.MinimumWidth" type="System.Int32, mscorlib">
|
||||
<value>100</value>
|
||||
</data>
|
||||
<metadata name="CriticalThresholdColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<data name="CriticalThresholdColumn.HeaderText" xml:space="preserve">
|
||||
<value>Critical Threshold</value>
|
||||
</data>
|
||||
<data name="CriticalThresholdColumn.MinimumWidth" type="System.Int32, mscorlib">
|
||||
<value>100</value>
|
||||
</data>
|
||||
<data name="CheckDataGridView.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
<value>Fill</value>
|
||||
</data>
|
||||
<data name="CheckDataGridView.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>3, 216</value>
|
||||
</data>
|
||||
<data name="CheckDataGridView.RowHeadersWidth" type="System.Int32, mscorlib">
|
||||
<value>62</value>
|
||||
</data>
|
||||
<data name="CheckDataGridView.ScrollBars" type="System.Windows.Forms.ScrollBars, System.Windows.Forms">
|
||||
<value>None</value>
|
||||
</data>
|
||||
<data name="CheckDataGridView.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>644, 273</value>
|
||||
</data>
|
||||
<data name="CheckDataGridView.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name=">>CheckDataGridView.Name" xml:space="preserve">
|
||||
<value>CheckDataGridView</value>
|
||||
</data>
|
||||
<data name=">>CheckDataGridView.Type" xml:space="preserve">
|
||||
<value>XenAdmin.Controls.DataGridViewEx.DataGridViewEx, [XenCenter], Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>CheckDataGridView.Parent" xml:space="preserve">
|
||||
<value>NRPETableLayoutPanel</value>
|
||||
</data>
|
||||
<data name=">>CheckDataGridView.ZOrder" xml:space="preserve">
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name="RetrieveNRPEPanel.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="RetrieveNRPEPanel.ColumnCount" type="System.Int32, mscorlib">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="RetrieveNRPELabel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Bottom, Left, Right</value>
|
||||
</data>
|
||||
<data name="RetrieveNRPELabel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="RetrieveNRPELabel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>24, 0</value>
|
||||
</data>
|
||||
<data name="RetrieveNRPELabel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>619, 21</value>
|
||||
</data>
|
||||
<data name="RetrieveNRPELabel.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>5</value>
|
||||
</data>
|
||||
<data name="RetrieveNRPELabel.Text" xml:space="preserve">
|
||||
<value>Retrieving NRPE configuration...</value>
|
||||
</data>
|
||||
<data name="RetrieveNRPELabel.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>MiddleLeft</value>
|
||||
</data>
|
||||
<data name=">>RetrieveNRPELabel.Name" xml:space="preserve">
|
||||
<value>RetrieveNRPELabel</value>
|
||||
</data>
|
||||
<data name=">>RetrieveNRPELabel.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>RetrieveNRPELabel.Parent" xml:space="preserve">
|
||||
<value>RetrieveNRPEPanel</value>
|
||||
</data>
|
||||
<data name=">>RetrieveNRPELabel.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="RetrieveNRPEPicture.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="RetrieveNRPEPicture.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>2, 2</value>
|
||||
</data>
|
||||
<data name="RetrieveNRPEPicture.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>2, 2, 2, 2</value>
|
||||
</data>
|
||||
<data name="RetrieveNRPEPicture.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>17, 17</value>
|
||||
</data>
|
||||
<data name="RetrieveNRPEPicture.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>6</value>
|
||||
</data>
|
||||
<data name=">>RetrieveNRPEPicture.Name" xml:space="preserve">
|
||||
<value>RetrieveNRPEPicture</value>
|
||||
</data>
|
||||
<data name=">>RetrieveNRPEPicture.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>RetrieveNRPEPicture.Parent" xml:space="preserve">
|
||||
<value>RetrieveNRPEPanel</value>
|
||||
</data>
|
||||
<data name=">>RetrieveNRPEPicture.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="RetrieveNRPEPanel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>2, 494</value>
|
||||
</data>
|
||||
<data name="RetrieveNRPEPanel.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>2, 2, 2, 2</value>
|
||||
</data>
|
||||
<data name="RetrieveNRPEPanel.RowCount" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="RetrieveNRPEPanel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>646, 21</value>
|
||||
</data>
|
||||
<data name="RetrieveNRPEPanel.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>6</value>
|
||||
</data>
|
||||
<data name=">>RetrieveNRPEPanel.Name" xml:space="preserve">
|
||||
<value>RetrieveNRPEPanel</value>
|
||||
</data>
|
||||
<data name=">>RetrieveNRPEPanel.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>RetrieveNRPEPanel.Parent" xml:space="preserve">
|
||||
<value>NRPETableLayoutPanel</value>
|
||||
</data>
|
||||
<data name=">>RetrieveNRPEPanel.ZOrder" xml:space="preserve">
|
||||
<value>5</value>
|
||||
</data>
|
||||
<data name="RetrieveNRPEPanel.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
|
||||
<value><?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="RetrieveNRPELabel" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="RetrieveNRPEPicture" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,Percent,100" /><Rows Styles="Percent,100" /></TableLayoutSettings></value>
|
||||
</data>
|
||||
<data name="NRPETableLayoutPanel.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
|
||||
<value>Fill</value>
|
||||
</data>
|
||||
<data name="NRPETableLayoutPanel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>0, 0</value>
|
||||
</data>
|
||||
<data name="NRPETableLayoutPanel.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>3, 10, 3, 0</value>
|
||||
</data>
|
||||
<data name="NRPETableLayoutPanel.RowCount" type="System.Int32, mscorlib">
|
||||
<value>8</value>
|
||||
</data>
|
||||
<data name="NRPETableLayoutPanel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>650, 537</value>
|
||||
</data>
|
||||
<data name="NRPETableLayoutPanel.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name=">>NRPETableLayoutPanel.Name" xml:space="preserve">
|
||||
<value>NRPETableLayoutPanel</value>
|
||||
</data>
|
||||
<data name=">>NRPETableLayoutPanel.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>NRPETableLayoutPanel.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>NRPETableLayoutPanel.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="NRPETableLayoutPanel.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
|
||||
<value><?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="DescLabelPool" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="DescLabelHost" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="EnableNRPECheckBox" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="GeneralConfigureGroupBox" Row="4" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="CheckDataGridView" Row="5" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="RetrieveNRPEPanel" Row="6" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100" /><Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,Percent,100,AutoSize,0,Absolute,20" /></TableLayoutSettings></value>
|
||||
</data>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
|
||||
<value>96, 96</value>
|
||||
</data>
|
||||
<data name="$this.AutoScroll" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="$this.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>650, 537</value>
|
||||
</data>
|
||||
<data name=">>CheckColumn.Name" xml:space="preserve">
|
||||
<value>CheckColumn</value>
|
||||
</data>
|
||||
<data name=">>CheckColumn.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>WarningThresholdColumn.Name" xml:space="preserve">
|
||||
<value>WarningThresholdColumn</value>
|
||||
</data>
|
||||
<data name=">>WarningThresholdColumn.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>CriticalThresholdColumn.Name" xml:space="preserve">
|
||||
<value>CriticalThresholdColumn</value>
|
||||
</data>
|
||||
<data name=">>CriticalThresholdColumn.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>$this.Name" xml:space="preserve">
|
||||
<value>NRPEEditPage</value>
|
||||
</data>
|
||||
<data name=">>$this.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
</root>
|
@ -480,6 +480,16 @@
|
||||
<Compile Include="SettingsPanels\NetworkOptionsEditPage.Designer.cs">
|
||||
<DependentUpon>NetworkOptionsEditPage.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SettingsPanels\NRPEEditPage.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SettingsPanels\NRPEEditPage.Designer.cs">
|
||||
<DependentUpon>NRPEEditPage.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SettingsPanels\NRPEEditPage.CheckGroup.cs">
|
||||
<DependentUpon>NRPEEditPage.cs</DependentUpon>
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SettingsPanels\PoolAdvancedEditPage.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
@ -2107,6 +2117,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<DependentUpon>HostPowerONEditPage.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="SettingsPanels\NRPEEditPage.resx">
|
||||
<DependentUpon>NRPEEditPage.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="SettingsPanels\PerfmonAlertOptionsPage.resx">
|
||||
<SubType>Designer</SubType>
|
||||
<DependentUpon>PerfmonAlertOptionsPage.cs</DependentUpon>
|
||||
|
144
XenModel/Actions/NRPE/NRPEHostConfiguration.cs
Normal file
144
XenModel/Actions/NRPE/NRPEHostConfiguration.cs
Normal file
@ -0,0 +1,144 @@
|
||||
/* Copyright (c) Cloud Software Group, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace XenAdmin.Actions.NRPE
|
||||
{
|
||||
public class NRPEHostConfiguration : ICloneable, IEquatable<NRPEHostConfiguration>
|
||||
{
|
||||
public const string XAPI_NRPE_PLUGIN_NAME = "nrpe";
|
||||
public const string XAPI_NRPE_STATUS = "status";
|
||||
public const string XAPI_NRPE_GET_CONFIG = "get-config";
|
||||
public const string XAPI_NRPE_GET_THRESHOLD = "get-threshold";
|
||||
public const string XAPI_NRPE_ENABLE = "enable";
|
||||
public const string XAPI_NRPE_DISABLE = "disable";
|
||||
public const string XAPI_NRPE_SET_CONFIG = "set-config";
|
||||
public const string XAPI_NRPE_SET_THRESHOLD = "set-threshold";
|
||||
public const string XAPI_NRPE_RESTART = "restart";
|
||||
public const string XAPI_NRPE_CONTROL = "control";
|
||||
|
||||
public const string DEBUG_ENABLE = "1";
|
||||
public const string DEBUG_DISABLE = "0";
|
||||
|
||||
public const string SSL_LOGGING_ENABLE = "0x2f";
|
||||
public const string SSL_LOGGING_DISABLE = "0x00";
|
||||
|
||||
public static readonly string ALLOW_HOSTS_PLACE_HOLDER = Messages.NRPE_ALLOW_HOSTS_PLACE_HOLDER;
|
||||
|
||||
private readonly Dictionary<string, Check> _checkDict = new Dictionary<string, Check>();
|
||||
|
||||
public bool EnableNRPE { get; set; }
|
||||
|
||||
public string AllowHosts { get; set; }
|
||||
|
||||
public bool Debug { get; set; }
|
||||
|
||||
public bool SslLogging { get; set; }
|
||||
|
||||
public Dictionary<string, Check> CheckDict => _checkDict;
|
||||
|
||||
public RetrieveNRPEStatus Status { get; set; }
|
||||
|
||||
public enum RetrieveNRPEStatus
|
||||
{
|
||||
Retrieving,
|
||||
Successful,
|
||||
Failed
|
||||
}
|
||||
|
||||
public class Check
|
||||
{
|
||||
public string Name { get; }
|
||||
public string WarningThreshold { get; }
|
||||
public string CriticalThreshold{ get; }
|
||||
|
||||
public Check(string name, string warningThreshold, string criticalThreshold)
|
||||
{
|
||||
Name = name;
|
||||
WarningThreshold = warningThreshold;
|
||||
CriticalThreshold = criticalThreshold;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void AddNRPECheck(Check checkItem)
|
||||
{
|
||||
_checkDict.Add(checkItem.Name, checkItem);
|
||||
}
|
||||
|
||||
public bool GetNRPECheck(string name, out Check check)
|
||||
{
|
||||
return _checkDict.TryGetValue(name, out check);
|
||||
}
|
||||
|
||||
public bool Equals(NRPEHostConfiguration other)
|
||||
{
|
||||
if (EnableNRPE != other.EnableNRPE ||
|
||||
!AllowHosts.Equals(other.AllowHosts) ||
|
||||
Debug != other.Debug ||
|
||||
SslLogging != other.SslLogging)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
foreach (KeyValuePair<string, Check> kvp in CheckDict)
|
||||
{
|
||||
Check CurrentCheck = kvp.Value;
|
||||
other.GetNRPECheck(kvp.Key, out Check OriginalCheck);
|
||||
if (CurrentCheck != null && OriginalCheck != null
|
||||
&& (!CurrentCheck.WarningThreshold.Equals(OriginalCheck.WarningThreshold)
|
||||
|| !CurrentCheck.CriticalThreshold.Equals(OriginalCheck.CriticalThreshold)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
NRPEHostConfiguration cloned = new NRPEHostConfiguration
|
||||
{
|
||||
EnableNRPE = EnableNRPE,
|
||||
AllowHosts = AllowHosts,
|
||||
Debug = Debug,
|
||||
SslLogging = SslLogging
|
||||
};
|
||||
foreach (KeyValuePair<string, Check> kvp in _checkDict)
|
||||
{
|
||||
Check CurrentCheck = kvp.Value;
|
||||
cloned.AddNRPECheck(new Check(CurrentCheck.Name, CurrentCheck.WarningThreshold, CurrentCheck.CriticalThreshold));
|
||||
}
|
||||
|
||||
return cloned;
|
||||
}
|
||||
}
|
||||
}
|
134
XenModel/Actions/NRPE/NRPERetrieveAction.cs
Normal file
134
XenModel/Actions/NRPE/NRPERetrieveAction.cs
Normal file
@ -0,0 +1,134 @@
|
||||
/* Copyright (c) Cloud Software Group, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using XenAdmin.Core;
|
||||
using XenAPI;
|
||||
|
||||
|
||||
namespace XenAdmin.Actions.NRPE
|
||||
{
|
||||
public class NRPERetrieveAction : AsyncAction
|
||||
{
|
||||
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private readonly NRPEHostConfiguration _nrpeCurrentConfig;
|
||||
|
||||
private readonly IXenObject _clone;
|
||||
|
||||
public NRPERetrieveAction(IXenObject host, NRPEHostConfiguration nrpeHostConfiguration, bool suppressHistory)
|
||||
: base(host.Connection, Messages.NRPE_ACTION_RETRIEVING, Messages.NRPE_ACTION_RETRIEVING, suppressHistory)
|
||||
{
|
||||
_clone = host;
|
||||
_nrpeCurrentConfig = nrpeHostConfiguration;
|
||||
}
|
||||
|
||||
protected override void Run()
|
||||
{
|
||||
_nrpeCurrentConfig.Status = NRPEHostConfiguration.RetrieveNRPEStatus.Successful;
|
||||
// For pool, retrieve the configuration from the master of the pool.
|
||||
IXenObject o = _clone is Pool p ? Helpers.GetCoordinator(p) : _clone;
|
||||
try
|
||||
{
|
||||
InitNRPEGeneralConfiguration(o);
|
||||
InitNRPEThreshold(o);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.ErrorFormat("Run NRPE plugin failed, failed reason: {0}", e.Message);
|
||||
_nrpeCurrentConfig.Status = NRPEHostConfiguration.RetrieveNRPEStatus.Failed;
|
||||
}
|
||||
}
|
||||
|
||||
private void InitNRPEGeneralConfiguration(IXenObject o)
|
||||
{
|
||||
string status = Host.call_plugin(o.Connection.Session, o.opaque_ref, NRPEHostConfiguration.XAPI_NRPE_PLUGIN_NAME,
|
||||
NRPEHostConfiguration.XAPI_NRPE_STATUS, null);
|
||||
log.InfoFormat("Run NRPE {0}, return: {1}", NRPEHostConfiguration.XAPI_NRPE_STATUS, status);
|
||||
_nrpeCurrentConfig.EnableNRPE = status.Trim().Equals("active enabled");
|
||||
|
||||
string nrpeConfig = Host.call_plugin(o.Connection.Session, o.opaque_ref, NRPEHostConfiguration.XAPI_NRPE_PLUGIN_NAME,
|
||||
NRPEHostConfiguration.XAPI_NRPE_GET_CONFIG, null);
|
||||
log.InfoFormat("Run NRPE {0}, return: {1}", NRPEHostConfiguration.XAPI_NRPE_GET_CONFIG, nrpeConfig);
|
||||
|
||||
string[] nrpeConfigArray = nrpeConfig.Split('\n');
|
||||
foreach (string nrpeConfigItem in nrpeConfigArray)
|
||||
{
|
||||
if (nrpeConfigItem.Trim().StartsWith("allowed_hosts:"))
|
||||
{
|
||||
string allowHosts = nrpeConfigItem.Replace("allowed_hosts:", "").Trim();
|
||||
_nrpeCurrentConfig.AllowHosts = AllowHostsWithoutLocalAddress(allowHosts);
|
||||
}
|
||||
else if (nrpeConfigItem.Trim().StartsWith("debug:"))
|
||||
{
|
||||
string enableDebug = nrpeConfigItem.Replace("debug:", "").Trim();
|
||||
_nrpeCurrentConfig.Debug = enableDebug.Equals(NRPEHostConfiguration.DEBUG_ENABLE);
|
||||
}
|
||||
else if (nrpeConfigItem.Trim().StartsWith("ssl_logging:"))
|
||||
{
|
||||
string enableSslLogging = nrpeConfigItem.Replace("ssl_logging:", "").Trim();
|
||||
_nrpeCurrentConfig.SslLogging = enableSslLogging.Equals(NRPEHostConfiguration.SSL_LOGGING_ENABLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void InitNRPEThreshold(IXenObject o)
|
||||
{
|
||||
string nrpeThreshold = Host.call_plugin(o.Connection.Session, o.opaque_ref, NRPEHostConfiguration.XAPI_NRPE_PLUGIN_NAME,
|
||||
NRPEHostConfiguration.XAPI_NRPE_GET_THRESHOLD, null);
|
||||
log.InfoFormat("Run NRPE {0}, return: {1}", NRPEHostConfiguration.XAPI_NRPE_GET_THRESHOLD, nrpeThreshold);
|
||||
|
||||
string[] nrpeThresholdArray = nrpeThreshold.Split('\n');
|
||||
foreach (string nrpeThresholdItem in nrpeThresholdArray)
|
||||
{
|
||||
// Return string format for each line: check_cpu warning threshold - 50 critical threshold - 80
|
||||
string[] thresholdRtnArray = nrpeThresholdItem.Split(' ');
|
||||
_nrpeCurrentConfig.AddNRPECheck(new NRPEHostConfiguration.Check(thresholdRtnArray[0],
|
||||
thresholdRtnArray[4], thresholdRtnArray[8]));
|
||||
}
|
||||
}
|
||||
|
||||
private static string AllowHostsWithoutLocalAddress(string allowHosts)
|
||||
{
|
||||
string updatedAllowHosts = "";
|
||||
string[] allowHostArray = allowHosts.Split(',');
|
||||
foreach (string allowHost in allowHostArray)
|
||||
{
|
||||
if (!allowHost.Trim().Equals("127.0.0.1") &&
|
||||
!allowHost.Trim().Equals("::1"))
|
||||
{
|
||||
updatedAllowHosts += allowHost + ",";
|
||||
}
|
||||
}
|
||||
return updatedAllowHosts.Length == 0 ? NRPEHostConfiguration.ALLOW_HOSTS_PLACE_HOLDER :
|
||||
updatedAllowHosts.Substring(0, updatedAllowHosts.Length - 1);
|
||||
}
|
||||
}
|
||||
}
|
180
XenModel/Actions/NRPE/NRPEUpdateAction.cs
Normal file
180
XenModel/Actions/NRPE/NRPEUpdateAction.cs
Normal file
@ -0,0 +1,180 @@
|
||||
/* Copyright (c) Cloud Software Group, Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using XenAPI;
|
||||
|
||||
|
||||
namespace XenAdmin.Actions.NRPE
|
||||
{
|
||||
public class NRPEUpdateAction : AsyncAction
|
||||
{
|
||||
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private readonly NRPEHostConfiguration _nrpeOriginalConfig; // NRPE configuration fetched from host
|
||||
private readonly NRPEHostConfiguration _nrpeHostConfiguration; // NRPE configuration after user modified
|
||||
|
||||
private readonly IXenObject _clone;
|
||||
|
||||
public NRPEUpdateAction(IXenObject host, NRPEHostConfiguration nrpeHostConfiguration, NRPEHostConfiguration nrpeOriginalConfig, bool suppressHistory)
|
||||
: base(host.Connection, Messages.NRPE_ACTION_CHANGING, Messages.NRPE_ACTION_CHANGING, suppressHistory)
|
||||
{
|
||||
_clone = host;
|
||||
_nrpeHostConfiguration = nrpeHostConfiguration;
|
||||
_nrpeOriginalConfig = nrpeOriginalConfig;
|
||||
}
|
||||
|
||||
protected override void Run()
|
||||
{
|
||||
if (_clone is Host)
|
||||
{
|
||||
SetNRPEConfigureForHost(_clone);
|
||||
}
|
||||
else
|
||||
{
|
||||
List<Host> hostList = ((Pool) _clone).Connection.Cache.Hosts.ToList();
|
||||
hostList.ForEach(SetNRPEConfigureForHost);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetNRPEConfigureForHost(IXenObject o)
|
||||
{
|
||||
// Enable/Disable NRPE
|
||||
if (!_nrpeHostConfiguration.EnableNRPE == _nrpeOriginalConfig.EnableNRPE)
|
||||
{
|
||||
SetNRPEStatus(o, _nrpeHostConfiguration.EnableNRPE);
|
||||
}
|
||||
if (!_nrpeHostConfiguration.EnableNRPE) // If disable, return
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// NRPE General Configuration
|
||||
if (!_nrpeHostConfiguration.AllowHosts.Equals(_nrpeOriginalConfig.AllowHosts)
|
||||
|| !_nrpeHostConfiguration.Debug.Equals(_nrpeOriginalConfig.Debug)
|
||||
|| !_nrpeHostConfiguration.SslLogging.Equals(_nrpeOriginalConfig.SslLogging))
|
||||
{
|
||||
SetNRPEGeneralConfiguration(o, _nrpeHostConfiguration.AllowHosts, _nrpeHostConfiguration.Debug, _nrpeHostConfiguration.SslLogging);
|
||||
}
|
||||
|
||||
// NRPE Check Threshold
|
||||
foreach (KeyValuePair<string, NRPEHostConfiguration.Check> kvp in _nrpeHostConfiguration.CheckDict)
|
||||
{
|
||||
NRPEHostConfiguration.Check currentCheck = kvp.Value;
|
||||
_nrpeOriginalConfig.GetNRPECheck(kvp.Key, out NRPEHostConfiguration.Check originalCheck);
|
||||
if (currentCheck != null && originalCheck != null
|
||||
&& (!currentCheck.WarningThreshold.Equals(originalCheck.WarningThreshold)
|
||||
|| !currentCheck.CriticalThreshold.Equals(originalCheck.CriticalThreshold)))
|
||||
{
|
||||
SetNRPEThreshold(o, currentCheck.Name, currentCheck.WarningThreshold, currentCheck.CriticalThreshold);
|
||||
}
|
||||
}
|
||||
|
||||
RestartNRPE(o);
|
||||
}
|
||||
|
||||
private void SetNRPEStatus(IXenObject host, bool enableNRPE)
|
||||
{
|
||||
// Workaround for CA-384579 (caused by CA-384572):
|
||||
// If the certificate used by NRPE was generated in Yangtze it has no permissions.
|
||||
// We prevent command (start, restart, etc) failures by calling control, which modifies certificate permissions.
|
||||
// After CA-384572 is resolved we will remove this workaround code.
|
||||
if (enableNRPE)
|
||||
{
|
||||
Dictionary<string, string> enableDict = new Dictionary<string, string>
|
||||
{
|
||||
{ "enable", "true" }
|
||||
};
|
||||
try
|
||||
{
|
||||
string controlResult = Host.call_plugin(host.Connection.Session, host.opaque_ref, NRPEHostConfiguration.XAPI_NRPE_PLUGIN_NAME,
|
||||
NRPEHostConfiguration.XAPI_NRPE_CONTROL, enableDict);
|
||||
log.InfoFormat("Run NRPE {0}, return: {1}", NRPEHostConfiguration.XAPI_NRPE_CONTROL, controlResult);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.ErrorFormat("Run NRPE {0} failed, error: {1}", NRPEHostConfiguration.XAPI_NRPE_CONTROL, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
string nrpeUpdateStatusMethod = enableNRPE ?
|
||||
NRPEHostConfiguration.XAPI_NRPE_ENABLE : NRPEHostConfiguration.XAPI_NRPE_DISABLE;
|
||||
string result = Host.call_plugin(host.Connection.Session, host.opaque_ref, NRPEHostConfiguration.XAPI_NRPE_PLUGIN_NAME,
|
||||
nrpeUpdateStatusMethod, null);
|
||||
log.InfoFormat("Run NRPE {0}, return: {1}", nrpeUpdateStatusMethod, result);
|
||||
}
|
||||
|
||||
private void SetNRPEGeneralConfiguration(IXenObject host, string allowHosts, bool debug, bool sslLogging)
|
||||
{
|
||||
Dictionary<string, string> configArgDict = new Dictionary<string, string>
|
||||
{
|
||||
{ "allowed_hosts", "127.0.0.1,::1," + (allowHosts.Equals(NRPEHostConfiguration.ALLOW_HOSTS_PLACE_HOLDER) ? "" : allowHosts) },
|
||||
{ "debug", debug ? NRPEHostConfiguration.DEBUG_ENABLE : NRPEHostConfiguration.DEBUG_DISABLE },
|
||||
{ "ssl_logging", sslLogging ? NRPEHostConfiguration.SSL_LOGGING_ENABLE : NRPEHostConfiguration.SSL_LOGGING_DISABLE}
|
||||
};
|
||||
string result = Host.call_plugin(host.Connection.Session, host.opaque_ref, NRPEHostConfiguration.XAPI_NRPE_PLUGIN_NAME,
|
||||
NRPEHostConfiguration.XAPI_NRPE_SET_CONFIG, configArgDict);
|
||||
log.InfoFormat("Run NRPE {0}, allowed_hosts={1}, debug={2}, ssl_logging={3}, return: {4}",
|
||||
NRPEHostConfiguration.XAPI_NRPE_SET_CONFIG,
|
||||
_nrpeHostConfiguration.AllowHosts,
|
||||
_nrpeHostConfiguration.Debug,
|
||||
_nrpeHostConfiguration.SslLogging,
|
||||
result);
|
||||
}
|
||||
|
||||
private void SetNRPEThreshold(IXenObject host, string checkName, string warningThreshold, string criticalThreshold)
|
||||
{
|
||||
Dictionary<string, string> thresholdArgDict = new Dictionary<string, string>
|
||||
{
|
||||
{ checkName, null },
|
||||
{ "w", warningThreshold },
|
||||
{ "c", criticalThreshold }
|
||||
};
|
||||
string result = Host.call_plugin(host.Connection.Session, host.opaque_ref, NRPEHostConfiguration.XAPI_NRPE_PLUGIN_NAME,
|
||||
NRPEHostConfiguration.XAPI_NRPE_SET_THRESHOLD, thresholdArgDict);
|
||||
log.InfoFormat("Run NRPE {0}, check={1}, w={2}, c={3}, return: {4}",
|
||||
NRPEHostConfiguration.XAPI_NRPE_SET_THRESHOLD,
|
||||
checkName,
|
||||
warningThreshold,
|
||||
criticalThreshold,
|
||||
result);
|
||||
}
|
||||
|
||||
// After modified NRPE configuration, we need to restart NRPE to take effect
|
||||
private void RestartNRPE(IXenObject host)
|
||||
{
|
||||
string result = Host.call_plugin(host.Connection.Session, host.opaque_ref, NRPEHostConfiguration.XAPI_NRPE_PLUGIN_NAME,
|
||||
NRPEHostConfiguration.XAPI_NRPE_RESTART, null);
|
||||
log.InfoFormat("Run NRPE {0}, return: {1}", NRPEHostConfiguration.XAPI_NRPE_RESTART, result);
|
||||
}
|
||||
}
|
||||
}
|
9
XenModel/FriendlyNames.Designer.cs
generated
9
XenModel/FriendlyNames.Designer.cs
generated
@ -5282,6 +5282,15 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Host CPU Load.
|
||||
/// </summary>
|
||||
public static string OPERATIONAL_METRICS_HOSTLOAD {
|
||||
get {
|
||||
return ResourceManager.GetString("OPERATIONAL_METRICS_HOSTLOAD", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to There was an error in preparing the host for upgrade..
|
||||
/// </summary>
|
||||
|
@ -1859,6 +1859,9 @@
|
||||
<data name="Message.name-wlb_vm_relocation" xml:space="preserve">
|
||||
<value>WLB VM Relocation</value>
|
||||
</data>
|
||||
<data name="OPERATIONAL_METRICS_HOSTLOAD" xml:space="preserve">
|
||||
<value>Host CPU Load</value>
|
||||
</data>
|
||||
<data name="PREPARE_HOST_UPGRADE_ERROR_PREPARING_HOST" xml:space="preserve">
|
||||
<value>There was an error in preparing the host for upgrade.</value>
|
||||
</data>
|
||||
|
288
XenModel/Messages.Designer.cs
generated
288
XenModel/Messages.Designer.cs
generated
@ -29123,6 +29123,294 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to NRPE.
|
||||
/// </summary>
|
||||
public static string NRPE {
|
||||
get {
|
||||
return ResourceManager.GetString("NRPE", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Changing NRPE configuration.
|
||||
/// </summary>
|
||||
public static string NRPE_ACTION_CHANGING {
|
||||
get {
|
||||
return ResourceManager.GetString("NRPE_ACTION_CHANGING", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Retrieving NRPE configuration.
|
||||
/// </summary>
|
||||
public static string NRPE_ACTION_RETRIEVING {
|
||||
get {
|
||||
return ResourceManager.GetString("NRPE_ACTION_RETRIEVING", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to NRPE service is active.
|
||||
/// </summary>
|
||||
public static string NRPE_ACTIVE {
|
||||
get {
|
||||
return ResourceManager.GetString("NRPE_ACTIVE", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Monitoring servers should not be empty..
|
||||
/// </summary>
|
||||
public static string NRPE_ALLOW_HOSTS_EMPTY_ERROR {
|
||||
get {
|
||||
return ResourceManager.GetString("NRPE_ALLOW_HOSTS_EMPTY_ERROR", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Monitoring servers format is not correct.
|
||||
/// </summary>
|
||||
public static string NRPE_ALLOW_HOSTS_ERROR_TITLE {
|
||||
get {
|
||||
return ResourceManager.GetString("NRPE_ALLOW_HOSTS_ERROR_TITLE", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Monitoring servers should be comma separated IP address or domain list, e.g. 192.168.1.1, test.domain.com.
|
||||
/// </summary>
|
||||
public static string NRPE_ALLOW_HOSTS_FORMAT_ERROR {
|
||||
get {
|
||||
return ResourceManager.GetString("NRPE_ALLOW_HOSTS_FORMAT_ERROR", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Comma separated IP address or domain list, e.g. 192.168.1.1, test.domain.com.
|
||||
/// </summary>
|
||||
public static string NRPE_ALLOW_HOSTS_PLACE_HOLDER {
|
||||
get {
|
||||
return ResourceManager.GetString("NRPE_ALLOW_HOSTS_PLACE_HOLDER", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Please remove duplicate addresses.
|
||||
/// </summary>
|
||||
public static string NRPE_ALLOW_HOSTS_SAME_ADDRESS {
|
||||
get {
|
||||
return ResourceManager.GetString("NRPE_ALLOW_HOSTS_SAME_ADDRESS", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to NRPE batch configuration.
|
||||
/// </summary>
|
||||
public static string NRPE_BATCH_CONFIGURATION {
|
||||
get {
|
||||
return ResourceManager.GetString("NRPE_BATCH_CONFIGURATION", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Dom0 CPU Usage (%).
|
||||
/// </summary>
|
||||
public static string NRPE_CHECK_CPU {
|
||||
get {
|
||||
return ResourceManager.GetString("NRPE_CHECK_CPU", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Dom0 Log Partition Free Space (%).
|
||||
/// </summary>
|
||||
public static string NRPE_CHECK_DISK_LOG {
|
||||
get {
|
||||
return ResourceManager.GetString("NRPE_CHECK_DISK_LOG", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Dom0 Root Partition Free Space (%).
|
||||
/// </summary>
|
||||
public static string NRPE_CHECK_DISK_ROOT {
|
||||
get {
|
||||
return ResourceManager.GetString("NRPE_CHECK_DISK_ROOT", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Host CPU Usage (%).
|
||||
/// </summary>
|
||||
public static string NRPE_CHECK_HOST_CPU {
|
||||
get {
|
||||
return ResourceManager.GetString("NRPE_CHECK_HOST_CPU", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Host CPU Load.
|
||||
/// </summary>
|
||||
public static string NRPE_CHECK_HOST_LOAD {
|
||||
get {
|
||||
return ResourceManager.GetString("NRPE_CHECK_HOST_LOAD", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Host Memory Usage (%).
|
||||
/// </summary>
|
||||
public static string NRPE_CHECK_HOST_MEMORY {
|
||||
get {
|
||||
return ResourceManager.GetString("NRPE_CHECK_HOST_MEMORY", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Dom0 CPU Load.
|
||||
/// </summary>
|
||||
public static string NRPE_CHECK_LOAD {
|
||||
get {
|
||||
return ResourceManager.GetString("NRPE_CHECK_LOAD", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Dom0 Memory Usage (%).
|
||||
/// </summary>
|
||||
public static string NRPE_CHECK_MEMORY {
|
||||
get {
|
||||
return ResourceManager.GetString("NRPE_CHECK_MEMORY", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Dom0 Free Swap (%).
|
||||
/// </summary>
|
||||
public static string NRPE_CHECK_SWAP {
|
||||
get {
|
||||
return ResourceManager.GetString("NRPE_CHECK_SWAP", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Host vGPU Usage (%).
|
||||
/// </summary>
|
||||
public static string NRPE_CHECK_VGPU {
|
||||
get {
|
||||
return ResourceManager.GetString("NRPE_CHECK_VGPU", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Host vGPU Memory Usage (%).
|
||||
/// </summary>
|
||||
public static string NRPE_CHECK_VGPU_MEMORY {
|
||||
get {
|
||||
return ResourceManager.GetString("NRPE_CHECK_VGPU_MEMORY", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to NRPE Configuration.
|
||||
/// </summary>
|
||||
public static string NRPE_EDIT_PAGE_TEXT {
|
||||
get {
|
||||
return ResourceManager.GetString("NRPE_EDIT_PAGE_TEXT", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to NRPE service is inactive.
|
||||
/// </summary>
|
||||
public static string NRPE_INACTIVE {
|
||||
get {
|
||||
return ResourceManager.GetString("NRPE_INACTIVE", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to NRPE check name: {0}.
|
||||
/// </summary>
|
||||
public static string NRPE_METRIC_TOOLTIP {
|
||||
get {
|
||||
return ResourceManager.GetString("NRPE_METRIC_TOOLTIP", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Failed to retrieve NRPE configuration, please check XenCenter logs..
|
||||
/// </summary>
|
||||
public static string NRPE_RETRIEVE_FAILED {
|
||||
get {
|
||||
return ResourceManager.GetString("NRPE_RETRIEVE_FAILED", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Retrieving NRPE configuration....
|
||||
/// </summary>
|
||||
public static string NRPE_RETRIEVING_CONFIGURATION {
|
||||
get {
|
||||
return ResourceManager.GetString("NRPE_RETRIEVING_CONFIGURATION", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Threshold value should range from {0} to {1}..
|
||||
/// </summary>
|
||||
public static string NRPE_THRESHOLD_RANGE_ERROR {
|
||||
get {
|
||||
return ResourceManager.GetString("NRPE_THRESHOLD_RANGE_ERROR", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Threshold value should consist of 3 comma separated numbers..
|
||||
/// </summary>
|
||||
public static string NRPE_THRESHOLD_SHOULD_BE_3_NUMBERS {
|
||||
get {
|
||||
return ResourceManager.GetString("NRPE_THRESHOLD_SHOULD_BE_3_NUMBERS", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Threshold value should be a number..
|
||||
/// </summary>
|
||||
public static string NRPE_THRESHOLD_SHOULD_BE_NUMBER {
|
||||
get {
|
||||
return ResourceManager.GetString("NRPE_THRESHOLD_SHOULD_BE_NUMBER", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Threshold value should not be empty..
|
||||
/// </summary>
|
||||
public static string NRPE_THRESHOLD_SHOULD_NOT_BE_EMPTY {
|
||||
get {
|
||||
return ResourceManager.GetString("NRPE_THRESHOLD_SHOULD_NOT_BE_EMPTY", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Warning threshold should be greater than critical threshold..
|
||||
/// </summary>
|
||||
public static string NRPE_THRESHOLD_WARNING_SHOULD_BIGGER_THAN_CRITICAL {
|
||||
get {
|
||||
return ResourceManager.GetString("NRPE_THRESHOLD_WARNING_SHOULD_BIGGER_THAN_CRITICAL", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Warning threshold should be less than critical threshold..
|
||||
/// </summary>
|
||||
public static string NRPE_THRESHOLD_WARNING_SHOULD_LESS_THAN_CRITICAL {
|
||||
get {
|
||||
return ResourceManager.GetString("NRPE_THRESHOLD_WARNING_SHOULD_LESS_THAN_CRITICAL", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Number of snapshots to keep.
|
||||
/// </summary>
|
||||
|
@ -10107,6 +10107,102 @@ When you configure an NFS storage repository, you simply provide the host name o
|
||||
<data name="NOW" xml:space="preserve">
|
||||
<value>Now</value>
|
||||
</data>
|
||||
<data name="NRPE" xml:space="preserve">
|
||||
<value>NRPE</value>
|
||||
</data>
|
||||
<data name="NRPE_ACTION_CHANGING" xml:space="preserve">
|
||||
<value>Changing NRPE configuration</value>
|
||||
</data>
|
||||
<data name="NRPE_ACTION_RETRIEVING" xml:space="preserve">
|
||||
<value>Retrieving NRPE configuration</value>
|
||||
</data>
|
||||
<data name="NRPE_ACTIVE" xml:space="preserve">
|
||||
<value>NRPE service is active</value>
|
||||
</data>
|
||||
<data name="NRPE_ALLOW_HOSTS_EMPTY_ERROR" xml:space="preserve">
|
||||
<value>Monitoring servers should not be empty.</value>
|
||||
</data>
|
||||
<data name="NRPE_ALLOW_HOSTS_ERROR_TITLE" xml:space="preserve">
|
||||
<value>Monitoring servers format is not correct</value>
|
||||
</data>
|
||||
<data name="NRPE_ALLOW_HOSTS_FORMAT_ERROR" xml:space="preserve">
|
||||
<value>Monitoring servers should be comma separated IP address or domain list, e.g. 192.168.1.1, test.domain.com</value>
|
||||
</data>
|
||||
<data name="NRPE_ALLOW_HOSTS_PLACE_HOLDER" xml:space="preserve">
|
||||
<value>Comma separated IP address or domain list, e.g. 192.168.1.1, test.domain.com</value>
|
||||
</data>
|
||||
<data name="NRPE_ALLOW_HOSTS_SAME_ADDRESS" xml:space="preserve">
|
||||
<value>Please remove duplicate addresses</value>
|
||||
</data>
|
||||
<data name="NRPE_BATCH_CONFIGURATION" xml:space="preserve">
|
||||
<value>NRPE batch configuration</value>
|
||||
</data>
|
||||
<data name="NRPE_CHECK_CPU" xml:space="preserve">
|
||||
<value>Dom0 CPU Usage (%)</value>
|
||||
</data>
|
||||
<data name="NRPE_CHECK_DISK_LOG" xml:space="preserve">
|
||||
<value>Dom0 Log Partition Free Space (%)</value>
|
||||
</data>
|
||||
<data name="NRPE_CHECK_DISK_ROOT" xml:space="preserve">
|
||||
<value>Dom0 Root Partition Free Space (%)</value>
|
||||
</data>
|
||||
<data name="NRPE_CHECK_HOST_CPU" xml:space="preserve">
|
||||
<value>Host CPU Usage (%)</value>
|
||||
</data>
|
||||
<data name="NRPE_CHECK_HOST_LOAD" xml:space="preserve">
|
||||
<value>Host CPU Load</value>
|
||||
</data>
|
||||
<data name="NRPE_CHECK_HOST_MEMORY" xml:space="preserve">
|
||||
<value>Host Memory Usage (%)</value>
|
||||
</data>
|
||||
<data name="NRPE_CHECK_LOAD" xml:space="preserve">
|
||||
<value>Dom0 CPU Load</value>
|
||||
</data>
|
||||
<data name="NRPE_CHECK_MEMORY" xml:space="preserve">
|
||||
<value>Dom0 Memory Usage (%)</value>
|
||||
</data>
|
||||
<data name="NRPE_CHECK_SWAP" xml:space="preserve">
|
||||
<value>Dom0 Free Swap (%)</value>
|
||||
</data>
|
||||
<data name="NRPE_CHECK_VGPU" xml:space="preserve">
|
||||
<value>Host vGPU Usage (%)</value>
|
||||
</data>
|
||||
<data name="NRPE_CHECK_VGPU_MEMORY" xml:space="preserve">
|
||||
<value>Host vGPU Memory Usage (%)</value>
|
||||
</data>
|
||||
<data name="NRPE_EDIT_PAGE_TEXT" xml:space="preserve">
|
||||
<value>NRPE Configuration</value>
|
||||
</data>
|
||||
<data name="NRPE_INACTIVE" xml:space="preserve">
|
||||
<value>NRPE service is inactive</value>
|
||||
</data>
|
||||
<data name="NRPE_METRIC_TOOLTIP" xml:space="preserve">
|
||||
<value>NRPE check name: {0}</value>
|
||||
</data>
|
||||
<data name="NRPE_RETRIEVE_FAILED" xml:space="preserve">
|
||||
<value>Failed to retrieve NRPE configuration, please check XenCenter logs.</value>
|
||||
</data>
|
||||
<data name="NRPE_RETRIEVING_CONFIGURATION" xml:space="preserve">
|
||||
<value>Retrieving NRPE configuration...</value>
|
||||
</data>
|
||||
<data name="NRPE_THRESHOLD_RANGE_ERROR" xml:space="preserve">
|
||||
<value>Threshold value should range from {0} to {1}.</value>
|
||||
</data>
|
||||
<data name="NRPE_THRESHOLD_SHOULD_BE_3_NUMBERS" xml:space="preserve">
|
||||
<value>Threshold value should consist of 3 comma separated numbers.</value>
|
||||
</data>
|
||||
<data name="NRPE_THRESHOLD_SHOULD_BE_NUMBER" xml:space="preserve">
|
||||
<value>Threshold value should be a number.</value>
|
||||
</data>
|
||||
<data name="NRPE_THRESHOLD_SHOULD_NOT_BE_EMPTY" xml:space="preserve">
|
||||
<value>Threshold value should not be empty.</value>
|
||||
</data>
|
||||
<data name="NRPE_THRESHOLD_WARNING_SHOULD_BIGGER_THAN_CRITICAL" xml:space="preserve">
|
||||
<value>Warning threshold should be greater than critical threshold.</value>
|
||||
</data>
|
||||
<data name="NRPE_THRESHOLD_WARNING_SHOULD_LESS_THAN_CRITICAL" xml:space="preserve">
|
||||
<value>Warning threshold should be less than critical threshold.</value>
|
||||
</data>
|
||||
<data name="NUMBER_OF_SNAPSHOTS_TO_KEEP" xml:space="preserve">
|
||||
<value>Number of snapshots to keep</value>
|
||||
</data>
|
||||
@ -15077,7 +15173,7 @@ Any disk in your VM's DVD drive will be ejected when installing {1}.</value>
|
||||
<value>Normal</value>
|
||||
</data>
|
||||
<data name="YUM_REPO_PROXY" xml:space="preserve">
|
||||
<value></value>
|
||||
<value />
|
||||
</data>
|
||||
<data name="YUM_REPO_SYNC_AFTER_CONFIG" xml:space="preserve">
|
||||
<value>{0} recommends that you synchronize the selected pool(s) or standalone host(s) with the specified update channel as soon as possible to retrieve the latest available updates.
|
||||
@ -15105,4 +15201,4 @@ Do you want to synchronize immediately?</value>
|
||||
<data name="YUM_REPO_SYNC_YES_VISIBLE_BUTTON" xml:space="preserve">
|
||||
<value>Only synchronize &visible</value>
|
||||
</data>
|
||||
</root>
|
||||
</root>
|
@ -528,6 +528,12 @@ namespace XenAdmin.Core
|
||||
return coordinator == null || ProductVersionCompare(coordinator.GetXapiVersion(), "23.18.0") >= 0;
|
||||
}
|
||||
|
||||
public static bool XapiEqualOrGreater_23_27_0(IXenConnection conn)
|
||||
{
|
||||
var coordinator = GetCoordinator(conn);
|
||||
return coordinator == null || ProductVersionCompare(coordinator.GetXapiVersion(), "23.27.0") >= 0;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -671,6 +671,7 @@ namespace XenAdmin.Core
|
||||
static Regex XapiMemoryRegex = new Regex("^xapi_(allocation|free_memory|live_memory|memory_usage)_kib$");
|
||||
static Regex StatefileLatencyRegex = new Regex("^statefile/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/latency$");
|
||||
static Regex LoadAvgRegex = new Regex("loadavg");
|
||||
static Regex HostLoadRegex = new Regex("hostload");
|
||||
static Regex SrRegex = new Regex("^sr_[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}_cache_(size|hits|misses)");
|
||||
static Regex SrIORegex = new Regex("^(io_throughput|iops)_(read|write|total)_([a-f0-9]{8})$");
|
||||
static Regex SrOtherRegex = new Regex("^(latency|avgqu_sz|inflight|iowait)_([a-f0-9]{8})$");
|
||||
@ -706,6 +707,9 @@ namespace XenAdmin.Core
|
||||
if (LoadAvgRegex.IsMatch(name))
|
||||
return DataSourceCategory.LoadAverage;
|
||||
|
||||
if (HostLoadRegex.IsMatch(name))
|
||||
return DataSourceCategory.LoadAverage;
|
||||
|
||||
if (name.StartsWith("pvsaccelerator"))
|
||||
return DataSourceCategory.Pvs;
|
||||
|
||||
@ -899,6 +903,9 @@ namespace XenAdmin.Core
|
||||
if (LoadAvgRegex.IsMatch(name))
|
||||
return FriendlyNameManager.GetFriendlyName("Label-performance.loadavg");
|
||||
|
||||
if (HostLoadRegex.IsMatch(name))
|
||||
return FriendlyNames.OPERATIONAL_METRICS_HOSTLOAD;
|
||||
|
||||
return FriendlyNameManager.GetFriendlyName(string.Format("Label-performance.{0}", name));
|
||||
}
|
||||
|
||||
|
@ -88,6 +88,8 @@
|
||||
<Compile Include="Actions\Host\HostAbstractAction.cs" />
|
||||
<Compile Include="Actions\Host\RebootHostAction.cs" />
|
||||
<Compile Include="Actions\Host\RestartToolstackAction.cs" />
|
||||
<Compile Include="Actions\NRPE\NRPERetrieveAction.cs" />
|
||||
<Compile Include="Actions\NRPE\NRPEUpdateAction.cs" />
|
||||
<Compile Include="Actions\Host\ShutdownHostAction.cs" />
|
||||
<Compile Include="Actions\Host\UpdateIntegratedGpuPassthroughAction.cs" />
|
||||
<Compile Include="Actions\DummyAction.cs" />
|
||||
@ -198,6 +200,7 @@
|
||||
<Compile Include="Utils\Helpers.Versions.cs" />
|
||||
<Compile Include="Utils\StringExtensions.cs" />
|
||||
<Compile Include="Utils\TimeSpanExtensions.cs" />
|
||||
<Compile Include="Actions\NRPE\NRPEHostConfiguration.cs" />
|
||||
<Compile Include="WLB\WlbPoolConfiguration.cs" />
|
||||
<Compile Include="WLB\WlbReportInfo.cs" />
|
||||
<Compile Include="WLB\WlbReportSubscription.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user