2222class Netdata (object ):
2323 """A class for handling connections with a Netdata instance."""
2424
25- def __init__ (self , host , loop , session , port = 19999 , data = None ):
25+ def __init__ (self , host , loop , session , port = 19999 ):
2626 """Initialize the connection to the Netdata instance."""
2727 self ._loop = loop
2828 self ._session = session
2929 self .host = host
3030 self .port = port
3131 self .values = self .alarms = self .metrics = None
3232 self .base_url = _INSTANCE .format (host = host , port = port , api = API_VERSION )
33- if data is None :
34- self .endpoint = _ALL_METRIC_ENDPOINT
35- if data == "alarms" :
36- self .endpoint = _ALARMS_ENDPOINT
37- if data == "data" :
38- self .endpoint = _DATA_ENDPOINT
3933
4034 async def get_data (self , resource ):
4135 """Get detail for a resource from the data endpoint."""
36+ self .endpoint = _DATA_ENDPOINT
4237 url = "{}{}" .format (self .base_url , self .endpoint .format (resource = resource ))
4338
4439 try :
@@ -56,6 +51,7 @@ async def get_data(self, resource):
5651
5752 async def get_alarms (self ):
5853 """Get alarms for a Netdata instance."""
54+ self .endpoint = _ALARMS_ENDPOINT
5955 url = "{}{}" .format (self .base_url , self .endpoint )
6056
6157 try :
@@ -73,6 +69,7 @@ async def get_alarms(self):
7369
7470 async def get_allmetrics (self ):
7571 """Get all available metrics from a Netdata instance."""
72+ self .endpoint = _ALL_METRIC_ENDPOINT
7673 url = "{}{}" .format (self .base_url , self .endpoint )
7774
7875 try :
0 commit comments