Page 1 of 1

Help needed to check filesize..Facing issue while uisng check_myfilesize.pl

Posted: Thu Oct 30, 2025 9:26 am
by DileepKumar
Hi,

I'm using Nagios XI 2026R1, I'm trying to monitor the filesize of a remote server using check_ncpa.py and check_myfilesize.pl(placed on client/remote server) but facing the below issue.

(Usage) : check_myfilesize.pl Filename critical_size warning_size

While trying from Nagios XI as below
./testncpa.py -H HOSTNAME -t TOKEN -M plugins/check_myfilesize.pl -a "/userdata/datastore/lib/config/datastore_007/msgs.db 10000000000 10000000000 "

error is as below which is wrong (In my opinion, it is not taking -a as one argument)
Argument "datastore" isn't numeric in numeric gt (>) at /usr/local/ncpa/plugins/check_myfilesize.pl line 37.
Critical: Current file size is 4096bytes

I'm able to use the plugin locally and it's giving me correct data
./check_myfilesize.pl /userdata/datastore/lib/config/datastore_007/msgs.db 10000000000 100000000000
OK: Current file size is 6219264bytes

Is anyone can help me on this to resolve this or any suggestions to use different plugin for this use case?

Thank You

Re: Help needed to check filesize..Facing issue while uisng check_myfilesize.pl

Posted: Thu Oct 30, 2025 11:12 am
by DileepKumar
Sorry guys.

We can close this issue as it is resolved. posted here after few days of facing the issue and gave it a one last try with some modifications in the command argument.

Solution is as below (posting here as I thought, It will be useful to others)

./testncpa.py -H HOSTNAME -t TOKEN -M plugins/check_myfilesize.pl -a '"/userdata/datastore/lib/config/datastore_007/msgs.db" 10000000000 10000000000'

or

./testncpa.py -H HOSTNAME -t TOKEN -M plugins/check_myfilesize.pl -a "'/userdata/datastore/lib/config/datastore_007/msgs.db' 10000000000 10000000000"


Using the Single quotes around the whole argument list, and a double quotes around the file path or vice versa, ensures that NCPA passes our file path as a single argument to the perl plugin I am using.