Reply

Generate custom issue in python

Techie
Posts: 8
3317     0

Hello, I followed the example from the "Getting started with 5 scripts' to generate a custom issue in python. After some minor modification, my script runs without error but the custom issue created doesn't contain the attributes (defined as string) Device, IPAddress, and Contact in the Custom Issue.Am I missing something?

 

 

####################################################

import requests, json, re

from infoblox_netmri.easy import NetMRIEasy

# This values will be provided by NetMRI before execution

defaults = {
"api_url": api_url,
"http_username": http_username,
"http_password": http_password,
"job_id": job_id,
"device_id": device_id,
"batch_id": batch_id
}

 

# Create NetMRI context manager. It will close session after execution

with NetMRIEasy(**defaults) as easy:

    device = easy.get_device()
    easy.log_message('info', device_devicename)

    snmpcommand = easy.send_command('show run | incl contact')
    devicecontact = snmpcommand.strip("snmp-server contact ")

    issue_id = easy.generate_issue("NewDiscovery","Info",**{
        "Device": device_devicename,
        "IPAddress": device_deviceipdotted,
        "Contact": devicecontact,

        "device_id": device_id,
        "batch_id": batch_id
    })

Re: Generate custom issue in python

Superuser
Posts: 115
3317     0

Can you post a Screen Shot of your Custom Issue as well?

Follow me on LinkedIn: https://www.linkedin.com/in/sifbaksh
Twitter: https://twitter.com/sifbaksh

https://sifbaksh.com

Re: Generate custom issue in python

Techie
Posts: 8
3318     0

Sorry for the late reply. I was able to solve the problem. My confusion was due to the different "default" variables in python and NetMRIEasy.

Showing results for 
Search instead for 
Did you mean: 

Recommended for You