linuxserver / Heimdall-Apps

Apps for Heimdall
MIT License
298 stars 321 forks source link

Request: enhance MONIT app #616

Closed GOUKI9999 closed 3 months ago

GOUKI9999 commented 1 year ago

Heimdall's newest version, Nginx

The MONIT app (https://mmonit.com/monit/) is working well on my Linux server. I want to add it as an app in Heimdall like other services, but it failed. After I filled in the username and password, clicking the test button showed me "Failed: Invalid credentials."

If I filled the Website (above) with the URL http://user:pass@ip:port/ and clicked Go, it seemed to return the correct message (icon).

The Monit service is running well, and I can log in to the web service through Chrome. I checked the IP, port, and password that I filled in Heimdall, and I think there are no errors. On the same server, I added services as apps such as Plex, Transmission, qBittorrent, Netdata, and so on. Their APIs are working well, but Monit's is not.

I tried downloading the Monit app zip from https://apps.heimdall.site/applications/enhanced. I got the Monit.zip with the date 22/11/18, and I tried putting it into \Heimdall\app\SupportedApps\ and extracting it to \Heimdall\app\SupportedApps\Monit.

However, it still doesn't work.

mvdkleijn commented 7 months ago

I looked at the code for the monit enhancement and it tries to connect to status.

So if you fill in a URL like http://ip:port/ it will try to connect to http://ip:port/status.

A quick glance at the MMonit docs however, suggest that the correct endpoint would be something like http://ip:port/api/v2/status. I don't have monit to test that, but you should be able to do so by updating the URL accordingly.

However, even then it might not return the proper values from what I see.

If that indeed works, we could update the app.

GOUKI9999 commented 7 months ago

I looked at the code for the monit enhancement and it tries to connect to status.

So if you fill in a URL like http://ip:port/ it will try to connect to http://ip:port/status.

A quick glance at the MMonit docs however, suggest that the correct endpoint would be something like http://ip:port/api/v2/status. I don't have monit to test that, but you should be able to do so by updating the URL accordingly.

However, even then it might not return the proper values from what I see.

If that indeed works, we could update the app.

sure,I tried use "http://ip:port/api/v2/" replaced "http://ip:port/" ,and it return the "Invalid credentials"yet. If I opened the http://ip:port/api/v2/status page ,it just a "not found" 404 page

mvdkleijn commented 7 months ago

I have some bad news. I believe the Monit app has not been properly implemented (in Heimdall) in the past. There does not appear to be any logic retrieving data from Monit, nor does it appear to try to authenticate.

I could probably implement it as the Monit API appears fairly straightforward but I'd have to setup a Monit instance to test it properly. As I already spent an entire day working through the issue and PR backlog, I am fairly busy the rest of this week and weekend at least. So no promises on when I might be able to do this.

In any case, with the app's current state it is impossible to get the enhanced part of it working.

You are welcome to try to implement it yourself or maybe someone else reading this can lend a hand.

As a side note: I didn't notice this before, but you said you downloaded the app from the site and tried to put it in SupportedApps. Please do not do that. The downloads on the site are templates meant for developers to implement app support in Heimdall. It is not necessary to download anything manually if the app is supported by Heimdall. I will see if I can clarify that on the site / wiki somehow.

LinuxServer-CI commented 5 months ago

This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.

LinuxServer-CI commented 4 months ago

This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.

LinuxServer-CI commented 3 months ago

This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.

GOUKI9999 commented 1 month ago

I submitted PR #761 to fix the auth issue and added dropdown options in the configuration for data selection.