Jump to content

I've added GPU Info to Emby dashboard but does anyone...?


chef

Recommended Posts

chef

Hi,

 

I have successfully added GPU Temperature and load information to my Emby Dashboard through my Extras Plugin, Sweet!

 

5e6ea52129240_gpuDashboard.png

 

Currently it works with Nvidia GPU's on Linux and Windows!

 

But I had some questions for Linux users who have NVidea cards:

 

1. Where on Linux OS's is the "nvidia-smi" file located on Linux Systems?

 

I also had some questions for people who are using AMD GPUs. I have some ways to make my plugin get AMD info, but because I don't own AMD I was hoping someone out there might have an AMD GPU who could answer a couple questions, both Windows and Linux :)

Edited by chef
Link to comment
Share on other sites

rechigo

Is it possible for plugins to send websocket events so this could be updated in real time? or would you have to make an http request every x seconds

Link to comment
Share on other sites

chef

Is it possible for plugins to send websocket events so this could be updated in real time? or would you have to make an http request every x seconds

Absolutely it is! Want some code?

Link to comment
Share on other sites

rechigo

Absolutely it is! Want some code?

Yes, that would be nice..

 

As far as I knew, you could only extend the HTTP Api, not the websocket api

 

Thanks

 

Sent from my SM-G973U using Tapatalk

Link to comment
Share on other sites

chef

Note: Just to let you know, I have built a plugin which allows me to persist javascript on the dashboardPage. If the Server updates and removes my Javascript file the plugin just replaces it. 

 

Here is the Websocket code:

 

Server side plugin code (This could be anywhere, but I'll use ServerEntryPoint for example:

    public class ServerEntryPoint : IServerEntryPoint
    {
        public static ISessionManager SessionManager           { get; set; }
        
        public ServerEntryPoint(ISessionManager ses)
        {
            SessionManager = ses;
        }
        public void Dispose()
        {
           
        }

        public void Run()
        {
           //Keep in mind that this initial function will run before your dashboard will load on the frontend
           // What I do here is initialize custom events that will be firing information off to the dashboard - example: Standard outputs from Bash/CMD command lines (nvidia-smi gpu data/ or server uptime data)
           
           SendMyWebsocketMessageToAdmins("DashboardAdminMessage", "Hello from the backend"); //Or you could use IJsonSerializer to serial an data object and send a whole bunch of information here
        }

        public async SendMyWebsocketMessageToAdmins(string messageName, string data)
        {
            await SessionManager.SendMessageToAdminSessions(messageName, data, CancellationToken.None);
        }
    }

Client Side Javascript:

       ApiClient._webSocket.addEventListener('message', function (msg) {
            var json = JSON.parse(msg.data);
            if (json.MessageType == "DashboardAdminMessage") {
                var data = json.Data; // Or if you have serialized json objects on the back-end then use: JSON.parse(json.Data);
                //Do whatever you want with the back-end data
                console.log(data); //Logs: "Hello from the backend"
            }
        });
  • Like 1
Link to comment
Share on other sites

rechigo

Thanks

 

Now to figure out what to do with it... Could be useful for an Emby dashboard that I'm building

  • Like 1
Link to comment
Share on other sites

chef

Chef.. Do you mind if a submit a pull request or two to the repository?

Sure thing! Do you need a link or did you find it okay?

Link to comment
Share on other sites

rechigo

I suppose I had better push an update that utilizes the code above properly [emoji28]

That was one of the things I was thinking about

 

You might wanna check the system uptime method - I got an array index out of range error

 

Sent from my SM-G973U using Tapatalk

Link to comment
Share on other sites

chef

That was one of the things I was thinking about

 

You might wanna check the system uptime method - I got an array index out of range error

 

Sent from my SM-G973U using Tapatalk

Are you on Linux?

Link to comment
Share on other sites

jachin99

Chef, sorry I'm late getting back.  I didn't realize I had to compile it.  The last version of visual studio I used was 2010 and that was about a year ago.  I have a few community editions that are newer laying around I think.  I can try to build it if need be but I'm not sure what version of MSVS your using or if your using another tool.  

Link to comment
Share on other sites

rechigo

Chef, sorry I'm late getting back. I didn't realize I had to compile it. The last version of visual studio I used was 2010 and that was about a year ago. I have a few community editions that are newer laying around I think. I can try to build it if need be but I'm not sure what version of MSVS your using or if your using another tool.

You should be able to build plugins just by installing VS2019 and checking the dotnet package, that should install everything that's needed

 

Sent from my SM-G973U using Tapatalk

Link to comment
Share on other sites

jachin99

I grabbed the source, and built the plugin but nothing extra is showing on my dashboard.  I placed the assembly in emby's programdata/plugin folder and made sure it wasnt blocked.  I didn't get any build errors or warnings. 

 

Edit: I take it back.  I found the configuration file, and switched everything from false to true but only storage is showing.  I don't get uptime or weather

Edited by jachin99
Link to comment
Share on other sites

chef

I grabbed the source, and built the plugin but nothing extra is showing on my dashboard. I placed the assembly in emby's programdata/plugin folder and made sure it wasnt blocked. I didn't get any build errors or warnings.

Did you restart the server, and clear browser data?

Link to comment
Share on other sites

rechigo

Uptime endpoint is broken, weather endpoint requires some additional setup (openweathermap api key i think or something along those lines)

 

Sent from my SM-G973U using Tapatalk

Link to comment
Share on other sites

jachin99

I did restart the server but I'm not sure how to clear browser data. Where would I put in the the weather api key, and which service so I get the key from

Link to comment
Share on other sites

rechigo

I did restart the server but I'm not sure how to clear browser data. Where would I put in the the weather api key, and which service so I get the key from

I believe on the plugun config page, checking the "display weather" option will bring up a dialog for the api key and where to get it

 

Sent from my SM-G973U using Tapatalk

Link to comment
Share on other sites

rechigo

That's right you have to enable the items in the plugin configuration.

 

@@rechigo are you on Linux?

Windows

 

Sent from my SM-G973U using Tapatalk

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...