NIXStats / nixstatsagent

NIXStats monitoring agent
https://www.nixstats.com
Other
92 stars 38 forks source link

Litespeed plugin requires "https" #38

Closed rinogo closed 3 years ago

rinogo commented 5 years ago

The LiteSpeed plugin was failing as following:

root@host [10134 12:52:40 ~]# nixstatsagent --test litespeed
litespeed:
/usr/lib/python2.7/site-packages/urllib3/connectionpool.py:1004: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning,
{}

On my partuclar system, I was able to fix this by modifying litespeed.py:

root@host [10135 12:52:46 ~]# nano /usr/lib/python2.7/site-packages/nixstatsagent/plugins/litespeed.py

I changed "http" to "https" on the following line. Before:

        response = requests.get("http://%s:%s/status?rpt=summary" % (config.get('litespeed', 'host'),config.get('litespeed', 'port')), auth=(config.get('litespeed', 'username'), config.get('litespeed', 'password')), verify=False)

After:

        response = requests.get("https://%s:%s/status?rpt=summary" % (config.get('litespeed', 'host'),config.get('litespeed', 'port')), auth=(config.get('litespeed', 'username'), config.get('litespeed', 'password')), verify=False)
rinogo commented 5 years ago

This need to use SSL may be a consequence of this excerpt in LiteSpeed's documentation:

Since 5.2 we started forcing SSL so unless you forced disable SSL for admin menu ... If you still run http instead of https, you may experience 403 error.

vfuse commented 3 years ago

This should be resolved now, https is now set as the default method.