SQLite variables in check script
Posted: Mon Feb 26, 2018 8:32 pm
I would like to add some information from a local SQLite data base to the status information shown by Nagios. I have a check script which can access that information and provide it in the required format. In fact, I have two versions of this script, one in bash and one in Perl. Both work perfectly when run on the Nagios server under either the nagios account or the apache account. But when run by Nagios itself, the values returned from the data base are always empty. Does anyone have any idea what I'm doing wrong?
Server is running 64-bit Fedora 27 with Nagios 4.3.4. An abbreviated version of the bash script is below.
Server is running 64-bit Fedora 27 with Nagios 4.3.4. An abbreviated version of the bash script is below.
Code: Select all
#! /bin/bash
cmd="/usr/bin/sqlite3 /myuser/machines.sqlite"
os=$( $cmd "select os from table where name = \"$1\";" )
echo os = ${os}