Beispiel #1
0
        private static void doZabbix(string zbxServer, string ourHostname, hypervisor_iLo_HTTP hyp)
        {
            bool powerStatus           = hyp.getPowerStatus();
            int  powerUse              = hyp.getCurrentPowerUseW();
            ilo_resp_healthfans  fans  = hyp.getHealthOfFans();
            ilo_resp_healthPSUs  psus  = hyp.getHealthOfPSUs();
            ilo_resp_healthtemps temps = hyp.getHealthOfTemps();

            Sender sender = new Ysq.Zabbix.Sender(zbxServer);

            // Send the discovery item a list of the data we have..
            sender.Send(ourHostname, "fanList", makeFanListJSON(fans), 2500);
            sender.Send(ourHostname, "psuList", makePSUListJSON(psus), 2500);
            sender.Send(ourHostname, "tempList", makeTempListJSON(temps), 2500);

            // and then send the data.
            sender.Send(ourHostname, "powerState", powerStatus ? "1" : "0");
            sender.Send(ourHostname, "powerUse", powerUse.ToString());
            foreach (ilo_resp_healthfan fan in fans.fans)
            {
                sender.Send(ourHostname, "fanspeed[" + fan.label + "]", fan.speed);
            }
            foreach (ilo_resp_healthPSU psu in psus.power_supplies)
            {
                sender.Send(ourHostname, "psustatus[" + psu.label + "]", psu.status);
            }
            foreach (ilo_resp_healthtemp temp in temps.temperature)
            {
                sender.Send(ourHostname, "cautionTemp[" + temp.label + "]", temp.caution.ToString());
                sender.Send(ourHostname, "currentTemp[" + temp.label + "]", temp.currentreading.ToString());
                sender.Send(ourHostname, "criticalTemp[" + temp.label + "]", temp.critical.ToString());
            }
        }
 public override void startBladePowerOff(lockableBladeSpec nodeSpec, cancellableDateTime deadline)
 {
     using (hypervisor_iLo_HTTP hyp = new hypervisor_iLo_HTTP(nodeSpec.spec.iLOIP, Settings.Default.iloUsername, Settings.Default.iloPassword))
     {
         hyp.connect();
         while (true)
         {
             hyp.powerOff();
             if (hyp.getPowerStatus() == false)
             {
                 break;
             }
             deadline.doCancellableSleep(TimeSpan.FromSeconds(5));
         }
     }
 }
Beispiel #3
0
        private static void _Main(hyptoolargs args)
        {
            using (hypervisor_iLo_HTTP hyp = new hypervisor_iLo_HTTP(args.hypIP, args.hypUsername, args.hypPassword))
            {
                hyp.retries = args.retries;
                hyp.connect();
                switch (args.action)
                {
                case hypervisorAction.powerOn:
                    hyp.powerOn();
                    break;

                case hypervisorAction.powerOff:
                    hyp.powerOff();
                    break;

                case hypervisorAction.getPowerStatus:
                    if (hyp.getPowerStatus())
                    {
                        Console.WriteLine(args.numeric ? "1" : "ON");
                    }
                    else
                    {
                        Console.WriteLine(args.numeric ? "0" : "OFF");
                    }
                    break;

                case hypervisorAction.getPowerUse:
                    Console.WriteLine(hyp.getCurrentPowerUseW());
                    break;

                case hypervisorAction.updateZabbix:
                    doZabbix(args.zabbixServer.Trim(), args.zabbixHostname.Trim(), hyp);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
        }