get real time cpu usage of remote server

オープン
#415 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
javascript, node.js, typescript
領域
backend, web-dev

調査の方向性

リポジトリのファイルもテストも指定されていません。まず、接続の ready ハンドラー、get_live_usage イベント、クライアント側の getNewSeries 関数に関する応答が繰り返される状況を再現します。完了条件を定義する前に、クライアントからの 1 回の emission で使用量の応答が正確に 1 件生成されるべきかを明確にしてください。

索引モデルが issue の本文から書いたものです。

説明

unconfirmed bug

hello I am trying to use ssh2 with websocket , so I can get REAL Time cpu usage , this is my code

     conn.connect({
        host: '127.0.0.1',
        port: 22,
        username: 'muhammed',
        password:"Muhbu2020"

    });
    conn.on("ready", () => {
      routerconnection.usagemonitor.channel.to(namespace).emit('ready_to_get_data');

 socket.on("get_live_usage",function(){
      conn.exec('cat /proc/stat', (err, stream) => {
            if (err) throw err;
            stream.on('data', (data) => {
                console.log("recieving data");


                handleMonitorResponse(routerconnection,router_id,data.toString());



            })

        });
 });

    });

actually what isgoing on is when I am emmiting get_live_usage to node js from javascript ,the server start to run a lot of instance and it return a lot of response for one emmit , which making my chart going crazy , did I missed somethings or what , I don't understand ,
this is my client side code

   socket.on('live_usage',function (recieved) {
        console.log("recieved"+ recieved.load)

        getNewSeries(lastDate, {
            min: 0,
            max: 100
        },recieved)
        resetData()
        chart.updateSeries([{
            data: data
        }])
    });

and this is the getNewSeries function

function getNewSeries(baseval, yrange,recieved) {
console.log(recieved)
    var newDate = baseval + TICKINTERVAL;
    lastDate = newDate

    for(var i = 0; i< data.length - 100; i++) {
        // IMPORTANT
        // we reset the x and y of the data which is out of drawing area
        // to prevent memory leaks
        data[i].x = newDate - XAXISRANGE - TICKINTERVAL
        data[i].y = 0
        console.log("weeeeeeare in for")
    }




        window['status'+admin_id+nas_id] =0;

               cpu = recieved.load

           var iowait = recieved.iowait;
           $('#iobar').attr('style', "width:" + iowait + "%");
           $('#iobar').html(iowait + "%")
           $('#cpubar').attr('style', "width:" + cpu + "%");
           $('#cpubar').html(cpu + "%")
           $('#cpu-usage').html(cpu + "%")


        socket.emit('get_live_usage', detail);






    data.push({
        x: newDate,
        y: cpu
    })
}
主要言語
TypeScript
スター
1k
フォーク
94
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

steelbrain/node-ssh のほかの issue

steelbrain/node-ssh の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。