Re: strange problem running script through net-snmp extend

Luke Salsich <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
Dave,

Thanks for the input. After lots of struggling it turned out to be a problem
caused by Selinux. I could have sworn I had turned this off way before I
started testing, but the logs told a different story.

So, for anyone else having problems executing scripts on remote hosts: the
SNMP service runs as root, but it might be blocked from accessing some files
(such as .sock and .lock) files by Selinux. Just disable Selinux and
it should work.

Luke


On Tue, Jul 20, 2010 at 4:02 AM, Dave Shield <[email protected]>wrote:

> On 14 July 2010 14:27, Luke Salsich <[email protected]> wrote:
> > So, I added a script which logs into mysql, checks that the replication
> > service is running and outputs certain responces based on what it finds.
>
>
> > When I add this to the snmpd.conf
> > extend mysql-slave /usr/local/bin/check-mysql-slave.pl --user monitor
> --pass 'xxxpassword'
> > restart the snmpd service,
> > and then run 'snmpgetnext -v2c -c groupzero localhost
> NET-SNMP-EXTEND-MIB::nsExtendOutputFull'
> > I get this back
> > 'NET-SNMP-EXTEND-MIB::nsExtendOutputFull."mysql-slave" = STRING: UNKNOWN
> -
> > Connect failed: Can't connect to local MySQL server through socket
> '/var/lib/mysql/mysql.sock' (13)'
>
> Sorry for the delay in responding to this query.
>
> I have to say that nothing immediately jumps out as being obviously wrong.
> Things that might be relevant:
>
>  -  When running the command manually, you're using a shell, so the command
>     will undergo the usual shell interpretation.   When using extend, this
> is
>     probably not the case.   So in particular, I'd be wary of the quotes
> round
>     the password.  Is there a whitespace in this password?
>         Try a password without whitespace (and omit the quotes)
>
>  -  Similarly, the shell knows to check the first line of the script for #!
>      and invoke the appropriate interpreter (presumably perl).   I'm not
>      100% convinced that extend will work the same way.
>         Try configuring the agent using
>              "extend mysql-slave /usr/bin/perl
> /usr/local/bin/check-mysql-slave.pl ....
>
>  - Is there anything in the shell environment (or other local
> configuration) that
>        specifies how MySQL should connect to the database server?
>        Try specifying the connection information explicitly within your
> script.
>
>
> Those are the only things that spring to mind at the moment.
>
> Dave
>

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first

_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.