Code Monkey home page Code Monkey logo

Comments (10)

AmbicaY avatar AmbicaY commented on August 23, 2024

@tdanner can you help?

from orionsdk-python.

danjagnow avatar danjagnow commented on August 23, 2024

What kind of node are you monitoring? 9 is the code for the SnmpCisco polling method. See the Hardware Health page on the Orion SDK wiki for additional details about the options.

from orionsdk-python.

AmbicaY avatar AmbicaY commented on August 23, 2024

Its a network device. Infact a cisco switch. I referred that page, hence used 9 in my code.

But I am not sure how to enable CPU and Mem monitoring/stats collection.

from orionsdk-python.

nothrow avatar nothrow commented on August 23, 2024

Hi,

unfortunately, HardwareHealth and SNMP/CPU polling are implemented in pretty different manner.
For SNMP/CPU polling, you need to add proper pollers to the Orion.Pollers entity. That could be tricky - there are many of them applicable for Cisco SNMP devices, and I can't tell which one to enable.

Orion detects them during inventory step - I'm not sure if it happens during adding node in import. You can check on your own:

SELECT PollerType, Enabled FROM Orion.Pollers WHERE PollerType LIKE 'N.CPU.SNMP.%' AND NetObjectType='N' AND NetObjectId=@your_node_id.

This returns something like 'N.CPU.SNMP.HrProcessorLoad' (for my windows machine). If it is disabled, you can just update the entity, set Enabled to true, and you're good. Same goes for 'N.Memory.%' poller.

In the case they are not there, you need to enforce Inventory re-run.

note: these steps are undocumented, and may change or stop working any time in the future.

There is Orion.NodeSettings entity, which is - pretty much - key-value pair store for nodes.

And the magic here is to add key 'Core.NeedsInventory' with value 'Cpu:Memory'. Orion then should re-run the inventory job, populating pollers table.

from orionsdk-python.

AmbicaY avatar AmbicaY commented on August 23, 2024

Hey nothrow,

What exactly is this inventory job? Anyway to trigger it through code?

Regards,
Ambica

from orionsdk-python.

nothrow avatar nothrow commented on August 23, 2024

You can add, using create operation, key:value Core.NeedsInventory : Cpu:Memory, with proper NodeId, to Orion.NodeSettings entity.

from orionsdk-python.

AmbicaY avatar AmbicaY commented on August 23, 2024

tried it, still does not help.

May be this is not applicable for cisco switches?

For interfaces, we can invoke DiscoverInterfacesOnNode on Orion.NPM.Interfaces entity and then we can add whatever pollers we need. But we dont have any entity related to CPU or Memory or other resources? How is the listresources.aspx working?

from orionsdk-python.

nothrow avatar nothrow commented on August 23, 2024

How is the listresources.aspx working?

Kind of black magic. It calls some local WebAPI endpoints, and does lot of pre/postprocessing. It is not straightforward to use, and cannot be used as public API.

But we dont have any entity related to CPU or Memory or other resources?

Not at this moment. DiscoverInterfacesOnNode were kind of hacked in just for one specific purpose per request.

May be this is not applicable for cisco switches?

WorksForMe(tm). But it is not immediate, it takes some time.

Steps I've taken:

  • I deleted all pollers from the Orion.Pollers entity for given node.
  • I added proper NodeSetting value:
  • Waited for few minutes (10 minutes is the background inventory checker default interval. It can be reduced from settings)
  • Pollers reappear
import requests
from orionsdk import SwisClient

server = 'localhost'
username = 'admin'
password = ''

from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)

swis = SwisClient(server, username, password)

pollers = swis.query("SELECT PollerType, Uri FROM Orion.Pollers WHERE NetObjectID = 1003")

for row in pollers['results']:
    print("Deleting poller {PollerType}".format(**row))
    swis.delete(row['Uri'])

print("Adding nodesetting")
props = {
    'NodeID': 1003,
    'SettingName': 'Core.NeedsInventory',
    'SettingValue': 'Cpu:Memory'
}

results = swis.create('Orion.NodeSettings', **props)

print("wait for 15 minutes (interval of background inventory check)")

Output:

Deleting poller N.Status.ICMP.Native
Deleting poller N.Status.SNMP.Native
Deleting poller N.ResponseTime.ICMP.Native
Deleting poller N.ResponseTime.SNMP.Native
Deleting poller N.Details.SNMP.Generic
Deleting poller N.Uptime.SNMP.Generic
Deleting poller N.Cpu.SNMP.CiscoGen3
Deleting poller N.Memory.SNMP.CiscoGen3
Deleting poller N.Routing.SNMP.Ipv4CidrRoutingTable
Deleting poller N.RoutingNeighbor.SNMP.BGP
Deleting poller N.Topology_Vlans.SNMP.VtpVlan
Deleting poller N.Topology_CDP.SNMP.cdpCacheTable
Deleting poller N.Topology_Layer3.SNMP.ipNetToMedia
Deleting poller N.Topology_Layer3_IpRouting.SNMP.rolesRouter
Deleting poller N.Topology_Layer3_IpRouting.SNMP.ipCidrRouter
Adding nodesetting
wait for 15 minutes (interval of background inventory check)

after few minutes the line from Orion.NodeSettings disappear, and pollers appear:

import requests
from orionsdk import SwisClient

server = 'localhost'
username = 'admin'
password = ''

from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)

swis = SwisClient(server, username, password)

pollers = swis.query("SELECT PollerType, Enabled FROM Orion.Pollers WHERE NetObjectID = 1003")

for row in pollers['results']:
    print("Poller: {PollerType}:{Enabled}".format(**row))

:

Poller: N.Cpu.SNMP.CiscoGen3:True
Poller: N.Memory.SNMP.CiscoGen3:True

Note: it takes some time.

Note2: please, do not delete all pollers on production server. The code with delete was meant only as an example.

from orionsdk-python.

nothrow avatar nothrow commented on August 23, 2024

You can also check that everything works correctly in logs.

"c:\Users\All Users\SolarWinds\Logs\Orion\Core.BusinessLayer.log"

2019-05-16 14:03:27,769 [STP SmartThreadPool Thread #1] INFO  SolarWinds.Orion.Core.BusinessLayer.BackgroundInventoryManager - (null)  Starting inventorying of Node 1003, NeedsInventory = 'Cpu:Memory'
2019-05-16 14:03:28,966 [STP SmartThreadPool Thread #1] INFO  SolarWinds.Orion.Core.BusinessLayer.BackgroundInventoryManager - (null)  Inventorying of Node 1003 completed in 1213ms.
2019-05-16 14:03:28,966 [STP SmartThreadPool Thread #1] INFO  SolarWinds.Orion.Core.BusinessLayer.BackgroundInventoryManager - (null)  Background Inventorying Finished

from orionsdk-python.

danjagnow avatar danjagnow commented on August 23, 2024

This question has been answered, and there hasn't been any recent conversation on this thread, so I am closing this issue for now. Feel free to re-open the issue if additional information is needed.

from orionsdk-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.