Page 1 of 1

Monitoring new filesystems

Posted: Thu May 16, 2019 12:30 pm
by paul.omalley
Hello:
I am reaching out to inquire about how I might be able to recognize a newly added local filesystem automatically and have a service added to monitor it using the NCPA agent?

Basically, I want to do the following:

1) A new local filesystem /fs3 is added to server A
2) The 'check_disk' plugin runs on server A and lists all local filesystems
3) The plugin sees /fs3 as new and a new service is added using default thresholds and notifications

Are there any techniques for doing this built into any Nagios XI plugins?

And, we would need a way to exclude certain patterns (ex. /var/lib/docker).

Thanks,
Paul

Re: Monitoring new filesystems

Posted: Thu May 16, 2019 4:32 pm
by npolovenko
Hello, @paul.omalley.
We don't officially have this feature but recently I was thinking of a way to implement this. Here is what I've discovered.

There is a query in NCPA to automatically detect and show all logical volumes.

Code: Select all

curl -k https://192.168.4.172:5693/api/disk/logical?token=mytoken
Where token is the ncpa token, and IP is the IP of the remote server with NCPA installed.

This is the output from the query. |boot and | are two logical volumes automatically detected.

Code: Select all

"logical": {
        "|boot": {
            "used_percent": [
                60.1, 
                "%"
            ], 
            "inodes_free": [
                511641, 
                "inodes"
            ], 
            "used": [
                0.29, 
                "GiB"
            ], 
            "opts": "rw,relatime,attr2,inode64,noquota", 
            "device_name": [
                "/dev/sda1"
            ], 
            "total": [
                0.48, 
                "GiB"
            ], 
            "inodes": [
                512000, 
                "inodes"
            ], 
            "inodes_used": [
                359, 
                "inodes"
            ], 
            "free": [
                0.19, 
                "GiB"
            ], 
            "fstype": "xfs"
        }, 
        "|": {
            "used_percent": [
                12.6, 
                "%"
            ], 
            "inodes_free": [
                28758221, 
                "inodes"
            ], 
            "used": [
                3.48, 
                "GiB"
            ], 
            "opts": "rw,relatime,attr2,inode64,noquota", 
            "device_name": [
                "/dev/mapper/centos-root"
            ], 
            "total": [
                27.49, 
                "GiB"
            ], 
            "inodes": [
                28844032, 
                "inodes"
            ], 
            "inodes_used": [
                85811, 
                "inodes"
            ], 
            "free": [
                24.01, 
                "GiB"
            ], 
            "fstype": "xfs"
        }
    }
}
Here's our tutorial to deploy, install NCPA agents on remote Linux servers and automatically create services in XI with Ansible:
https://www.youtube.com/watch?v=Vkwf5Rp3Kj4

If you look at this Ansible task:

Code: Select all

/usr/local/nagiosxi/scripts/automation/ansible/ncpa_autoregister/roles/register_with_xi/tasks
It uses the API command to create a Disk Service in XI, but its only creating 1 disk check with generic root partition "|". It doesn't automatically parse the output from the first query I showed you. Because my query showed "|boot" and "|" logical volumes, and it's only adding the | volume.

So technically there should be another API command, just like this one but instead of | it should have |boot, to create another check for the boot volume.
Untitled.png
The conclusion is that what you're looking for is not supported yet. But you can implement it yourself if you find a way to parse logical volume names from the query #1 and put them in the API command that creates disk check services in XI.

Hope this helps.

Re: Monitoring new filesystems

Posted: Wed Jun 05, 2019 12:51 pm
by paul.omalley
This is great information ! We have recently ordered Ansible and are in process of implementing. thanks!

Re: Monitoring new filesystems

Posted: Wed Jun 05, 2019 1:58 pm
by npolovenko
@paul.omalley, Glad I could help!