Forum Discussion
Have you looked in the exchange and Google?
Failing that, the first question to ask is how would you get the information manually? You'd probably login to the device via ssh, execute a command, then use the output from that command right?
Ok, then you'll need to write a Groovy script to mimic that behavior. Log into the device, execute the command, parse the output.
You'll need two scripts, one for the discovery another for the collection. For discovery, the goal is to identify the objects you want to monitor. Each needs at least an ID and a name. They can be the same. The output of your script (using println() statements) should look like this:
sda1##Disk 1 (sda1)
sdb1##Disk 2 (sda2)
Your collection would then do the same thing but parse the response and output the data itself. The output (using println() statements) should look like this:
sda1.free: 25
sda1.capacity: 300
sda2.free: 5
sda2.capacity: 38
Then your datapoints in your datasource would be free and capacity (or others depending on what's available in the response to your command). You'd use key-value pairs to define the datapoint and use ##WILDVALUE##.free and ##WILDVALUE##.capacity as the keys.
There are a few libraries you can use to open an SSH session and execute a command: Expect, JSCH, and schmizz.sshj (as found in the Common Config Sources).
Related Content
- 5 months ago
- 8 months ago