@@ -52,7 +52,7 @@ def __init__(self, config):
5252 try :
5353 release_file = open (os_release_file , 'r' ).readlines ()
5454 except Exception as e :
55- self .log .info (f 'Cannot read file { os_release_file } : { e } ' )
55+ self .log .info ('Cannot read file {os_release_file} : {e}' . format ( os_release_file = os_release_file , e = e ) )
5656 release_file = None
5757
5858 if release_file :
@@ -81,7 +81,7 @@ def run(self, zbx):
8181 or (not self .os_name and not self .os_version ):
8282 for pid in pids :
8383 try :
84- statm = open (f '/proc/{ pid } /statm' , 'r' ).read ().split (' ' )
84+ statm = open ('/proc/{pid}/statm' . format ( pid = pid ) , 'r' ).read ().split (' ' )
8585 except FileNotFoundError :
8686 continue
8787
@@ -92,11 +92,14 @@ def run(self, zbx):
9292 diffs .append ({'pid' : pid , 'RES' : RES , 'SHR' : SHR , 'diff' : self .diff })
9393 if diffs :
9494 for diff in diffs :
95- msg_text += 'pid: {pid}, RES {RES} - SHR {SHR} more then {diff}\n ' .format_map (diff )
95+ msg_text += 'pid: {pid}, RES {RES} - SHR {SHR} more then {diff}\n ' .format (pid = diff .get ('pid' ),
96+ RES = diff .get ('RES' ),
97+ SHR = diff .get ('SHR' ),
98+ diff = diff .get ('diff' ))
9699 else :
97100 for pid in pids :
98101 try :
99- statm = open (f '/proc/{ pid } /status' , 'r' ).readlines ()
102+ statm = open ('/proc/{pid}/status' . format ( pid = pid ) , 'r' ).readlines ()
100103 except FileNotFoundError :
101104 continue
102105
@@ -123,7 +126,12 @@ def run(self, zbx):
123126 if diffs :
124127 for diff in diffs :
125128 msg_text += 'pid: {pid}, RssAnon {RssAnon} more then {diff}, VmRSS {VmRSS}, ' \
126- 'RssFile {RssFile}, RssShmem {RssShmem} \n ' .format_map (diff )
129+ 'RssFile {RssFile}, RssShmem {RssShmem} \n ' .format (pid = diff .get ('pid' ),
130+ RssAnon = diff .get ('RssAnon' ),
131+ diff = diff .get ('diff' ),
132+ VmRSS = diff .get ('VmRSS' ),
133+ RssFile = diff .get ('RssFile' ),
134+ RssShmem = diff .get ('RssShmem' ))
127135
128136 zbx .send (self .key_count_diff , int (count_diff ))
129137 zbx .send (self .key_count_diff_error , msg_text )
0 commit comments