[0-9]+)""},";
if (consumption != null)
{
@@ -229,7 +229,7 @@ public void OpenHardwareMonitorEngine(object? sender, DoWorkEventArgs e)
if (DateTime.Now >= uploadTime)
{
- Console.WriteLine("[INFO] " + DateTime.Now.ToString() + ": OpenHardwareMonitor module is writing logs..." + "\r");
+ Console.WriteLine("[INFO] " + DateTime.Now.ToString() + ": LibreHardwareMonitor module is writing logs..." + "\r");
bool todayLineExist = false;
for (int i = 0; i < lines.Count; i++)
{
@@ -256,7 +256,7 @@ public void OpenHardwareMonitorEngine(object? sender, DoWorkEventArgs e)
Thread.Sleep(int.Parse(_config["COLLECT_INFO_PERIOD"].ToString()) * 1000);
}
}
- _openHardwareMonitorEngine = false;
+ _LibreHardwareMonitorEngine = false;
}
public void Stop()
@@ -265,11 +265,11 @@ public void Stop()
Console.WriteLine("[INFO] " + DateTime.Now.ToString() + ": Stopping engines" + "\r");
_service.CancelAsync();
- _openHardwareMonitor.CancelAsync();
+ _LibreHardwareMonitor.CancelAsync();
while (
(_serviceEngine != true) &&
(_saveEngine != true) &&
- (_openHardwareMonitorEngine == true)
+ (_LibreHardwareMonitorEngine == true)
) Thread.Sleep(1000);
Thread.Sleep(1000);
diff --git a/Project/GreenIT/LibreHardwareMonitor/LibreHardwareMonitorModel.cs b/Project/GreenIT/LibreHardwareMonitor/LibreHardwareMonitorModel.cs
new file mode 100644
index 0000000..cd7e792
--- /dev/null
+++ b/Project/GreenIT/LibreHardwareMonitor/LibreHardwareMonitorModel.cs
@@ -0,0 +1,36 @@
+using LibreHardwareMonitor.Hardware;
+using System.Text.Json.Nodes;
+
+namespace GreenIT.LibreHardwareMonitor
+{
+ public static class LibreHardwareMonitorModel
+ {
+ private static readonly UpdateVisitor _visitor = new();
+ private static readonly Computer _computer = new();
+ public static JsonObject GetConsumption()
+ {
+ JsonObject consumption = new();
+ _computer.Open();
+ _computer.IsCpuEnabled = true;
+ _computer.Accept(_visitor);
+ foreach (IHardware hardware in _computer.Hardware)
+ {
+ foreach (ISensor sensor in hardware.Sensors)
+ {
+ if(sensor.SensorType == SensorType.Power && sensor.Name == "Package")
+ {
+ consumption.Add("EXIST", true);
+ consumption.Add("DATE", DateTime.Now.ToString("yyyy-MM-dd"));
+ if (sensor.Value > 50000) consumption.Add("CONSUMPTION", "VM detected");
+ else
+ {
+ consumption.Add("CONSUMPTION", sensor.Value.ToString().Replace(",", "."));
+ }
+ }
+ }
+ }
+ _computer.Close();
+ return consumption;
+ }
+ }
+}
diff --git a/Project/GreenIT/OpenHardwareMonitor/UpdateVisitor.cs b/Project/GreenIT/LibreHardwareMonitor/UpdateVisitor.cs
similarity index 92%
rename from Project/GreenIT/OpenHardwareMonitor/UpdateVisitor.cs
rename to Project/GreenIT/LibreHardwareMonitor/UpdateVisitor.cs
index 83731b9..4bff7f6 100644
--- a/Project/GreenIT/OpenHardwareMonitor/UpdateVisitor.cs
+++ b/Project/GreenIT/LibreHardwareMonitor/UpdateVisitor.cs
@@ -1,4 +1,4 @@
-using OpenHardwareMonitor.Hardware;
+using LibreHardwareMonitor.Hardware;
namespace GreenIT
{
diff --git a/Project/GreenIT/OpenHardwareMonitor/OpenHardwareMonitorModel.cs b/Project/GreenIT/OpenHardwareMonitor/OpenHardwareMonitorModel.cs
deleted file mode 100644
index 2fa3d99..0000000
--- a/Project/GreenIT/OpenHardwareMonitor/OpenHardwareMonitorModel.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-using OpenHardwareMonitor.Hardware;
-using System.Text.Json.Nodes;
-
-namespace GreenIT.OpenHardwareMonitor
-{
- public static class OpenHardwareMonitorModel
- {
- private static readonly UpdateVisitor _visitor = new();
- private static readonly Computer _computer = new();
- public static JsonObject GetConsumption()
- {
- JsonObject consumption = new();
- _computer.Open();
- _computer.CPUEnabled = true;
- _computer.Accept(_visitor);
- for (int i = 0; i < _computer.Hardware.Length; i++)
- {
- if (_computer.Hardware[i].HardwareType == HardwareType.CPU)
- {
- for (int j = 0; j < _computer.Hardware[i].Sensors.Length; j++)
- {
- if ((_computer.Hardware[i].Sensors[j].SensorType == SensorType.Power) && (_computer.Hardware[i].Sensors[j].Name == "Package Power"))
- {
- consumption.Add("EXIST", true);
- consumption.Add("DATE", DateTime.Now.ToString("yyyy-MM-dd"));
- if (_computer.Hardware[i].Sensors[j].Value > 50000) consumption.Add("CONSUMPTION", "VM detected");
- else
- {
- consumption.Add("CONSUMPTION", _computer.Hardware[i].Sensors[j].Value.ToString().Replace(',', '.'));
- }
- }
- }
- }
- }
- _computer.Close();
- return consumption;
- }
- }
-}
diff --git a/Project/GreenIT/greenit.ico b/Project/GreenIT/greenit.ico
new file mode 100644
index 0000000..7bc7303
Binary files /dev/null and b/Project/GreenIT/greenit.ico differ
diff --git a/Project/GreenIT/ocs-icon.ico b/Project/GreenIT/ocs-icon.ico
deleted file mode 100644
index 17b1acb..0000000
Binary files a/Project/GreenIT/ocs-icon.ico and /dev/null differ
diff --git a/README.md b/README.md
index 9a432eb..49a045c 100644
--- a/README.md
+++ b/README.md
@@ -7,62 +7,15 @@
Service GreenIT
Some Links :
- Ask question |
- Website |
- OCS Professional
+ Ask question |
+ Website |
+ OCS Professional
## Description
-
Currently supported on Windows, this service is made to gather power consumption information.
-> _**IMPORTANT NOTE : This service is required if you use GreenIT Plugin downloadable here**_
-
-## Prerequisites
-
-> _NOTE : Every agents which have the service installed can return GreenIT data._
-
-- Windows 10
+> _**IMPORTANT NOTE : This service is required if you use GreenIT Plugin downloadable here**_
## Installation
-
-To install the service on your agents :
-
-- Download the service here to get the executable and start it.
-
-- Go to the config page :
-
-
-
-
-
-- Configuration :
-
- - The period between collecting information is a time in seconds that will allow the service to start colecting information.
-
- > _Example : if you put it to 5, it will collect information every 5 seconds._
-
- - The period between upload is a time in minutes that will allow the service to write information collected into the data file _(C:\\ProgramData\GreenIT\data.json)_
-
- > _Example : if you put it to 5, it will write information into data file every 5 minutes.
- > **If you put it to 0, it will write information in data file each data collect.**_
-
- > _NOTE : "C:\\ProgramData" is an unvisible folder._
-
- - The period between saves is a time in hours that will allow the service to create a ".bak" file next to data file to don't lose your last data.
-
- > _Example : if you put it to 5, it will create/update the backup file every 5 hours._
-
-- Click on install and don't forget to check "Run GreenIT Service 1.0" at the end.
-
-> _IMPORTANT NOTE : It is important to check "Run GreenIT Service 1.0" to install the software as a Windows service !_
-
-- If you haven't checked the box, you can install it manually after the install of the software :
- - Open a terminal and go in the software installation folder path.
- - Run the command `.\GreenIT.exe install` and wait until the plugin is installed.
-
-And yes, that's all :-)
-
-## For developers
-
-All the documentation for developers can be found [here](https://github.com/OCSInventory-NG/Wiki/tree/master/english/04.Management-console-and-its-advanced-features/GreenIT-service-developers.md)
+There is a documentation to help you to clearly install the plugin and his dependencies available here.
\ No newline at end of file
diff --git a/images/GreenIT_configuration.png b/images/GreenIT_configuration.png
deleted file mode 100644
index 1ec7696..0000000
Binary files a/images/GreenIT_configuration.png and /dev/null differ