I have a Nagios, and Gammu installed.
When I use gammu as root, like the following :
/usr/bin/gammu identify (or else)
It works, but when I do it as nagios user, i got this answer :
Can't open specified file. Read only?
I even put nagios in the root group, I used visudo with :
nagios ALL=(ALL) ALL
But no … I can’t find any solution with google.
So if someone got an idea, it would be great !I don’t have any error in logs…
This was solved using this link.
So I added :
ALL=(root) NOPASSWD: /usr/sbin/smartctl
And in the plugin :
my $smart_command = '/usr/bin/sudo /usr/sbin/smartctl'
Answer
You will need to put your nagios user in the dialout
group or whatever group it is that has access to the serial ports connected to the GSM modem.
find out with something like this:
ls -l /dev/ttyS2
crw-rw---- 1 root dialout 4, 66 May 17 12:19 /dev/ttyS2
(but replace ttyS2
with the correct device).
Using sudo
is the wrong approach for a program like gammu
that is called by a daemon process.
Attribution
Source : Link , Question Author : Nico , Answer Author : Sven