Ping with custom MTU size?
I have a requirement to ping a device from the collector but using a custom MTU,
Does anyone have any suggestions on the best way to do this? My collectors are all Windows based.
Stephen Cavernelis
Posted 2 years ago·Last reply 2 years ago
6 comments
Stephen Cavernelis
OP2 years agoThanks. I managed to get the following together which seems to work. I want to use it to monitor some remote devices. Thanks for the assistance!
LM User
·2 years agoGreat that it's in Groovy. Makes it cross platform usable. I see now that you meant pinging devices that are already in LM (i thought you meant pinging devices outside LM). Looks like you should be able to use "custom.ping.mtu" as your AppliesTo. Is that what you're doing?
LM User
·2 years agoFYI, you don't need any of those imports. You're not using any of them, so importing them is a waste of CPU cycles.
Stephen Cavernelis
OP2 years agoThanks for the tip, I didn't actually know that.
LM User
·2 years agoYeah, whenever you start a new DS, the UI inserts all the most common imports at the beginning of the script, whether you need them or not. In almost every case, you only need one not the others. It would be actually helpful if LM could prompt you for how you need to collect data and start the script. For example, if you know you need to SSH into a device and execute a command, it would be nice for it to start with a script like this:
This is the skeleton of most of LM's own Linux SSH scripts since they made a snippet that can be imported to do most of the tricky stuff. I'm sure the ME team has a bunch of monitoring recipes that can be used as starters for many scripted datasources. It would be nice if we could walk through a wizard that helps us find a template to get started with (or at least let us browse a repo through the UI and select a template to start with).
LM User
·2 years agoYou could do a scripted datasource using powershell that invokes the ping command with the -l argument. I recommend a multi-instance script (not batchscript) datasource with property based discovery.
Meaning; set a property called ping.targets with a comma separated list of names/IPs you want to ping. Your AppliesTo becomes simply "ping.targets". Your Groovy discovery script would look like this:
Then your script would look like this:
I'm not a powershell guy, so i'm not much help with the collection script. You'd need to take the result and manipulate it into one or more datapoints. Each datapoint would be written to the host using "Write-Host datapointname: Y" where datapointname is the name you want to call the datapoint and Y is the numeric value.