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 1
1
# -*- coding: utf-8 -*-
2
- import re
2
+ import logging
3
3
4
4
5
5
class GetKeys (object ):
6
-
7
6
plg_type = 'all'
8
7
9
8
def txt (self , type , plugins = []):
10
9
# sort plugins!
11
10
self .plg_type = type
12
11
plugins .sort (key = lambda x : x .__class__ .__name__ )
13
12
# 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
15
14
return template_data
16
15
17
16
def _get_all (self , keys_and_queries , plugins = []):
18
17
result = ''
18
+ # don't need keys for zabbix agent from these classes
19
+ non_keys_classes = ('AgentApi' , 'LogSender' , 'ZbxSender' )
19
20
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 :
21
22
# 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
26
29
return result
27
30
28
31
def key_and_query (self , args = []):
29
32
result = ""
30
33
for one in args :
31
34
result += 'UserParameter={0}\n ' .format (one )
32
35
return result
33
-
You can’t perform that action at this time.
0 commit comments