File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change 11# -*- coding: utf-8 -*-
2- import re
2+ import logging
33
44
55class GetKeys (object ):
6-
76 plg_type = 'all'
87
98 def txt (self , type , plugins = []):
109 # sort plugins!
1110 self .plg_type = type
1211 plugins .sort (key = lambda x : x .__class__ .__name__ )
1312 # create template
14- template_data = self ._get_all ('keys_and_queries' , plugins ) # get data from all plugins
13+ template_data = self ._get_all ('keys_and_queries' , plugins ) # get data from all plugins
1514 return template_data
1615
1716 def _get_all (self , keys_and_queries , plugins = []):
1817 result = ''
18+ # don't need keys for zabbix agent from these classes
19+ non_keys_classes = ('AgentApi' , 'LogSender' , 'ZbxSender' )
1920 for plugin in plugins :
20- if plugin .AgentPluginType == self . plg_type or self . plg_type == 'all' :
21+ if plugin .__class__ . __name__ not in non_keys_classes :
2122 # check if THIS plugin is required for current input option
22- row = getattr (plugin , keys_and_queries )(self ) # get keys_and_queries of this particular plugin
23- if row is None :
24- continue
25- result += row
23+ if plugin .AgentPluginType == self .plg_type or self .plg_type == 'all' :
24+ row = getattr (plugin , keys_and_queries )(self ) # get keys_and_queries of this particular plugin
25+ if row is None :
26+ logging .info ('No keys for plugin {0}' .format (plugin .__class__ .__name__ ))
27+ continue
28+ result += row
2629 return result
2730
2831 def key_and_query (self , args = []):
2932 result = ""
3033 for one in args :
3134 result += 'UserParameter={0}\n ' .format (one )
3235 return result
33-
You can’t perform that action at this time.
0 commit comments