Accepted Solution

FAS 2552 - monitor temperature with C#


I plan to develope a small C# program to monitor temperatures as measured by chassis sensors.

I downloaded the SDK but it seems too complicated for me...

For now I can obtain the desired info by connecting through SSH (using SSH.NET library) and submitting the following command :

system node run -node local -command environment status chassis

The next step is to create a loop and execute the command every, let's say, 10 minutes: do you think this could become a performance problem for the 2552? I don't know the library details and i assume it flawless implement the SSH protocol (disconnetting properly for example), I hope not to kill my storage with this approach...


Here is my first functioning C# prototype:

static void Main(string[] args)
	using (var client = new SshClient("my2552_ip_address", "user", "password"))
		SshCommand command = client.RunCommand("system node run -node local -command environment status chassis");
		string result = command.Result;
		string s1 = result.Substring(result.IndexOf("Ambient Temp"));
		int index = s1.IndexOf(Environment.NewLine);
		s1 = s1.Substring(0, index);
		string[] token = System.Text.RegularExpressions.Regex.Split(s1, @"\s+");
		string state = token[2];
		string currentReading = token[3];
		Console.WriteLine("Temperatute status: " + state);
		Console.WriteLine("Temperatute current value (°C): " + currentReading);

Thank you!!

Re: FAS 2552 - monitor temperature with C#

[ Edited ]



Without too much effort, you can have something running quickly.

Just add dll ManageOntap in project references.


Here is an zapi example:


using System;
using System.Collections.Generic;
using System.Text;
using NetApp.Manage;

namespace ConsoleApp1
    class Program
        static void Main(string[] args)
            NaServer s = new NaServer("filer", 1, 0);

            s.ServerType = NaServer.SERVER_TYPE.FILER;
            s.TransportType = NaServer.TRANSPORT_TYPE.HTTPS;
            s.Port = 443;
            s.Style = NaServer.AUTH_STYLE.LOGIN_PASSWORD;
            s.SetAdminUser(@"user", "pass");

            NaElement api = new NaElement("environment-sensors-get-iter");

            NaElement xi = new NaElement("desired-attributes");


            NaElement xi1 = new NaElement("environment-sensors-info");
            xi1.AddNewChild("node-name", "<node-name>");
            xi1.AddNewChild("sensor-name", "<sensor-name>");
            xi1.AddNewChild("sensor-type", "<sensor-type>");
            xi1.AddNewChild("threshold-sensor-state", "<threshold-sensor-state>");
            xi1.AddNewChild("threshold-sensor-value", "<threshold-sensor-value>");
            xi1.AddNewChild("value-units", "<value-units>");

            NaElement xo = s.InvokeElem(api);

            NaElement results = xo.GetChildByName("attributes-list");
            System.Collections.IList resultslist = results.GetChildren();

            foreach (NaElement result in resultslist)
                Console.WriteLine("{0}: {1}", result.GetChildContent("sensor-name"), result.GetChildContent("threshold-sensor-value"));



I don't think that coud be a performance problem, regarding of number of requests, in comparaison, Oncommand  Unified Manager make by minutes.

Re: FAS 2552 - monitor temperature with C#


thank you for the fast response

I'm very new to the Netapp sdk: I've downloaded the "netapp-manageability-sdk-5.6-dotnet-bindings" and I cannot find the dll you mentioned, I can only find "netapp-manage.dll"; could you provide a link to download the one you are speaking about or provide an example with the sdk I found?

Thank you!!

Re: FAS 2552 - monitor temperature with C#



It's not necessary to use the .NET binding in the first step.

Just add netapp-manageability-sdk-5.6\lib\DotNet\ManageOntap.dll 




add in your project:

using NetApp.Manage;


Next you have to deal with NaServer for connection/auth and NaElement Class.



For an example of , you can use



You can directly generate code from there






Re: FAS 2552 - monitor temperature with C#

Thank you François

now I can use the API you provided.

I developed a small windows service that queries the sensors, saves the temperature in a database and sends hi temperature alarm and daily report by emails.

Thank you for your valuable support