Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. [Frage] ioBroker - iLO Server Daten auslesen

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    [Frage] ioBroker - iLO Server Daten auslesen

    This topic has been deleted. Only users with topic management privileges can see it.
    • Dutchman
      Dutchman Developer Most Active Administrators last edited by

      @nobse:

      Wie meinst du das
      > diese Werte als object im Baum weg zu schreiben wo auch die Daten stehen `

      Dein Script erstellt objecte und füllt diese mit Werten.

      Mein Vorschlag würde dies auch Max Werte machen wodurch wir zB den alarmwert (zb 70 Grad) per vis ändern könnten.

      Dan muss man nicht immer ins Script um diese Werte zu setzen

      –-----------------------

      Send from mobile device

      1 Reply Last reply Reply Quote 0
      • N
        nobse last edited by

        Wenn ich dich richtig verstehe im script noch einen Datenpunkt anlegen mit dem max wert.

        Das wollte ich ja machen und den max wert aus der hardware lesen.

        Oder stehe ich jetzt auf dem Schlauch. 😄

        1 Reply Last reply Reply Quote 0
        • Dutchman
          Dutchman Developer Most Active Administrators last edited by

          @nobse:

          Wenn ich dich richtig verstehe im script noch einen Datenpunkt anlegen mit dem max wert.

          Das wollte ich ja machen und den max wert aus der hardware lesen.

          Oder stehe ich jetzt auf dem Schlauch. 😄 `

          Nope ich hab dich falsch verstanden sieht gut aus weiter so [emoji3]

          –-----------------------

          Send from mobile device

          1 Reply Last reply Reply Quote 0
          • N
            nobse last edited by

            Muss man den Max Werte den Editieren können?

            Eigentlich reicht es wenn abgefragt wird ob der aktuelle Wert >= dem max wert ist und dann eine Benachrichtigung sendet oder?

            1 Reply Last reply Reply Quote 0
            • Dutchman
              Dutchman Developer Most Active Administrators last edited by

              @nobse:

              Eigentlich reicht es wenn abgefragt wird ob der aktuelle Wert >= dem max wert ist und dann eine Benachrichtigung sendet oder? `

              Jup, erschien mir nur praktisch die Variable zB aus vis oder anderen scripten ändern zu können.

              –-----------------------

              Send from mobile device

              1 Reply Last reply Reply Quote 0
              • N
                nobse last edited by

                OK habe das jetzt mal eingebaut

                • Script ruft sich nicht mehr selber alle xx Sekunden auf sondern über Function schedule

                • über writeLog kann Logeinträge Ein/Aus geschaltet werden

                • Datenpunkte xx_max werden angelegt und mit Werten gefüllt

                • aufruf Function isFehler prüft temp_ist >= temp-max und sendet Benachrichtigung (Fehlt noch)

                Was für Benachrichtigungen sind gewünscht?

                var server = "192.168.133.xx";
                var username = "x";
                var password = "x";
                var writeLog = false;
                
                var runs = 0;
                
                var instanz = 'javascript.' + instance;
                var pfad = '.iLO.';
                
                var request = require('request');
                
                function ilo(url, next, log){
                   url = "https://"+server+url;
                   request.timeout = 60000;
                   request({
                      "timeout": request.timeout,
                      "rejectUnauthorized": false, 
                      "url": url, 
                      "method": "GET", 
                      "headers":
                      {
                         "Content-Type": "application/json",
                         "Accept": "application/json",
                         "Authorization": "BASIC " + new Buffer(username+":"+password).toString('base64')
                      }
                   }, function(err, response, body){
                      if (log) console.log("\n => "+url+" <=\n"+body+"\n");
                      if (err) console.log(err+": "+url);
                      else if (response.statusCode != 200) console.log(response.statusCode+": "+url);
                      else if (next) next(JSON.parse(body));
                   });
                }
                
                function now() { return new Date().toISOString().replace(/T/, ' ').replace(/\..+/, ''); }
                
                function ping(){
                   ilo("/rest/v1/Chassis/1/Thermal", function(body){
                      var date = new Date();
                      var log = now();
                      if (runs++ == 0)      {
                         for (var f in body.Fans) {
                             var fan = body.Fans[f];
                             log += ", "+fan.FanName+" ["+fan.Units+"]";
                             createState(instanz + pfad + fan.FanName.replace(/ /g, '_'), {
                                name: fan.PhysicalContext, 
                                desc: fan.PhysicalContext,
                                type: 'number', 
                                def:  0,
                                read: true,
                                write: true,
                                role: 'value'  
                            }); 
                
                         }
                         for (var t in body.Temperatures) { var temp = body.Temperatures[t]; log += ", "+temp.Name+" ["+temp.Units+"]"; 
                            createState(instanz + pfad + temp.Name.replace(/ /g, '_'), {
                                name: temp.PhysicalContext, 
                                desc: temp.PhysicalContext,
                                type: 'number', 
                                def:  0,
                                read: true,
                                write: true,
                                role: 'value'  
                            });  
                
                            createState(instanz + pfad + temp.Name.replace(/ /g, '_') + "_max", {
                                name: temp.PhysicalContext + "_max", 
                                desc: temp.PhysicalContext + "_max",
                                type: 'number', 
                                def:  temp.LowerThresholdNonCritical,
                                read: true,
                                write: true,
                                role: 'value'  
                            });  
                
                         }
                         if (writeLog === true){
                             console.log(log);
                            log = now();
                         }
                      }
                
                        for (var f in body.Fans) {
                          var fan = body.Fans[f];
                          log += ", "+fan.CurrentReading;
                          setState(instanz + pfad + fan.FanName.replace(/ /g, '_'), fan.CurrentReading);
                        }
                        for (var t in body.Temperatures) {
                          var temp = body.Temperatures[t];
                          log += ", "+temp.CurrentReading;
                          setState(instanz + pfad + temp.Name.replace(/ /g, '_'), temp.CurrentReading);
                          isFehler(getState(instanz + pfad + temp.Name.replace(/ /g, '_') + "_max"),temp.CurrentReading)
                        }
                
                        if (writeLog === true){
                            console.log(log);
                        }
                   }, !true);
                }
                
                function isFehler(temp_max,temp_aktuell){
                    if (temp_aktuell >= temp_max){
                        console.log("max = " + temp_max.val);
                        console.log("ist = " + temp_aktuelle);
                        //Benachrichtigung Einbauen
                    }
                }
                
                //Script läuft alle 2 Minuten
                schedule("*/2 * * * *", function () {
                    console.log("===> Start ILO");
                    ping();
                });
                ping();
                
                1 Reply Last reply Reply Quote 0
                • kmxak
                  kmxak Most Active last edited by

                  naja nun geht es ja schon richtung adapter.

                  Zur Auswahl stehen bei mir. Als ersten Telegram (da sehr schnell die info kommt) oder email aber die schaut man ja auch nicht immer nach.

                  Für die Leute die den z.B HP Gen 8 mit einem anderen CPU ausgestattet haben gehen aber die ausgelesenen Temp werte nicht oder? Oder werden die beim CPU wechsel auch im iLO aktualisiert?

                  Außer CPU brauche ich keine Max Werte ändern.

                  Die Warnung möchte ich allerding schon haben bevor die Max Temp erreicht wird. Quasi Grün er Bereich dann Oragnener mit Warnung und Rot mit ggf Shutdown später o.ä.

                  In den History Adapter werde ich ihn auf jeden fall auch einfügen dann kann ich mir das mal genauer ansehen.

                  Leider steht der Server bei mir unter dem Dachboden 😢 Ich habe bestimmt 26° aktuell hier …. und es nicht mal richtig sommer

                  1 Reply Last reply Reply Quote 0
                  • N
                    nobse last edited by

                    So habe mal die Mailbenachrichtigung eingebaut.

                    Kann einer von euch mal den Code für Telegramm einbauen. Ich habe so was nicht. Kommt in die Function isFehler in die entsprechende If abfrage.

                    var server = "192.168.133.x";
                    var username = "x";
                    var password = "x";
                    var emailadresse = "x";  //E-Mailadresse für Benachrichtigung
                    
                    var writeLog = false;
                    var benachrichtigung_per_email = false;
                    var benachrichtigung_per_telegramm = false
                    
                    var runs = 0;
                    
                    var instanz = 'javascript.' + instance;
                    var pfad = '.iLO.';
                    
                    var request = require('request');
                    
                    function ilo(url, next, log){
                       url = "https://"+server+url;
                       request.timeout = 60000;
                       request({
                          "timeout": request.timeout,
                          "rejectUnauthorized": false, 
                          "url": url, 
                          "method": "GET", 
                          "headers":
                          {
                             "Content-Type": "application/json",
                             "Accept": "application/json",
                             "Authorization": "BASIC " + new Buffer(username+":"+password).toString('base64')
                          }
                       }, function(err, response, body){
                          if (log) console.log("\n => "+url+" <=\n"+body+"\n");
                          if (err) console.log(err+": "+url);
                          else if (response.statusCode != 200) console.log(response.statusCode+": "+url);
                          else if (next) next(JSON.parse(body));
                       });
                    }
                    
                    function now() { return new Date().toISOString().replace(/T/, ' ').replace(/\..+/, ''); }
                    
                    function ping(){
                       ilo("/rest/v1/Chassis/1/Thermal", function(body){
                          var date = new Date();
                          var log = now();
                          if (runs++ === 0)      {
                              createState(instanz + pfad + "iLO_Status", {
                                    name: "iLO_Status", 
                                    desc: "iLO_Status Gesamt",
                                    type: 'boolean', 
                                    def:  false,
                                    read: true,
                                    write: true,
                                    role: ''
                                }); 
                    
                             for (var f in body.Fans) {
                                 var fan = body.Fans[f];
                                 log += ", "+fan.FanName+" ["+fan.Units+"]";
                                 createState(instanz + pfad + fan.FanName.replace(/ /g, '_'), {
                                    name: fan.PhysicalContext, 
                                    desc: fan.PhysicalContext,
                                    type: 'number', 
                                    def:  0,
                                    read: true,
                                    write: true,
                                    role: 'value'  
                                }); 
                    
                             }
                             for (var t in body.Temperatures) { var temp = body.Temperatures[t]; log += ", "+temp.Name+" ["+temp.Units+"]"; 
                                createState(instanz + pfad + temp.Name.replace(/ /g, '_'), {
                                    name: temp.PhysicalContext, 
                                    desc: temp.PhysicalContext,
                                    type: 'number', 
                                    def:  0,
                                    read: true,
                                    write: true,
                                    role: 'value'  
                                });  
                    
                                createState(instanz + pfad + temp.Name.replace(/ /g, '_') + "_max", {
                                    name: temp.PhysicalContext + "_max", 
                                    desc: temp.PhysicalContext + "_max",
                                    type: 'number', 
                                    def:  temp.LowerThresholdNonCritical,
                                    read: true,
                                    write: true,
                                    role: 'value'  
                                });  
                    
                            }
                            if (writeLog === true){
                                console.log(log);
                                log = now();
                            }
                          }
                    
                            for (var f in body.Fans) {
                                var fan = body.Fans[f];
                                log += ", "+fan.CurrentReading;
                                setState(instanz + pfad + fan.FanName.replace(/ /g, '_'), fan.CurrentReading);
                            }
                    
                            for (var t in body.Temperatures) {
                                var temp = body.Temperatures[t];
                                log += ", "+temp.CurrentReading;
                                setState(instanz + pfad + temp.Name.replace(/ /g, '_'), temp.CurrentReading);
                                isFehler(temp);
                            }
                    
                            if (writeLog === true){
                                console.log(log);
                            }
                        }, !true);
                    }
                    
                    function isFehler(temp){
                    
                        var max = getState(instanz + pfad + temp.Name.replace(/ /g, '_') + "_max");
                        var aktuell = temp.CurrentReading;
                        if (aktuell >= max){
                    
                            setState(instanz + pfad + "iLO_Status", true);
                    
                            if (benachrichtigung_per_email === true){
                                sendTo("email", {
                                    to:      emailadresse,
                                    subject: "Temperatur Warnung!!",
                                    text:    "Aktuelle Temperatur " + temp.Name + " = " + aktuell + " Grad Celsius."
                                });
                            }
                    
                            if (benachrichtigung_per_telegramm === true){
                    
                            } 
                        }
                    }
                    
                    //Script läuft alle 2 Minuten
                    schedule("*/2 * * * *", function () {
                        console.log("===> Start ILO");
                        ping();
                    });
                    
                    1 Reply Last reply Reply Quote 0
                    • kmxak
                      kmxak Most Active last edited by

                      Hier mal ein Script was funktionieren sollte mit Telegram:

                      Leider bekomme ich weder in Telegram noch per Mail was.

                      Ich habe nun 2 Max Werte auf 10° gesetzt das sollte doch dann sofort die Benachrichtigung auslösen oder?

                      Lösen die nicht installieten Temp Fühler mit Wert 0 und Max 0 auch die Benachrichtigung aus?

                      var server = "192.168.133.x";
                      var username = "x";
                      var password = "x";
                      var emailadresse = "x";  //E-Mailadresse für Benachrichtigung
                      var writeLog = true;
                      var benachrichtigung_per_email = true;
                      var benachrichtigung_per_telegramm = true; // hier hattest du kein ; das war falsch oder?
                      
                      var runs = 0;
                      
                      var instanz = 'javascript.' + instance;
                      var pfad = '.iLO.';
                      
                      var request = require('request');
                      
                      function ilo(url, next, log){
                         url = "https://"+server+url;
                         request.timeout = 60000;
                         request({
                            "timeout": request.timeout,
                            "rejectUnauthorized": false, 
                            "url": url, 
                            "method": "GET", 
                            "headers":
                            {
                               "Content-Type": "application/json",
                               "Accept": "application/json",
                               "Authorization": "BASIC " + new Buffer(username+":"+password).toString('base64')
                            }
                         }, function(err, response, body){
                            if (log) console.log("\n => "+url+" <=\n"+body+"\n");
                            if (err) console.log(err+": "+url);
                            else if (response.statusCode != 200) console.log(response.statusCode+": "+url);
                            else if (next) next(JSON.parse(body));
                         });
                      }
                      
                      function now() { return new Date().toISOString().replace(/T/, ' ').replace(/\..+/, ''); }
                      
                      function ping(){
                         ilo("/rest/v1/Chassis/1/Thermal", function(body){
                            var date = new Date();
                            var log = now();
                            if (runs++ === 0)      {
                                createState(instanz + pfad + "iLO_Status", {
                                      name: "iLO_Status", 
                                      desc: "iLO_Status Gesamt",
                                      type: 'boolean', 
                                      def:  false,
                                      read: true,
                                      write: true,
                                      role: ''
                                  }); 
                      
                               for (var f in body.Fans) {
                                   var fan = body.Fans[f];
                                   log += ", "+fan.FanName+" ["+fan.Units+"]";
                                   createState(instanz + pfad + fan.FanName.replace(/ /g, '_'), {
                                      name: fan.PhysicalContext, 
                                      desc: fan.PhysicalContext,
                                      type: 'number', 
                                      def:  0,
                                      read: true,
                                      write: true,
                                      role: 'value'  
                                  }); 
                      
                               }
                               for (var t in body.Temperatures) { var temp = body.Temperatures[t]; log += ", "+temp.Name+" ["+temp.Units+"]"; 
                                  createState(instanz + pfad + temp.Name.replace(/ /g, '_'), {
                                      name: temp.PhysicalContext, 
                                      desc: temp.PhysicalContext,
                                      type: 'number', 
                                      def:  0,
                                      read: true,
                                      write: true,
                                      role: 'value'  
                                  });  
                      
                                  createState(instanz + pfad + temp.Name.replace(/ /g, '_') + "_max", {
                                      name: temp.PhysicalContext + "_max", 
                                      desc: temp.PhysicalContext + "_max",
                                      type: 'number', 
                                      def:  temp.LowerThresholdNonCritical,
                                      read: true,
                                      write: true,
                                      role: 'value'  
                                  });  
                      
                              }
                              if (writeLog === true){
                                  console.log(log);
                                  log = now();
                              }
                            }
                      
                              for (var f in body.Fans) {
                                  var fan = body.Fans[f];
                                  log += ", "+fan.CurrentReading;
                                  setState(instanz + pfad + fan.FanName.replace(/ /g, '_'), fan.CurrentReading);
                              }
                      
                              for (var t in body.Temperatures) {
                                  var temp = body.Temperatures[t];
                                  log += ", "+temp.CurrentReading;
                                  setState(instanz + pfad + temp.Name.replace(/ /g, '_'), temp.CurrentReading);
                                  isFehler(temp);
                              }
                      
                              if (writeLog === true){
                                  console.log(log);
                              }
                          }, !true);
                      }
                      
                      function isFehler(temp){
                      
                          var max = getState(instanz + pfad + temp.Name.replace(/ /g, '_') + "_max");
                          var aktuell = temp.CurrentReading;
                          if (aktuell >= max){
                      
                              setState(instanz + pfad + "iLO_Status", true);
                      
                              if (benachrichtigung_per_email === true){
                                  sendTo("email", {
                                      to:      emailadresse,
                                      subject: "Temperatur Warnung!!",
                                      text:    "Aktuelle Temperatur " + temp.Name + " = " + aktuell + " Grad Celsius."
                                  });
                              }
                      
                              if (benachrichtigung_per_telegramm === true){
                                 sendTo("telegram.0", "send", {
                                     text:    "Aktuelle Temperatur " + temp.Name + " = " + aktuell + " Grad Celsius."  // um die Nachricht nur an Teilnehme xy zu schicken folgendes anfügen , chatId: 'xxx'
                                  });
                              } 
                          }
                      }
                      
                      //Script läuft alle 2 Minuten
                      schedule("*/2 * * * *", function () {
                          console.log("===> Start ILO");
                          ping();
                      });
                      
                      1 Reply Last reply Reply Quote 0
                      • N
                        nobse last edited by

                        Ah ja da gebe ich dir recht das es nicht geht.

                        Andere mal die Zeile

                        if (aktuell >= max){
                        

                        in

                        if (aktuell > max.val){
                        
                        1 Reply Last reply Reply Quote 0
                        • kmxak
                          kmxak Most Active last edited by

                          Jawohl es geht!

                          Nochmal den Text etwas angepasst.

                          Er sendet nun aber alle 2 Minuten eine Benachrichtigung solange die Temperatur zu hoch ist.

                          Kann man das irgendwie nur einmal machen? Sonst wirst du voll gespammt 8-)

                          var server = "192.168.133.x";
                          var username = "x";
                          var password = "x";
                          var emailadresse = "x";  //E-Mailadresse für Benachrichtigungvar writeLog = true;
                          var benachrichtigung_per_email = false;
                          var benachrichtigung_per_telegramm = true; // hier hattest du kein ; das war falsch oder?
                          
                          var runs = 0;
                          
                          var instanz = 'javascript.' + instance;
                          var pfad = '.iLO.';
                          
                          var request = require('request');
                          
                          function ilo(url, next, log){
                             url = "https://"+server+url;
                             request.timeout = 60000;
                             request({
                                "timeout": request.timeout,
                                "rejectUnauthorized": false, 
                                "url": url, 
                                "method": "GET", 
                                "headers":
                                {
                                   "Content-Type": "application/json",
                                   "Accept": "application/json",
                                   "Authorization": "BASIC " + new Buffer(username+":"+password).toString('base64')
                                }
                             }, function(err, response, body){
                                if (log) console.log("\n => "+url+" <=\n"+body+"\n");
                                if (err) console.log(err+": "+url);
                                else if (response.statusCode != 200) console.log(response.statusCode+": "+url);
                                else if (next) next(JSON.parse(body));
                             });
                          }
                          
                          function now() { return new Date().toISOString().replace(/T/, ' ').replace(/\..+/, ''); }
                          
                          function ping(){
                             ilo("/rest/v1/Chassis/1/Thermal", function(body){
                                var date = new Date();
                                var log = now();
                                if (runs++ === 0)      {
                                    createState(instanz + pfad + "iLO_Status", {
                                          name: "iLO_Status", 
                                          desc: "iLO_Status Gesamt",
                                          type: 'boolean', 
                                          def:  false,
                                          read: true,
                                          write: true,
                                          role: ''
                                      }); 
                          
                                   for (var f in body.Fans) {
                                       var fan = body.Fans[f];
                                       log += ", "+fan.FanName+" ["+fan.Units+"]";
                                       createState(instanz + pfad + fan.FanName.replace(/ /g, '_'), {
                                          name: fan.PhysicalContext, 
                                          desc: fan.PhysicalContext,
                                          type: 'number', 
                                          def:  0,
                                          read: true,
                                          write: true,
                                          role: 'value'  
                                      }); 
                          
                                   }
                                   for (var t in body.Temperatures) { var temp = body.Temperatures[t]; log += ", "+temp.Name+" ["+temp.Units+"]"; 
                                      createState(instanz + pfad + temp.Name.replace(/ /g, '_'), {
                                          name: temp.PhysicalContext, 
                                          desc: temp.PhysicalContext,
                                          type: 'number', 
                                          def:  0,
                                          read: true,
                                          write: true,
                                          role: 'value'  
                                      });  
                          
                                      createState(instanz + pfad + temp.Name.replace(/ /g, '_') + "_max", {
                                          name: temp.PhysicalContext + "_max", 
                                          desc: temp.PhysicalContext + "_max",
                                          type: 'number', 
                                          def:  temp.LowerThresholdNonCritical,
                                          read: true,
                                          write: true,
                                          role: 'value'  
                                      });  
                          
                                  }
                                  if (writeLog === true){
                                      console.log(log);
                                      log = now();
                                  }
                                }
                          
                                  for (var f in body.Fans) {
                                      var fan = body.Fans[f];
                                      log += ", "+fan.CurrentReading;
                                      setState(instanz + pfad + fan.FanName.replace(/ /g, '_'), fan.CurrentReading);
                                  }
                          
                                  for (var t in body.Temperatures) {
                                      var temp = body.Temperatures[t];
                                      log += ", "+temp.CurrentReading;
                                      setState(instanz + pfad + temp.Name.replace(/ /g, '_'), temp.CurrentReading);
                                      isFehler(temp);
                                  }
                          
                                  if (writeLog === true){
                                      console.log(log);
                                  }
                              }, !true);
                          }
                          
                          function isFehler(temp){
                          
                              var max = getState(instanz + pfad + temp.Name.replace(/ /g, '_') + "_max");
                              var aktuell = temp.CurrentReading;
                              if (aktuell > max.val){
                          
                                  setState(instanz + pfad + "iLO_Status", true);
                          
                                  if (benachrichtigung_per_email === true){
                                      sendTo("email", {
                                          to:      emailadresse,
                                          subject: "Temperatur Warnung!!",
                                          text:    "Aktuelle Temperatur " + temp.Name + " = " + aktuell + " Grad Celsius."
                                      });
                                  }
                          
                                  if (benachrichtigung_per_telegramm === true){
                                     sendTo("telegram.1", "send", {
                                         text:    "iLO Temperatur Warnung!! Aktuelle Temperatur " + temp.Name + " = " + aktuell + " Grad Celsius."  // um die Nachricht nur an Teilnehme xy zu schicken folgendes anfügen , chatId: 'xxx'
                                      });
                                  } 
                              }
                          }
                          
                          //Script läuft alle 2 Minuten
                          schedule("*/2 * * * *", function () {
                              console.log("===> Start ILO");
                              ping();
                          });
                          
                          1 Reply Last reply Reply Quote 0
                          • kmxak
                            kmxak Most Active last edited by

                            was ich gerade noch nicht kapiere ist der iLO status.. der wurde ja auf true gesetzt wegen meiner max temp auf 10 gestellt.

                            Habe dann die Temperaturwerte Max gelöscht und neu erstellen lassen aber ich habe immer noch die selben warnungen erhalten. Auch ein Script neustart änderte nix.

                            Habe den iLO status dann manuell auf false gesetzt nun ist alles wieder ruhig.

                            Passt da was noch nicht?

                            1 Reply Last reply Reply Quote 0
                            • N
                              nobse last edited by

                              • Benachrichtigungen werden nur einmal gesendet

                              • iLO_Status wird bei Fehlern auf TRUE gesetzt und wenn keine Fehler auf FALSE

                              var server = "192.168.133.x";
                              var username = "x";
                              var password = "x";
                              var emailadresse = "x";  //E-Mailadresse für Benachrichtigung
                              
                              var writeLog = false;
                              var benachrichtigung_per_email = true;  //Mail Adapter muss installiert sein
                              var benachrichtigung_per_telegramm = false; //Telegram Adapter muss installiert sein
                              var benachrichtigung_gesendet = 0;
                              
                              var runs = 0;
                              var anzahl_fehler = 0;
                              
                              var instanz = 'javascript.' + instance;
                              var pfad = '.iLO.';
                              
                              var request = require('request');
                              
                              function ilo(url, next, log){
                                 url = "https://"+server+url;
                                 request.timeout = 60000;
                                 request({
                                    "timeout": request.timeout,
                                    "rejectUnauthorized": false, 
                                    "url": url, 
                                    "method": "GET", 
                                    "headers":
                                    {
                                       "Content-Type": "application/json",
                                       "Accept": "application/json",
                                       "Authorization": "BASIC " + new Buffer(username+":"+password).toString('base64')
                                    }
                                 }, function(err, response, body){
                                    if (log) console.log("\n => "+url+" <=\n"+body+"\n");
                                    if (err) console.log(err+": "+url);
                                    else if (response.statusCode != 200) console.log(response.statusCode+": "+url);
                                    else if (next) next(JSON.parse(body));
                                 });
                              }
                              
                              function now() { return new Date().toISOString().replace(/T/, ' ').replace(/\..+/, ''); }
                              
                              function ping(){
                                 ilo("/rest/v1/Chassis/1/Thermal", function(body){
                                    var date = new Date();
                                    var log = now();
                                    if (runs++ === 0)      {
                                        createState(instanz + pfad + "iLO_Status", {
                                              name: "iLO_Status", 
                                              desc: "iLO_Status Gesamt",
                                              type: 'boolean', 
                                              def:  false,
                                              read: true,
                                              write: true,
                                              role: ''
                              
                                          }); 
                                       for (var f in body.Fans) {
                                           var fan = body.Fans[f];
                                           log += ", "+fan.FanName+" ["+fan.Units+"]";
                                           createState(instanz + pfad + fan.FanName.replace(/ /g, '_'), {
                                              name: fan.PhysicalContext, 
                                              desc: fan.PhysicalContext,
                                              type: 'number', 
                                              def:  0,
                                              read: true,
                                              write: true,
                                              role: 'value'  
                                          }); 
                              
                                       }
                                       for (var t in body.Temperatures) { var temp = body.Temperatures[t]; log += ", "+temp.Name+" ["+temp.Units+"]"; 
                                          createState(instanz + pfad + temp.Name.replace(/ /g, '_'), {
                                              name: temp.PhysicalContext, 
                                              desc: temp.PhysicalContext,
                                              type: 'number', 
                                              def:  0,
                                              read: true,
                                              write: true,
                                              role: 'value'  
                                          });  
                              
                                          createState(instanz + pfad + temp.Name.replace(/ /g, '_') + "_max", {
                                              name: temp.PhysicalContext + "_max", 
                                              desc: temp.PhysicalContext + "_max",
                                              type: 'number', 
                                              def:  temp.LowerThresholdNonCritical,
                                              read: true,
                                              write: true,
                                              role: 'value'  
                                          });  
                                      }
                                      if (writeLog === true){
                                          console.log(log);
                                          log = now();
                                      }
                                    }
                                    anzahl_fehler = 0;
                                      for (var f in body.Fans) {
                                          var fan = body.Fans[f];
                                          log += ", "+fan.CurrentReading;
                                          setState(instanz + pfad + fan.FanName.replace(/ /g, '_'), fan.CurrentReading);
                                      }
                              
                                      for (var t in body.Temperatures) {
                                          var temp = body.Temperatures[t];
                                          log += ", "+temp.CurrentReading;
                                          setState(instanz + pfad + temp.Name.replace(/ /g, '_'), temp.CurrentReading);
                                          isFehler(temp);
                                      }
                              
                                      if (anzahl_fehler > 0){
                                          setState(instanz + pfad + "iLO_Status", true);
                                      }else{
                                          setState(instanz + pfad + "iLO_Status", false);
                                          benachrichtigung_gesendet = 0;
                                      }
                              
                                      if (writeLog === true){
                                          console.log(log);
                                      }
                                  }, !true);
                              }
                              
                              function isFehler(temp){
                              
                                  var max = getState(instanz + pfad + temp.Name.replace(/ /g, '_') + "_max");
                                  var aktuell = temp.CurrentReading;
                              
                                  if (aktuell > max.val){
                                      anzahl_fehler++;
                                      if (benachrichtigung_per_email === true & benachrichtigung_gesendet === 0){
                                          sendTo("email", {
                                              to:      emailadresse,
                                              subject: "iLO Temperatur Warnung!!",
                                              text:    "Aktuelle Temperatur " + temp.Name + " = " + aktuell + " Grad Celsius."
                                          });
                                          benachrichtigung_gesendet = 1;
                                      }
                              
                                      if (benachrichtigung_per_telegramm === true & benachrichtigung_gesendet === 0){
                                          sendTo("telegram." + instance, "send", {
                                              text: ("iLO Temperatur Warnung!! Aktuelle Temperatur " + temp.Name + " = " + aktuell + " Grad Celsius.") // um die Nachricht nur an Teilnehme xy zu schicken folgendes anfügen , chatId: 'xxx'
                                          });
                                          benachrichtigung_gesendet = 1;
                                      } 
                                  }
                              }
                              
                              //Script läuft alle 2 Minuten
                              schedule("*/2 * * * *", function () {
                                  console.log("===> Start ILO");
                                  ping();
                              });
                              
                              1 Reply Last reply Reply Quote 0
                              • kmxak
                                kmxak Most Active last edited by

                                ok mit dem script bekomme ich keine ausgabe vom ilo mehr

                                edit ok ausgabe geht wieder

                                er setzt den ilo status auf true aber es kommt keine benachrichtigung

                                edit 2:

                                muss das script ein neues objekt erstellen?

                                anzahl fehler oder sowas? unter objekten ist alles noch beim alten. Oder wird das alles intern im script gemacht?

                                1 Reply Last reply Reply Quote 0
                                • N
                                  nobse last edited by

                                  Also

                                  anzahl_fehler ist nur eine Variable im Script.

                                  Habe gerade noch mal getestet

                                  • 13-LOM_max auf 10 gesetzt

                                  • beim nächsten Durchlauft wird iLO_Status auf true gesetzt und E-Mail versendet

                                  • beim nächsten Durchlauf wird keine E-Mail versendet

                                  • 13-LOM_max auf 100 gesetzt

                                  • beim nächsten Durchlauf wird iLO_Status auf false gesetzt und keine E-Mail versendet

                                  1 Reply Last reply Reply Quote 0
                                  • kmxak
                                    kmxak Most Active last edited by

                                    javascript.0	2017-05-16 22:38:00.388	info	script.js.Test.iLO_Temp: ===> Start ILO
                                    javascript.0	2017-05-16 22:36:00.383	info	script.js.Test.iLO_Temp: ===> Start ILO
                                    

                                    schaltet den ilo status auf true aber es kommt nix.

                                    werte liest er auch schon wieder nicht aus.

                                    woran es gerade scheitert und warum es eben noch ging ist mir ein rätsel

                                    mein aktuelles script ohne ip user und pw

                                    das einzige was ich immer änder ist hinter var benachrichtigung_per_telegramm = true; das ; setzen und telegram. hier die instanz 1 setzen.

                                    var writeLog = false;
                                    var benachrichtigung_per_email = true;  //Mail Adapter muss installiert sein
                                    var benachrichtigung_per_telegramm = true; //Telegram Adapter muss installiert sein
                                    var benachrichtigung_gesendet = 0;
                                    
                                    var runs = 0;
                                    var anzahl_fehler = 0;
                                    
                                    var instanz = 'javascript.' + instance;
                                    var pfad = '.iLO.';
                                    
                                    var request = require('request');
                                    
                                    function ilo(url, next, log){
                                       url = "https://"+server+url;
                                       request.timeout = 60000;
                                       request({
                                          "timeout": request.timeout,
                                          "rejectUnauthorized": false, 
                                          "url": url, 
                                          "method": "GET", 
                                          "headers":
                                          {
                                             "Content-Type": "application/json",
                                             "Accept": "application/json",
                                             "Authorization": "BASIC " + new Buffer(username+":"+password).toString('base64')
                                          }
                                       }, function(err, response, body){
                                          if (log) console.log("\n => "+url+" <=\n"+body+"\n");
                                          if (err) console.log(err+": "+url);
                                          else if (response.statusCode != 200) console.log(response.statusCode+": "+url);
                                          else if (next) next(JSON.parse(body));
                                       });
                                    }
                                    
                                    function now() { return new Date().toISOString().replace(/T/, ' ').replace(/\..+/, ''); }
                                    
                                    function ping(){
                                       ilo("/rest/v1/Chassis/1/Thermal", function(body){
                                          var date = new Date();
                                          var log = now();
                                          if (runs++ === 0)      {
                                              createState(instanz + pfad + "iLO_Status", {
                                                    name: "iLO_Status", 
                                                    desc: "iLO_Status Gesamt",
                                                    type: 'boolean', 
                                                    def:  false,
                                                    read: true,
                                                    write: true,
                                                    role: ''
                                    
                                                }); 
                                             for (var f in body.Fans) {
                                                 var fan = body.Fans[f];
                                                 log += ", "+fan.FanName+" ["+fan.Units+"]";
                                                 createState(instanz + pfad + fan.FanName.replace(/ /g, '_'), {
                                                    name: fan.PhysicalContext, 
                                                    desc: fan.PhysicalContext,
                                                    type: 'number', 
                                                    def:  0,
                                                    read: true,
                                                    write: true,
                                                    role: 'value'  
                                                }); 
                                    
                                             }
                                             for (var t in body.Temperatures) { var temp = body.Temperatures[t]; log += ", "+temp.Name+" ["+temp.Units+"]"; 
                                                createState(instanz + pfad + temp.Name.replace(/ /g, '_'), {
                                                    name: temp.PhysicalContext, 
                                                    desc: temp.PhysicalContext,
                                                    type: 'number', 
                                                    def:  0,
                                                    read: true,
                                                    write: true,
                                                    role: 'value'  
                                                });  
                                    
                                                createState(instanz + pfad + temp.Name.replace(/ /g, '_') + "_max", {
                                                    name: temp.PhysicalContext + "_max", 
                                                    desc: temp.PhysicalContext + "_max",
                                                    type: 'number', 
                                                    def:  temp.LowerThresholdNonCritical,
                                                    read: true,
                                                    write: true,
                                                    role: 'value'  
                                                });  
                                            }
                                            if (writeLog === true){
                                                console.log(log);
                                                log = now();
                                            }
                                          }
                                          anzahl_fehler = 0;
                                            for (var f in body.Fans) {
                                                var fan = body.Fans[f];
                                                log += ", "+fan.CurrentReading;
                                                setState(instanz + pfad + fan.FanName.replace(/ /g, '_'), fan.CurrentReading);
                                            }
                                    
                                            for (var t in body.Temperatures) {
                                                var temp = body.Temperatures[t];
                                                log += ", "+temp.CurrentReading;
                                                setState(instanz + pfad + temp.Name.replace(/ /g, '_'), temp.CurrentReading);
                                                isFehler(temp);
                                            }
                                    
                                            if (anzahl_fehler > 0){
                                                setState(instanz + pfad + "iLO_Status", true);
                                            }else{
                                                setState(instanz + pfad + "iLO_Status", false);
                                                benachrichtigung_gesendet = 0;
                                            }
                                    
                                            if (writeLog === true){
                                                console.log(log);
                                            }
                                        }, !true);
                                    }
                                    
                                    function isFehler(temp){
                                    
                                        var max = getState(instanz + pfad + temp.Name.replace(/ /g, '_') + "_max");
                                        var aktuell = temp.CurrentReading;
                                    
                                        if (aktuell > max.val){
                                            anzahl_fehler++;
                                            if (benachrichtigung_per_email === true & benachrichtigung_gesendet === 0){
                                                sendTo("email", {
                                                    to:      emailadresse,
                                                    subject: "iLO Temperatur Warnung!!",
                                                    text:    "Aktuelle Temperatur " + temp.Name + " = " + aktuell + " Grad Celsius."
                                                });
                                                benachrichtigung_gesendet = 1;
                                            }
                                    
                                            if (benachrichtigung_per_telegramm === true & benachrichtigung_gesendet === 0){
                                                sendTo("telegram.1" + instance, "send", {
                                                    text: ("iLO Temperatur Warnung!! Aktuelle Temperatur " + temp.Name + " = " + aktuell + " Grad Celsius.") // um die Nachricht nur an Teilnehme xy zu schicken folgendes anfügen , chatId: 'xxx'
                                                });
                                                benachrichtigung_gesendet = 1;
                                            } 
                                        }
                                    }
                                    
                                    //Script läuft alle 2 Minuten
                                    schedule("*/2 * * * *", function () {
                                        console.log("===> Start ILO");
                                        ping();
                                    });
                                    
                                    1 Reply Last reply Reply Quote 0
                                    • N
                                      nobse last edited by

                                      Nehme mal bitte das 1 bei telegram weg oder lösche das + instance

                                      1 Reply Last reply Reply Quote 0
                                      • kmxak
                                        kmxak Most Active last edited by

                                        Jo das war es

                                        es muss so sein

                                        sendTo("telegram.1", "send", {
                                        

                                        jedenfalls bei mir weil ich es auf instanz 1 haben möchte.

                                        Hatte nicht gesehen das du da was geändert hattest 😉

                                        1 Reply Last reply Reply Quote 0
                                        • N
                                          nobse last edited by

                                          Was hast du eigentlich für eine CPU in deinem GEN8? Ich habe einen Intel(R) Celeron(R) CPU G1610T @ 2.30GHz und suche was schnelleres was auf das Board past. Hast du da eine Idee?

                                          Für heute ist für mich Feierabend.

                                          1 Reply Last reply Reply Quote 0
                                          • kmxak
                                            kmxak Most Active last edited by

                                            Ich habe auch noch Ideal Standart.

                                            Habe mehrere in Ebay auf beobachtungsliste 150-250€ aber momentan ist mir das zu teuer. Der CPU bei mir ist noch nicht ausgelastet. ( Erschwerend bei mir auch das Temperaturproblem unter dem Dachboden)

                                            Die TDP der meisten CPU's sind ja bei 70 oder da drüber…

                                            Der Intel Xeon E3-1265L v2 hat eine TPD von 45W da würde der OEM CPU Kühler fast noch reichen. Läuft ja auch nicht immer unter Volllast.

                                            Kannst ja mal hier schauen:

                                            https://www.hardwareluxx.de/community/f ... 63207.html

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            562
                                            Online

                                            31.8k
                                            Users

                                            80.0k
                                            Topics

                                            1.3m
                                            Posts

                                            5
                                            44
                                            4922
                                            Loading More Posts
                                            • Oldest to Newest
                                            • Newest to Oldest
                                            • Most Votes
                                            Reply
                                            • Reply as topic
                                            Log in to reply
                                            Community
                                            Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                                            The ioBroker Community 2014-2023
                                            logo