def test_isilon_bad_arguement_in_good_method(bad_settings_file): i = Isilon(api_class="StatisticsApi", settings_file=bad_settings_file) with pytest.raises(IsilonInvalidArgumentException) as e: i.call_method(method='get_summary_system', bad_param='1,2,3,4') assert str( e.value ) == "One of the arguements you passed in is invalid. Arguments are: {'bad_param': '1,2,3,4'}"
def test_isilon_bad_method(bad_settings_file): i = Isilon(api_class="StatisticsApi", settings_file=bad_settings_file) with pytest.raises(IsilonInvalidMethodException) as e: i.call_method(method='get_bad_method', nodes='1,2,3,4') assert str( e.value ) == "The method `get_bad_method` does not exist on the Class Object."
#! /usr/bin/env python3 from isilon import Isilon # The Isilon class sets up the connection to the Isilon and provides an object i = Isilon(api_class="StatisticsApi") response = i.call_method(method='get_summary_drive') for drive in response.drive: if drive.type != "UNKNOWN": measure = "drive" tags = f"drive_id={drive.drive_id},type={drive.type}" fields = f"percent_used={drive.used_bytes_percent}" print(f"{measure},{tags} {fields}")
from isilon import Isilon import argparse # Read in stat from the command line parser = argparse.ArgumentParser() parser.add_argument( "statistic", help="Display Statistics Key Details. Example: cluster.node.list.all") args = parser.parse_args() # The Isilon class sets up the connection to the Isilon and provides an object s = Isilon(api_class="StatisticsApi") # Sample of the name of the stat # stat_key = 'node.clientstats.proto.nfs' stat_key = args.statistic response = s.call_method(method='get_statistics_key', statistics_key_id=stat_key) print('\n*********************\n') print("Structure details of the key") print(response) print('\n*********************\n') print("Data in the key from the API\n") response = s.call_method(method='get_statistics_current', key=stat_key, devid='all') print(response)
#! /usr/bin/env python3 from isilon import Isilon # The Isilon class sets up the connection to the Isilon and provides an object i = Isilon(api_class="StoragepoolApi") response = i.call_method(method='get_storagepool_nodepool', storagepool_nodepool_id='v200_100gb_6gb') for node in response.nodepools: measure = "node_pool" tags = f"name={node.name},tier={node.tier}" fields = f"percent_used={node.usage.pct_used}" print(f"{measure},{tags} {fields}")
#! /usr/bin/env python3 from isilon import Isilon # The Isilon class sets up the connection to the Isilon and provides an object i = Isilon(api_class="StatisticsApi") response = i.call_method(method='get_summary_system', nodes='1,2,3,4') for measurement in response.system: measure = "cpu" tags = f"nodes={measurement.node}" fields = f"cpu={measurement.cpu}" print(f"{measure},{tags} {fields}")
def test_isilon_bad_host_ip(bad_settings_file): i = Isilon(api_class="StatisticsApi", settings_file=bad_settings_file) with pytest.raises(IsilonConnectionException) as e: i.call_method(method='get_summary_system', nodes='1,2,3,4') assert str(e.value) == "Unable to connect to the the host 10.20.30.40"
def test_isilon_no_host_specified(): i = Isilon(api_class="StatisticsApi", settings_file="fake.yml") with pytest.raises(IsilonNoHostException) as e: i.call_method(method='get_summary_system', nodes='1,2,3,4') assert str(e.value) == "No host is defined in the settings file"