• 0

LM Article Larger Images Please



Hello, someone asked me to add this to our LM and sent me this article yet I'm not an ant so I can't see what those screenshots are showing.
Can LM doc folks please update this articles pictures with a larger size or if you click on it to actually show what its trying to show.
Article here: https://www.logicmonitor.com/blog/extend-net-snmp-how-to-teach-an-old-snmpd-new-tricks/





Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0
  • Administrators

Better quality images are definitely needed there.

However, I recommend against extending snmp. It's messy, performance is not great, and requires stuff on the remote side to work. Better to use Expect or JSch scripted DSs. I've a couple of examples I can link when I get back to the office in a few minutes. 

  • Like 1
Link to post
Share on other sites
  • 0
  • Administrators

Here you go: https://github.com/sweenig/lmcommunity/blob/master/PiJuice/collect.groovy

In this script, I compose the python script within my groovy script. Then the groovy script connects to the server via SSH, runs the script on the command line, grabs the output, then extracts the data from the returned json. 

//SETUP PORTION OMITTED (it's in the linked github repo)
pythonScript = """import json
from pijuice import PiJuice
output = {}
output["charge"] = x.status.GetChargeLevel()
output["status"] = x.status.GetStatus()
output["temp"] = x.status.GetBatteryTemperature()
output["voltage"] = x.status.GetBatteryVoltage()
output["current"] = x.status.GetBatteryCurrent()
output["iovoltage"] = x.status.GetIoVoltage()
output["iocurrent"] = x.status.GetIoCurrent()

power_input_status = ["NOT_PRESENT": 0, "BAD": 1, "WEAK": 2, "PRESENT": 3]
battery_status = ["NORMAL": 0, "CHARGING_FROM_IN": 1, "CHARGING_FROM_5V_IO": 2, "NOT_PRESENT": 3]

try {
  def userCmd = getCommandOutput("python3 -c \"${pythonScript.replaceAll("\"","'").replaceAll("\n",";")}\"")
  data = new JsonSlurper().parseText(userCmd)
  println("5v_power_input_status: ${power_input_status[data.status.data.powerInput5vIo]}")
  println("charge: ${data.charge.data}")
  println("battery_status: ${battery_status[data.status.data.battery]}")
  println("power_input_status: ${power_input_status[data.status.data.powerInput]}")
  return 0
catch (Exception e) {println "Unexpected Exception : " + e; return 1}

//FUNCTIONS OMITTED (it's in the linked github repo)


Link to post
Share on other sites
  • 0

Hi Stu, if we don't have an ssh user/pass then we need to still use the old method?
What's a simple OOTB snmp DS that I can use to clone, change the OID to poll to create this custom DS? Its for monitoring MISP jobs status?





Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.