Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
yellowdog
Posts: 20 Joined: Mon Dec 02, 2013 7:22 am
Post
by yellowdog » Thu Jun 28, 2018 2:54 am
Here is the code.
Code: Select all
#!/usr/bin/perl
$response=`/usr/lib/nagios/plugins/check_by_ssh -H $ARGV[0] -l nagios -t 30 -C "/Outils/nagios_sh/check_diapason_users.sh"`;
print $response;
scottwilkerson
DevOps Engineer
Posts: 19396 Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Post
by scottwilkerson » Thu Jun 28, 2018 7:19 am
Can you run this as the
cacti user?
Code: Select all
/usr/lib/nagios/plugins/check_by_ssh -H 128.1.110.206 -l nagios -t 30 -C "/Outils/nagios_sh/check_diapason_users.sh"
yellowdog
Posts: 20 Joined: Mon Dec 02, 2013 7:22 am
Post
by yellowdog » Thu Jun 28, 2018 8:43 am
It's working after nagios password set.
Code: Select all
sudo -u cacti /usr/lib/nagios/plugins/check_by_ssh -H 128.1.110.206 -l nagios -t 30 -C "/Outils/nagios_sh/check_diapason_users.sh"
nagios@128.1.110.206's password:
43
scottwilkerson
DevOps Engineer
Posts: 19396 Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Post
by scottwilkerson » Thu Jun 28, 2018 8:56 am
Your script cannot enter the password though
you need to setup ssh keys for the cacti user
scottwilkerson
DevOps Engineer
Posts: 19396 Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Post
by scottwilkerson » Thu Jun 28, 2018 8:57 am
e.g.
Code: Select all
su cacti
ssh-copy-id -i ~/.ssh/id_rsa.pub nagios@128.1.110.206
yellowdog
Posts: 20 Joined: Mon Dec 02, 2013 7:22 am
Post
by yellowdog » Thu Jun 28, 2018 9:32 am
I don't understand, I believed it's the nagios user who's executing programs on the remote computers and not cacti.
I don't remember cacti's password, how can I reset it and may I have some problems with my graph s already working ?
scottwilkerson
DevOps Engineer
Posts: 19396 Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Post
by scottwilkerson » Thu Jun 28, 2018 9:37 am
if you enter this on your cacti server you will become the cacti user
Then when you enter this, you are connecting to 128.1.110.206 as nagios, it wants nagios user password
Code: Select all
ssh-copy-id -i ~/.ssh/id_rsa.pub nagios@128.1.110.206
yellowdog
Posts: 20 Joined: Mon Dec 02, 2013 7:22 am
Post
by yellowdog » Thu Jun 28, 2018 10:25 am
Code: Select all
su cacti
This account is currently not available.
Sounds normal because in /etc/passwd it's like this:
Code: Select all
cacti:x:103:104::/usr/share/cacti:/sbin/nologin
scottwilkerson
DevOps Engineer
Posts: 19396 Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Post
by scottwilkerson » Thu Jun 28, 2018 10:33 am
you may have to
I am presuming the cacti user executes the command correct?
yellowdog
Posts: 20 Joined: Mon Dec 02, 2013 7:22 am
Post
by yellowdog » Thu Jun 28, 2018 10:38 am
The same:
Code: Select all
sudo su cacti
This account is currently not available.