Jump to content

Steve G

Hornbill Developer
  • Posts

    748
  • Joined

  • Last visited

  • Days Won

    31

Posts posted by Steve G

  1. Hi @AndyGilly,

    Looks like it's timing out when trying to retrieve your instance API endpoint details from files.hornbill.com - possibly due to a firewall or proxy getting in the way... Does the account and machine that's running Power BI (and therefore R) have access to https://files.hornbill.com/instances/YOURINSTANCEID/zoneinfo, replacing YOURINSTANCEID with your instance ID? :) 

    We may need to add specific proxy support to the scripts too, I'll take a look at that.

    Cheers,

    Steve

  2. Hi @AndyGilly,

    I've just given the R scripts a whirl through R v4.0.2, and they are working fine. The process I followed to install and configiure this is as so:

    1. Downloaded and installed R v4.0.2 from here: https://cran.r-project.org/bin/windows/base/ ;
    2. Opened RGui for the newly installed version of R, and installed the httr & readr packages (and dependencies) from within there (I used the UK - London repo, but that shouldn't matter as they are mirrored);
      • image.png
      • image.png
    3. Opened Power BI, navigated to Options and settings > Options > R scripting, and set the Detected R home directories option to the version of R that I just installed:
      • image.png
    4. Run the existing scripts as a Power BI data source, and they return the dataframe as expected.

    So I think this must be an environmental issue in your R/Packages/Power BI configuration...

    Could you check the above steps (2 and 3 probably being the most important) and let me know how you get on?

    Also, if you don't want to use R to pull data in to Power BI from Hornbill, then you could always use the (slightly friendlier) Python data source scripts to perform this.

    Cheers,

    Steve

  3. Hi @Adrian Simpkins,

    No, the IT Service Management Connector in Azure currently does not support Hornbill - but there's no reason why you couldn't use a combination of Azure Monitor, Azure Automation and the PowerShell Runbooks and Modules that we have provided (and are available from the PowerShell Gallery, or from the Runbooks and Modules galleries in Azure Automation) to perform the same functionality... You could (and this is VERY high level) add a Runbook to Azure Automation that takes relevant inputs and makes a call to the Hornbill API to log an incident (examples), then configure your alerts in Azure Monitor to call that Runbook when the thresholds are breached. It's been a while since I set up Azure to do that, but from what I remember it was fairly straight forward...

    I'll add a task to our list to investigate what needs to happen to become a supported tool in the Azure IT Service Management Connector, but the above should get you going in the meantime.

    Let me know how you get on.

    Cheers,

    Steve

    • Like 1
  4. Hi @chriscorcoran,

    The only ways I can replicate this error are:

    • If the channel is only allowed to be posted to by moderators, and the user who you created the keysafe key with is not a moderator (usually Team Managers);
    • If the user who you created the keysafe key with is not a member of the Team.

    So I think it must be one of those scenarios? Forbidden would suggest a permissions issue, so I would check for either of the above...  

    Cheers,

    Steve

  5. We've just released a new package to the ITOM Package Library: Windows Management

    The package contains the following operations that can be performed against your Windows targets:

    • Services - Start
    • Services - Stop
    • Services - Restart
    • Services - Get
    • Services - Startup Disabled
    • Services - Startup Manual
    • Services - Startup Automatic
    • Environment Variable - Get
    • Environment Variable - Set
    • Environment Variable - Delete
    • Process - Get
    • Process - End
    • Process - Start
    • Set Execution Policy

    The package is available to install from the Package Library now, and you can find more details about this package on the Hornbill Wiki.

    If you have any questions, or suggestions of additional operations for this package, then please let us know here.

    Thanks,

    Steve

    • Thanks 1
  6. Hi @AndyGilly,

    This can be done using the Hornbill API. An example in Postman:

    image.png

    Where the URL is built using the Endpoint field from the About  modal in the Admin console, followed by the service (automation) and the method (runbookRun):

    image.png

    The request is authenticated using a Hornbill API Key in the request headers:

    image.png

    And the body is JSON, and made up of the service, method and params, including the Runbook Name (the Process ID from the Runbok settings), and an array containing the input params as defined in your Runbook settings:

    {
    	"methodCall":{
    		"@service":"automation",
    		"@method":"runbookRun",
    		"params": {
    			"name":"add-ram-to-vm",
    			"inputParam":[
    				{
    					"name":"VMName",
    					"value":"DEV-A-WRK-10-64"
    				},
    				{
    					"name":"SetRAM",
    					"value":"1.5GB"
    				}
    			]
    		}
    	}
    }

    image.png  

     

    The API is documented here: https://api.hornbill.com/automation/?op=runbookRun

    Let me know if you need any more information regarding this!

    Cheers,

    Steve

  7. Hi @Will J Douglas,

    The current Teams integration doesn't support adding mentions. That particular feature was not added as there's no nice way of doing it due to complications in the API that Microsoft provide to perform this task - it's not as straightforward as @ mentioning someone I'm afraid. 

     With your requirement, would the mentions be hard-coded into the body input parameter? So they wouldn't be dynamic and driven by a field in the Request? If so, then we may be able to provide something like the attached, and give you an additional input parameter for you to define the IDs for the users you are mentioning in 1 & 2:

    image.png

    It's not an elegant solution, but probably the best we could do while we wait for Microsoft to push the API out of beta, hopefully with better support for mentions...

    Thanks,

    Steve

     

  8. Hi @Martyn Houghton,

    The Hornbill Python API Library has been updated on Github to support complex input parameters. Here's an example of its use:

    from xmlmc import XmlmcService
    from xmlmc import XmlmcHelper
    
    xmlmc = XmlmcService("yourinstanceid")
    xmlmc.set_api_key("yourapikey")
    xmlmc.add_param("application", "com.hornbill.servicemanager")
    xmlmc.add_param("entity", "Requests")
    elem = xmlmc.add_param("primaryEntityData")
    childElem = elem.add_child("record")
    childElem.add_child("h_pk_reference", "IN00013316")
    childElem.add_child("h_summary", "This is the summary, as set by my Python script")
    json_string = xmlmc.invoke("data", "entityUpdateRecord")
    if XmlmcHelper.is_call_success(json_string):
        auditTransactionId = XmlmcHelper.get_param_value(json_string, "params/auditTransactionId")
        print(auditTransactionId)
    else:
        print(XmlmcHelper.get_error_message(json_string))

    Cheers,

    Steve

  9. Hi @Martyn Houghton,

    I've just had a look at the Python API Library, and it appears that it doesn't support complex parameters - which makes it pretty useless :( I'll add a re-write of that to the list, but for the time being I've knocked up a very basic example of how you can call that API in Python without the XMLMC module (or indeed XML at all), using a small function to make the call using the requests module:

    # entityUpdateRecord.py
    # This script is an example of how to call a Hornbill API in Python
    
    import requests
    import sys
    
    apiKey = 'apikey'           # This is the (case sensitive) API key to use to authenticate the API calls against the Hornbill instance
    instanceId = 'instanceid'   # This is the (case sensitive) ID of your Hornbill instance
    
    # Get API endpoint from the instanceId
    URL = 'https://files.hornbill.com/instances/{instanceId}/zoneinfo'.format(instanceId=instanceId)
    try:
        endpoint = requests.get(url = URL).json()["zoneinfo"]["endpoint"]
    except requests.exceptions.RequestException as e:
        sys.exit('Unexpected response when attempting to retrieve Hornbill Zone Information: ' + e)
    
    # Define a function to make API calls
    def invokeXmlmc(service, method, params):
        xmlmcEndpoint = endpoint + "xmlmc/{service}/?method={method}" 
        URL = xmlmcEndpoint.format(service=service, method=method)
        headers = {
            'Content-type': 'application/json',
            'Accept': 'application/json',
            'Authorization': 'ESP-APIKEY ' + apiKey
        }
        data = {
            'methodCall':{
                '@service':service,
                '@method':method,
                'params':params
            }
        }
        try:
            response = requests.post(url=URL, json=data, headers=headers)
            if 200 >= response.status_code <= 299:
                return response.json()
            else:
                return {
                    '@status': False,
                    'state': {
                        'error': 'Unexpected status returned from call to {service}::{method}: {statusCode}'.format(service=service, method=method, statusCode=response.status_code)
                    }
                } 
        except requests.exceptions.RequestException as e:
            return {
                '@status': False,
                'state': {
                    'error': 'Unexpected response from call to {service}::{method}: {errorString}'.format(service=service, method=method, errorString=e)
                }
            }
        
    # Build API Params object in JSON
    paramsJson = {
        'application': 'com.hornbill.servicemanager',
        'entity': 'Requests',
        'primaryEntityData': {
            'record': {
                'h_pk_reference': 'IN00013316',
                'h_summary': 'This is the summary, as set by my Python script'
            }
        }
    }
    
    # Make API Call
    apiResponse = invokeXmlmc('data', 'entityUpdateRecord', paramsJson)
    if apiResponse['@status'] != True:
        sys.exit(apiResponse['state']['error'])
    
    # Print the response to show it worked
    print(apiResponse)

    Hope that helps, let me know if you need any of it explaining.

    Cheers,

    Steve

  10. HI @Jamie Talbot,

    If you want to create a new row in a Google Sheets spreadsheet, you should use the Append integration, as the Update integration is for updating existing rows in a sheet.

    For your use case, the Update node, and Cell Data parameter, should be configured as so, where the first Cell Value contains the request reference, and the second Cell Value contains the request summary. 

    image.png

    Let me know if you need any more information.

    Thanks,

    Steve

    • Like 1
×
×
  • Create New...