Page 1 of 1
Python event handler error
Posted: Thu Nov 19, 2020 9:14 am
by Hussk
I would like help with getting a python event handler working which uses boto3. I have tried the script without being caused by an event and it works without any errors.
within my Python script:
I am getting the response below in the event logs:
Code: Select all
wproc: stderr line 04: ImportError: No module named boto3
How would I go about making this work?
Re: Python event handler error
Posted: Thu Nov 19, 2020 4:19 pm
by gormank
Are you testing as the nagios user?
Is the handler running on the nagios host or remote hosts?
Are you testing on the nagios host or remote hosts?
Re: Python event handler error
Posted: Fri Nov 20, 2020 2:14 pm
by Hussk
Yes, I am testing as a Nagios user and the event handler is running on the Nagios host where I am testing. To clarify I am using nagios core as I previously didn't mention.
More info:
Global event handler enabled and set up. working and tested before.
Code: Select all
define command {
command_name test
command_line /usr/local/nagios/libexec/eventhandlers/test.py $HOSTNAME$ $HOSTSTATE$
}
within my python script:
Code: Select all
#!/usr/bin/python
import sys
import boto3
I have used sys.argv to test the python script to add the macros to a file which worked with no errors.
I have boto3 installed:
Code: Select all
Name: boto3
Version: 1.16.21
Summary: The AWS SDK for Python
Home-page: https://github.com/boto/boto3
Author: Amazon Web Services
Author-email: UNKNOWN
License: Apache License 2.0
Location: /home/ubuntu/.local/lib/python2.7/site-packages
Requires: jmespath, s3transfer, botocore