Page 1 of 1

"ImportError: No module named psutil" when using ncpa

Posted: Tue May 18, 2021 1:56 am
by sacom01
hi,
i write a plugin using psutil function for checking cpu. when i run this plugin on client server it's work fine.
but when i use ncpa for checking it from Nagios XI server, facing to error "ImportError: No module named psutil"
(psutil already exist on client server).
pls donate me advices for this.

Re: "ImportError: No module named psutil" when using ncpa

Posted: Tue May 18, 2021 3:51 pm
by benjaminsmith
Hi,

When you are testing the plugin locally you are logged in as root, however, this will be run as the nagios account when running this from XI. Try logging in as the nagios user account and testing this once. Please post any error output to the thread.

Code: Select all

su - nagios
./cpu_check.py -w 10 -c 20
Also, please share the plugin script and I can try to replicate this on my tet system. Thanks! Benjamin

Reference
NCPA custom plugins scripts and configuration

Re: "ImportError: No module named psutil" when using ncpa

Posted: Tue May 18, 2021 10:51 pm
by sacom01
hi ben,
we found the root cause and fixed it.
need install psutil for python2 beside psutil for python3
pls close the topic
thanks

Re: "ImportError: No module named psutil" when using ncpa

Posted: Wed May 19, 2021 10:22 am
by benjaminsmith
HI sacom01,

Great! Glad to hear you got it working.

We'll go ahead and mark this as resolved.