[Nagiosplug-devel] Anyone have experience with writing plugins in "expect"
sean finney
seanius at seanius.net
Fri Oct 15 06:36:17 CEST 2004
On Wed, Oct 13, 2004 at 05:44:32PM +0800, Hsiu-Fen Hung wrote:
> #!/usr/bin/expect
> spawn ssh -l xxxx xx.xx.xx.xx "/opt/ecs/bin/almsummary"
> expect -re "Password: "
> send "xxxxxxxx\rr"
just for the record, there's a much more secure way of doing this.
create an ssh public/private keypair, let's say nagios_cmd_1 and
nagios_cmd_1.pub. create these keys without a passphrase, and then in
nagios_cmd_1.pub, prefix the key with the text:
command="/opt/ecs/bin/almsummary"
now you have an ssh keypair which can be used in a script without requiring
any password, and it can only be used to execute the command you've
specified in the public key. put it in the .ssh/authorized_keys file
on your destination machines. i do something like this to check
disk, load, and swap on all my machines.
sean
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://nagios-plugins.org/archive/devel/attachments/20041015/9767989b/attachment.sig>
More information about the Devel
mailing list