- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2015 08:07 AM
Hi All,
I have buit a probe and sensor to a Linux Machine for Discovery purpose for disk space.
Command used : "fdisk -l | grep GB | awk '{print $3}' | paste -sd+ - | bc" Sudo : Required.
Sometimes for a few machines we get the input from the probe (command out put) we get the below output :
Disk /dev/dm-0 doesn't contain a valid partition table Disk /dev/dm-1 doesn't contain a valid partition table Disk /dev/dm-2 doesn't contain a valid partition table Disk /dev/dm-3 doesn't contain a valid partition table Disk /dev/dm-4 doesn't contain a valid partition table Disk /dev/dm-5 doesn't contain a valid partition table Disk /dev/dm-6 doesn't contain a valid partition table Disk /dev/dm-7 doesn't contain a valid partition table Disk /dev/dm-8 doesn't contain a valid partition table Disk /dev/dm-9 doesn't contain a valid partition table 321.2
the last few characters are the disk space.
And the sensor i have built is below : There is no error in the below sensor when i check in the syntax checker, and the javascript code gives correct output when we i check the code with the input from the probe, but if the same code below is not updating the CMDB attribute.
new DiscoverySensor({
process: function(result) {
if (gs.nil(result.output))
return;
this.parseOutput(result.output);
},
parseOutput: function(output) {
var a = output.trim();
var b = a.slice(-8);
var c = b.match(/\d+/);
current.disk_space = c.trim();
},
type: "DiscoverySensor"
});
Can someone hemp me where the error is ? I am stuck at this point on this.
Solved! Go to Solution.
- Labels:
-
Discovery
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2015 12:02 PM
So what you had there was a "problem" that we call a "feature" described in this community post org.mozilla.javascript.NativeArray@... as CI Name when discovering ESX Hosts
You were getting the same issue with that Native Array@ being populated in the field so Ryan rzulli and I had some fun this afternoon and re-wrote the sensor.. you'll see it attached to your probe .. We decided to just loop through the lines and reject the ones that contained disk and took the value at the end..
new DiscoverySensor({
process: function(result) {
if (gs.nil(result.output))
return;
this.parseOutput(result.output);
},
parseOutput: function(output) {
var lines = output.split(/\n/);
for (var i = 0; i < lines.length; i++) {
var line = lines[i];
var disk = line.indexOf("Disk")
if (disk === 0)
{
continue;
}
else
{
current.disk_space = line;
}
}},
type: "DiscoverySensor"
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2015 05:45 PM
Not sure whats going on there.. just send me an email @ doug.schulze@servicenow.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2015 12:02 PM
So what you had there was a "problem" that we call a "feature" described in this community post org.mozilla.javascript.NativeArray@... as CI Name when discovering ESX Hosts
You were getting the same issue with that Native Array@ being populated in the field so Ryan rzulli and I had some fun this afternoon and re-wrote the sensor.. you'll see it attached to your probe .. We decided to just loop through the lines and reject the ones that contained disk and took the value at the end..
new DiscoverySensor({
process: function(result) {
if (gs.nil(result.output))
return;
this.parseOutput(result.output);
},
parseOutput: function(output) {
var lines = output.split(/\n/);
for (var i = 0; i < lines.length; i++) {
var line = lines[i];
var disk = line.indexOf("Disk")
if (disk === 0)
{
continue;
}
else
{
current.disk_space = line;
}
}},
type: "DiscoverySensor"
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2015 05:00 AM
Hi Doug Schulze/Ryan Zulli,
Thanks a lot.
I was not aware of that (Assigning a JS array to a GlideList element results in org.mozilla.javascript.NativeArray@490ee4c8,).
Thanks again for helping.
-Ananth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2015 05:37 AM
Glad to, please be sure to mark your question as answered !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2015 08:13 AM
Hi Doug,
Please can you explain which probe / sensor to update in order to fix this error.
Regards
Tony