This commit is contained in:
David Barroso committed 2015-12-15 15:22:03 +01:00
1 parent 597c6cd373
commit 898d4e85c5
1 file changed
+3 -5
+3 -5
View File
@@ -12,13 +12,10 @@
# License for the specific language governing permissions and limitations under # License for the specific language governing permissions and limitations under
# the License. # the License.
import re import re
from pyFG.fortios import FortiOS, FortiConfig, logger from pyFG.fortios import FortiOS, FortiConfig, logger
from pyFG.exceptions import FailedCommit, CommandExecutionException from pyFG.exceptions import FailedCommit, CommandExecutionException
from base import NetworkDriver from base import NetworkDriver
from exceptions import ReplaceConfigException, MergeConfigException from exceptions import ReplaceConfigException, MergeConfigException
from napalm.utils.string_parsers import colon_separated_string_to_dict, convert_uptime_string_seconds from napalm.utils.string_parsers import colon_separated_string_to_dict, convert_uptime_string_seconds
@@ -307,7 +304,9 @@ class FortiOSDriver(NetworkDriver):
m = re.search('(.+?) states: (.+?)% user (.+?)% system (.+?)% nice (.+?)% idle', l) m = re.search('(.+?) states: (.+?)% user (.+?)% system (.+?)% nice (.+?)% idle', l)
cpuname = m.group(1) cpuname = m.group(1)
idle = m.group(5) idle = m.group(5)
output[cpuname] = 100 - int(idle) output[cpuname] = {
'%usage': 100.0 - int(idle)
}
return output return output
def get_memory(memory_line): def get_memory(memory_line):
@@ -346,7 +345,6 @@ class FortiOSDriver(NetworkDriver):
temp_lines = [x for x in sensors_block if any([True for y in ['dts', 'temp', 'adt7490'] if y in x])] temp_lines = [x for x in sensors_block if any([True for y in ['dts', 'temp', 'adt7490'] if y in x])]
out['temperature'] = get_temperature(temp_lines, sensors_block) out['temperature'] = get_temperature(temp_lines, sensors_block)
# fans # fans
out['fans'] = get_fans([x for x in sensors_block if 'fan' in x and 'temp' not in x]) out['fans'] = get_fans([x for x in sensors_block if 'fan' in x and 'temp' not in x])