Filtering optical drives from nscp-local-disk

I’ve rolled out disk checks via director to monitor nscp-local-disk, we’re getting alerted of false positives due to optical drives, both empty and populated, is there an easy way of excluding these?

The example I have is as follows where G, E and I are optical drives…

CRITICAL critical(G:: 1.402GB/1.402GB used, E:: 364KB/364KB used), D:: 17.382GB/34.997GB used, L:: 1.374GB/19.997GB used, M:: 906.047MB/29.997GB used, H:: 43.543MB/15.997GB used, F:: 129.409GB/199.997GB used, C:: 47.324GB/74.509GB used, I:: 0B/0B used


using nscp_disk_arguments, you can pass additional parameters like filters for the check_drivesize check inside NSClient++.


Thanks, I presume that would then have to be per host given the drive letters can and do vary?

Since you’re using the Director, in fact: yes. You might leverage this into host templates where you define a generic custom variable for this, and only override this with specific other host templates you’ll then import into the host objects.


If you want to filter out CDROM and REMOVABLE ones you can give this filter a try

filter=type not in ('CDROM', 'REMOVABLE')


1 Like

That’s exactly what I’m after thanks @anon66228339, so it’s a question of where I can fit that filter into director to roll it out in my generic host template?

If you want to filter it out on all hosts, i would put it into the service template.

Yes makes much more sense that way, is the filter on the service template that could be added in via the director web interface, can’t figure out where to apply it.

edit - Would you not change the definition of the command instead @anon66228339?

No, because then you would have copy the Icinga 2 provided command and create and maintain your own. Better hide this inside the template logic thus overriding any other settings. Bonus: You’ll see that custom variable in the detail views and know about it.

Great thanks @dnsmichi, so it’s just a case of figuring out how to pass that filter in on the service template via the director.

So, I’m feeling mega stupid at the moment, this is one of the last few tweaks I’ve got to make until I can just roll agents out across my whole estate.

I can not figure out for the life of me how to incorporate filter=type not in ('CDROM', 'REMOVABLE') into the service template within director.

I presume, based on previous advice I shouldn’t be editing any of the conf files for director, but I can’t find where I would input the filter within director.

Starting to wish I’d not started with Icinga now but I’m that far along it feels like a waste to throw it away!

First off, navigate into the Commands section and pick external commands.
Locate nscp-local-disk and select the Fields tab.

Now select nscp_disk_arguments and add this field. This exports the field for usage in your service and host templates (and objects).

Once that’s done, you’ll go back into your service template (newly created or existing, doesn’t matter).

Pick the nscp-local-disk as check_command, if not done yet. The Custom Properties line has now an additional field entry, the one you’ve defined before.

Select and add the value filter=type not in ('CDROM', 'REMOVABLE') to it. Save it and deploy your services which import this template.

Should work (haven’t tested this, just clicked around in my Vagrant box).