Announcement

Collapse
No announcement yet.

Check login telnet or SSH

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Check login telnet or SSH

    Hello every one,

    I explain my situation.
    We have are software managing password and we need to check with centreon 1 password user becausse password expire after 2 months.
    so we need to make manipulation for renew this password.
    i don't find plugins for check a login in SSH or Telnet ?

    Sorry if i don't see similar post.
    Thank you in advance for your help.

    Cordialy,

    Marvin.

  • #2
    Hello,

    I find 90% of solution but when is critical, idon't find when make EXIT + print or other for print draft.

    Script create in perl for supervision of Login.

    #!/usr/bin/perl

    use Net::Ping;
    use Expect;
    use strict;

    my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNO WN'=>3,'DEPENDENT'=>4);

    my $device = $ARGV[0];
    my $login = $ARGV[1];
    my $password = $ARGV[2];
    my $timeout = 6;

    my $command = Expect->spawn("telnet $device");
    $command->log_stdout(0);
    $command->slave->stty(qw(-echo));
    $command->expect($timeout, -re => "Username: ") or exit $ERRORS{'CRITICAL'};
    print $command "$login\r";
    $command->expect($timeout, -re => "Password: ") or exit $ERRORS{'CRITICAL'};
    print $command "$password\r";
    $command->expect($timeout, -re => "#") or exit $ERRORS{'CRITICAL'};
    my $prompt = $command->before().$command->match();
    $command->soft_close();
    print "OK - La connexion a fonctionne\n";
    exit $ERRORS{'OK'};

    Comment


    • #3
      Hi,

      I am not a perl expert but it seems your script is testing the access and return ok if success or critical if login is failed.
      If you want to dig further try this link for remote command using nrpe:
      https://forum.centreon.com/forum/cen...s-remotely-ssh
      Or you can use this script which test the login/password:
      https://github.com/HariSekhon/nagios...k_ssh_login.pl

      Comment

      Working...
      X