Example #1
0
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'}"
Example #2
0
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."
Example #3
0
#! /usr/bin/env python3
from isilon import Isilon

# The Isilon class sets up the connection to the Isilon and provides an object
nodes = []
nodes.append(
    Isilon(api_class="StoragepoolApi", settings_file='node_1_settings.yml'))
nodes.append(
    Isilon(api_class="StoragepoolApi", settings_file='node_2_settings.yml'))
nodes.append(
    Isilon(api_class="StoragepoolApi", settings_file='node_3_settings.yml'))
nodes.append(
    Isilon(api_class="StoragepoolApi", settings_file='node_4_settings.yml'))

responses = []
for node in nodes:
    responses.append(
        node.call_method(method='get_storagepool_nodepool',
                         storagepool_nodepool_id='v200_100gb_6gb'))

for response in responses:
    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}")
Example #4
0
#! /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}")
Example #5
0
#! /usr/bin/env python3
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}")
Example #7
0
#! /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}")
Example #8
0
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"
Example #9
0
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"
Example #10
0
def test_isilon_with_invalid_class():
    with pytest.raises(IsilonInvalidClassException) as e:
        Isilon(api_class="InvalidClass")

    assert str(
        e.value) == "There is no class called 'InvalidClass' in the Isilon SDK"
Example #11
0
def test_isilon_can_be_created():
    i = Isilon(api_class="StatisticsApi")

    assert isinstance(i, Isilon)