Hello Guy,
i have a small problem, i create a script for check the raid status on
Intel mainboards that use the command:
dmraid -r
So, when i run the script with xymon, show the error:
ERROR: you must be root
Do you know how can i fix it?
Thank you very much.
Setuid the script Sudo the command in the script Run the script as root
Take your pick. The first one is not secure in the least. The second one will require the xymon user to be in sudoers with permission to run the command without a password required. Or modifying the script to enter the password (which is not secure) The last is pretty easy, but would be running outside of the tasks.cfg probably in cron. And so you would need to call the script, most likely, with xymoncmd to get the environment right.
Paul.
From: Xymon [mailto:xymon-bounces at xymon.com] On Behalf Of Operaciones Sent: Friday, July 05, 2013 8:44 AM To: xymon at xymon.com Subject: [Xymon] problem with ext script
Hello Guy,
i have a small problem, i create a script for check the raid status on Intel mainboards that use the command:
dmraid -r
So, when i run the script with xymon, show the error:
ERROR: you must be root
Do you know how can i fix it?
Thank you very much.
Thank you Paul, i think that will choose the second option.
Best regards.
El 05/07/13 16:46, Root, Paul T escribió:
Setuid the script
Sudo the command in the script
Run the script as root
Take your pick. The first one is not secure in the least.
The second one will require the xymon user to be in sudoers with permission to run the command without a password required. Or modifying the script to enter the password (which is not secure)
The last is pretty easy, but would be running outside of the tasks.cfg probably in cron. And so you would need to call the script, most likely, with xymoncmd to get the environment right.
Paul.
*From:*Xymon [mailto:xymon-bounces at xymon.com] *On Behalf Of *Operaciones *Sent:* Friday, July 05, 2013 8:44 AM *To:* xymon at xymon.com *Subject:* [Xymon] problem with ext script
Hello Guy,
i have a small problem, i create a script for check the raid status on Intel mainboards that use the command:
dmraid -r
So, when i run the script with xymon, show the error:
ERROR: you must be root
Do you know how can i fix it?
Thank you very much.
On 5 July 2013 23:43, Operaciones <operaciones at corpresa.com> wrote:
So, when i run the script with xymon, show the error:
ERROR: you must be root
What I generally do in these cases is run the command from root's cron and capture the output in a file that's readable by the Xymon user. Like so:
*/5 * * * * /sbin/dmraid -r >/tmp/dmraid.out && chgrp xymon /tmp/dmraid.out && chmod 644 /tmp/dmraid.out
Then in the script, in place of "dmraid -r" you just do "cat /tmp/dmraid.out".
J
Why not just send the output to the server with the xymon command?
From: Xymon [mailto:xymon-bounces at xymon.com] On Behalf Of Jeremy Laidman Sent: Sunday, July 07, 2013 7:42 PM To: Operaciones Cc: xymon at xymon.com Subject: Re: [Xymon] problem with ext script
On 5 July 2013 23:43, Operaciones <operaciones at corpresa.com<mailto:operaciones at corpresa.com>> wrote: So, when i run the script with xymon, show the error:
ERROR: you must be root
What I generally do in these cases is run the command from root's cron and capture the output in a file that's readable by the Xymon user. Like so:
*/5 * * * * /sbin/dmraid -r >/tmp/dmraid.out && chgrp xymon /tmp/dmraid.out && chmod 644 /tmp/dmraid.out
Then in the script, in place of "dmraid -r" you just do "cat /tmp/dmraid.out".
J
Hello Paul,
Thank you by your advice, finally i did some like Jeremy said.
Thank you very much to all.
El 08/07/2013 14:10, Root, Paul T escribió:
Why not just send the output to the server with the xymon command?
*From:*Xymon [mailto:xymon-bounces at xymon.com] *On Behalf Of *Jeremy Laidman *Sent:* Sunday, July 07, 2013 7:42 PM *To:* Operaciones *Cc:* xymon at xymon.com *Subject:* Re: [Xymon] problem with ext script
On 5 July 2013 23:43, Operaciones <operaciones at corpresa.com <mailto:operaciones at corpresa.com>> wrote:
So, when i run the script with xymon, show the error: ERROR: you must be rootWhat I generally do in these cases is run the command from root's cron and capture the output in a file that's readable by the Xymon user. Like so:
*/5 * * * * /sbin/dmraid -r >/tmp/dmraid.out && chgrp xymon /tmp/dmraid.out && chmod 644 /tmp/dmraid.out
Then in the script, in place of "dmraid -r" you just do "cat /tmp/dmraid.out".
J
On Monday, 8 July 2013, Root, Paul T wrote:
Why not just send the output to the server with the xymon command?
Yeah, I like this idea. The command can be sent as a supplementary client command like so:
*/5 * * * * ~xymon/client/bin/xymoncmd sh -c '{ echo client/dmraid $MACHINE; echo "[dmraid]"; /sbin/dmraid -r; } | $XYMON $XYMSRV @'
Then a script on the Xymon server can pull the dmraid output from the client data like so:
#!/bin/sh
DMRAID=$XYMON $XYMSRV "clientlog name.of.host section=dmraid"
This strategy means that all of the heavy lifting is done on the Xymon server, and the client needs only a fairly simple one-liner in a crontab. Improvements to the script need only be applied to the Xymon server, instead of having to perform updates to (for some of us) dozens or more clients.
J
participants (3)
-
jlaidman@rebel-it.com.au
-
operaciones@corpresa.com
-
Paul.Root@CenturyLink.com