Author Topic: Resources monitor per user/website  (Read 19171 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Re: Resources monitor per user/website
« Reply #15 on: September 03, 2018, 01:16:48 PM »

Did you try to run the following command for permission

chown -R netdata:netdata /usr/local/apache/htdocs/netdata

Thanks for the fix Bullten

Offline
**
Re: Resources monitor per user/website
« Reply #16 on: September 03, 2018, 01:50:38 PM »
Thanks for the fix Bullten
So it's not only me...

Offline
***
Re: Resources monitor per user/website
« Reply #17 on: September 03, 2018, 02:13:17 PM »
Well you can password protect it like below
Quote
nano  /usr/local/apache/htdocs/netdata/etc/netdata/netdata.conf

Find # bind to = under [web] and uncomment it and change it to bind to = localhost

Before

Quote
[web]
        # mode = static-threaded
        # listen backlog = 4096
        # default port = 19999
        # bind to =
        # web files owner = netdata
        # web files group = netdata

After   
   
Quote
[web]
        # mode = static-threaded
        # listen backlog = 4096
        # default port = 19999
        bind to = localhost
        # web files owner = netdata
        # web files group = netdata


Create Password

Code: [Select]
ln -s /usr/local/apache/bin/htpasswd /usr/sbin/htpasswd
htpasswd -bc /usr/local/apache/htdocs/netdata/usr/share/netdata/web/.htpasswd yourusername yourpassword

Copy and Paste all lines not one by one

Quote
cat > /usr/local/apache/conf.d/netdata-auth.conf << "EOF"
<VirtualHost *:80>

   RewriteEngine On
   ProxyRequests Off
   ProxyPreserveHost On

   <Proxy *>
      Require all granted
   </Proxy>

   # Local netdata server accessed with '/netdata/', at localhost:19999
   ProxyPass "/netdata/" "http://localhost:19999/" connectiontimeout=5 timeout=30 keepalive=on
   ProxyPassReverse "/netdata/" "http://localhost:19999/"

   # if the user did not give the trailing /, add it
   # for HTTP (if the virtualhost is HTTP, use this)
   RewriteRule ^/netdata$ http://%{HTTP_HOST}/netdata/ [L,R=301]
   # for HTTPS (if the virtualhost is HTTPS, use this)
   #RewriteRule ^/netdata$ https://%{HTTP_HOST}/netdata/ [L,R=301]

    <Location /netdata/>
       AuthType Basic
       AuthName "Protected site"
      AuthUserFile /usr/local/apache/htdocs/netdata/usr/share/netdata/web/.htpasswd
      Require valid-user
      Order deny,allow
      Allow from all
</Location>
   
</VirtualHost>
EOF

Restart Apache
Code: [Select]
service httpd restart
Note: Now you cant access netdata using port you need to access like http://yourserverip/netdata/

Offline
**
Re: Resources monitor per user/website
« Reply #18 on: September 03, 2018, 06:21:15 PM »
Create Password
Code: [Select]
ln -s /usr/local/apache/bin/htpasswd /usr/sbin/htpasswd
htpasswd -bc /usr/local/apache/htdocs/netdata/usr/share/netdata/web/.htpasswd yourusername yourpassword


First, thank you so much for all your help.
Second, I got the following error:


Code: [Select]
[root@cwp ~]# ln -s /usr/local/apache/bin/htpasswd /usr/sbin/htpasswd
ln: failed to create symbolic link ‘/usr/sbin/htpasswd’: File exists


Offline
***
Re: Resources monitor per user/website
« Reply #19 on: September 03, 2018, 09:23:32 PM »
Its just a warning to let you know file already exist there. You dont need to worry about that. I would suggest you to follow this tutorial

https://blog.bullten.com/centos-web-panel/password-protect-netdata-and-disable-port-access-in-centos-web-panel-centos-6-7/

Offline
*
Re: Resources monitor per user/website
« Reply #20 on: September 05, 2018, 12:23:43 AM »
Its just a warning to let you know file already exist there. You dont need to worry about that. I would suggest you to follow this tutorial

https://blog.bullten.com/centos-web-panel/password-protect-netdata-and-disable-port-access-in-centos-web-panel-centos-6-7/

Hey Bullten,

I followed all on your write up for adding password protection and it all worked fine except for some reason I had to use chown -R netdata:netdata /usr/local/apache/htdocs/netdata again to access it after filling in user and password. I had to use chown -R netdata:netdata /usr/local/apache/htdocs/netdata yesterday in order to access netdata. What would cause me to have to do it today?

Or is this fixed now that I added password protection?

Thanks, Rug3r

Offline
***
Re: Resources monitor per user/website
« Reply #21 on: September 05, 2018, 03:33:19 AM »
Code: [Select]
nano /usr/local/apache/htdocs/netdata/etc/netdata/netdata.conf
Find

Quote
# run as user = netdata
# web files owner = netdata
# web files group = netdata

Uncomment them

Quote
run as user = netdata
web files owner = netdata
web files group = netdata

Save and restart netdata

Code: [Select]
service netdata restart
See if its happening now.

Offline
*****
Re: Resources monitor per user/website
« Reply #22 on: September 05, 2018, 01:01:04 PM »
Correct. I will have to investigate how to do it. As a newbie, everything looks so difficult (throws me back to the MS-DOS days before the Windows era, but I haven't used command line ever since)...


Any chance you have a guide up your sleeve to share how to put this password protection in place?
https://github.com/firehol/netdata/wiki/Running-behind-nginx#enable-authentication

Offline
**
Re: Resources monitor per user/website
« Reply #23 on: September 20, 2018, 07:16:33 AM »
https://github.com/firehol/netdata/wiki/Running-behind-nginx#enable-authentication
I only managed to break my nginx when adding things to nginx.conf :(
As I can't password protect it, I think I'll have to uninstall it unfortunately...