running scripts remotely

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
jwu
Posts: 81
Joined: Wed Jul 24, 2013 2:54 pm

running scripts remotely

Post by jwu »

I have the NagiosXI server that runs CentOS6.5, the server i'm trying to monitor is a SAN that runs Solaris.
I have a script that works on Solaris, is there a way I can run ssh on NagiosXI so I can run the script remotely,
or is there any other method I can run? I couldn't locate any ssh binaries on the NagiosXI server.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: running scripts remotely

Post by slansing »

You could probably use check_by_ssh for this:

http://assets.nagios.com/downloads/nagi ... ng_SSH.pdf
jwu
Posts: 81
Joined: Wed Jul 24, 2013 2:54 pm

Re: running scripts remotely

Post by jwu »

is the check_by_ssh a plugin?
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: running scripts remotely

Post by tmcdonald »

jwu wrote:is the check_by_ssh a plugin?
Yes. The linked documentation will walk you through setting it up and configuring a check with the SSH Wizard.
Former Nagios employee
jwu
Posts: 81
Joined: Wed Jul 24, 2013 2:54 pm

Re: running scripts remotely

Post by jwu »

reason I'm asking is in the document, there's a command
/usr/local/nagios/libexec/check_by_ssh -H remoteip -C uptime
I don't have the check_by_ssh file, will that be an issue?
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: running scripts remotely

Post by tmcdonald »

jwu wrote:reason I'm asking is in the document, there's a command
/usr/local/nagios/libexec/check_by_ssh -H remoteip -C uptime
I don't have the check_by_ssh file, will that be an issue?
You definitely should have one. What XI version are you running? Can you run the following command and post the output?

Code: Select all

ls -l /usr/local/nagios/libexec
Former Nagios employee
jwu
Posts: 81
Joined: Wed Jul 24, 2013 2:54 pm

Re: running scripts remotely

Post by jwu »

Installed Version: 2012R2.9
here's what I have

Code: Select all

[root@cvglobal ~]# ls -l /usr/local/nagios/libexec
total 6896
-rw-r--r-- 1 root   root     5766 Dec 20 09:17 @
-rwxr-xr-x 1 root   root   348489 Jun  5  2013 check_apt
-rwxr-xr-x 1 root   root     6897 Jun  5  2013 check_asterisk.pl
-rwxr-xr-x 1 root   root     4173 Jun  5  2013 check_bl
-rwxr-xr-x 1 root   root     2289 Jun  5  2013 check_bpi.php
-rwxr-xr-x 1 root   root     2274 Jun  5  2013 check_breeze
lrwxrwxrwx 1 root   root        9 Jun  5  2013 check_clamd -> check_tcp
-rwxr-xr-x 1 root   root    50937 Jun  5  2013 check_cluster
-r-sr-xr-x 1 root   root    90393 Jun  5  2013 check_dhcp
-rwxr-xr-x 1 root   root    87837 Jun  5  2013 check_dig
-rwxr-xr-x 1 root   root   390626 Jun  5  2013 check_disk
-rwxr-xr-x 1 root   root     8163 Jun  5  2013 check_disk_smb
-rwxr-xr-x 1 root   root    96262 Jun  5  2013 check_dns
-rwxr-xr-x 1 root   root    46324 Jun  5  2013 check_dummy
-rwxr-xr-x 1 root   root     5625 Jun  5  2013 check_em01.pl
-rwxr-xr-x 1 root   root    38345 Jun  5  2013 check_email_delivery
-rwxr-xr-x 1 root   root    20511 Jun  5  2013 check_email_delivery_epn
-rwxr-xr-x 1 root   root    20039 Jun  5  2013 check_email_loop.pl
-rwxr-xr-x 1 root   root    82881 Jan 14 16:37 check_esx3.pl
-rwxr-xr-x 1 root   root     3143 Jun  5  2013 check_file_age
-rwxr-xr-x 1 root   root     6395 Jun  5  2013 check_flexlm
-rwxr-xr-x 1 root   root    92112 Jun  5  2013 check_fping
lrwxrwxrwx 1 root   root        9 Jun  5  2013 check_ftp -> check_tcp
-rwxr-xr-x 1 root   root     3446 Jun  5  2013 check_ftp_fully
-rwxr-xr-x 1 root   root    90120 Jun  5  2013 check_hpjd
-rwxr-xr-x 1 root   root   468840 Jun  5  2013 check_http
-rwxr-xr-x 1 apache apache   1283 Aug 29  2013 check_hyperv-health.sh
-rwxr-xr-x 1 apache apache   4989 Aug 29  2013 check_hyperv_perf
-r-sr-xr-x 1 root   root    97837 Jun  5  2013 check_icmp
-rwxr-xr-x 1 root   root    59372 Jun  5  2013 check_ide_smart
-rwxr-xr-x 1 root   root    15310 Jun  5  2013 check_ifoperstatus
-rwxr-xr-x 1 root   root    12853 Jun  5  2013 check_ifstatus
lrwxrwxrwx 1 root   root        9 Jun  5  2013 check_imap -> check_tcp
-rwxr-xr-x 1 root   root    35413 Jun  5  2013 check_imap_receive
-rwxr-xr-x 1 root   root    15576 Jun  5  2013 check_imap_receive_epn
-rwxr-xr-x 1 root   root     7429 Jun  5  2013 check_ircd
lrwxrwxrwx 1 root   root        9 Jun  5  2013 check_jabber -> check_tcp
-rwxr-xr-x 1 root   root    73682 Jun  5  2013 check_ldap
lrwxrwxrwx 1 root   root       10 Jun  5  2013 check_ldaps -> check_ldap
-rwxr-xr-x 1 root   root    73570 Jun  5  2013 check_load
-rwxr-xr-x 1 root   root     6062 Jun  5  2013 check_log
-rwxr-xr-x 1 root   root     2683 Apr  2 19:00 check_logwarn
-rwxr-xr-x 1 root   root    20367 Jun  5  2013 check_mailq
-rwxr-xr-x 1 root   root    60034 Jun  5  2013 check_mrtg
-rwxr-xr-x 1 root   root    58891 Jun  5  2013 check_mrtgtraf
-rwxr-xr-x 1 root   root    14024 Jun  5  2013 check_mssql
-rwxr-xr-x 1 root   root    13992 Jun  5  2013 check_mssql_database.py
-rwxr-xr-x 1 root   root    20215 Jun  5  2013 check_mssql_server.py
-rwxr-xr-x 1 root   root    94447 Jun  5  2013 check_mysql
-rwxr-xr-x 1 root   root    98711 Jun  5  2013 check_mysql_health
-rwxr-xr-x 1 root   root    86477 Jun  5  2013 check_mysql_query
-rwxr-xr-x 1 root   root    72511 Jun  5  2013 check_nagios
-rwxr-xr-x 1 root   root     6574 Jun  5  2013 check_nagios_performance.php
-rwxr-xr-x 1 root   root    17443 Jun  5  2013 check_nagiosxiserver.php
lrwxrwxrwx 1 root   root        9 Jun  5  2013 check_nntp -> check_tcp
lrwxrwxrwx 1 root   root        9 Jun  5  2013 check_nntps -> check_tcp
-rwxrwxr-x 1 nagios nagios  75484 Jun  5  2013 check_nrpe
-rwxr-xr-x 1 root   root    93871 Jun  5  2013 check_nt
-rwxr-xr-x 1 root   root    96899 Jun  5  2013 check_ntp
-rwxr-xr-x 1 root   root    87115 Jun  5  2013 check_ntp_peer
-rwxr-xr-x 1 root   root    83893 Jun  5  2013 check_ntp_time
-rwxr-xr-x 1 root   root   125766 Jun  5  2013 check_nwstat
-rwxr-xr-x 1 root   root     8366 Jun  5  2013 check_oracle
-rwxr-xr-x 1 root   root    75803 Jun  5  2013 check_overcr
-rwxr-xr-x 1 root   root    69414 Jun  5  2013 check_pgsql
-rwxr-xr-x 1 root   root    99722 Jun  5  2013 check_ping
-rwxr-xr-x 1 nagios nagios   6183 Jun  5  2013 check_pnp_rrds.pl
lrwxrwxrwx 1 root   root        9 Jun  5  2013 check_pop -> check_tcp
-rwxr-xr-x 1 root   root   281655 Jun  5  2013 check_postgres.pl
-rwxr-xr-x 1 root   root   368792 Jun  5  2013 check_procs
-rwxr-xr-x 1 root   root    23327 Jun  5  2013 check_radius_adv
-rwxr-xr-x 1 root   root    71198 Jun  5  2013 check_real
-rwxr-xr-x 1 root   root     9707 Jun  5  2013 check_rpc
-rwxr-xr-x 1 root   root     9232 Jun  5  2013 check_rrdtraf
-rwxr-xr-x 1 root   root     5299 Jun  5  2013 check_rrdtraf.php
-rwxr-xr-x 1 root   root     1176 Jun  5  2013 check_sensors
lrwxrwxrwx 1 root   root        9 Jun  5  2013 check_simap -> check_tcp
-rw-r--r-- 1 root   root     7599 Jun  5  2013 check_sip
-rwxr-xr-x 1 root   root   406418 Jun  5  2013 check_smtp
-rwxr-xr-x 1 root   root    20226 Jun  5  2013 check_smtp_send
-rwxr-xr-x 1 root   root    10440 Jun  5  2013 check_smtp_send_epn
-rwxr-xr-x 1 root   root   408671 Jun  5  2013 check_snmp
-rwxr-xr-x 1 root   root    10951 Jun  5  2013 check_snmp_boostedge.pl
-rwxr-xr-x 1 root   root    17866 Jun  5  2013 check_snmp_cpfw.pl
-rwxr-xr-x 1 root   root     8747 Jun  5  2013 check_snmp_css_main.pl
-rwxr-xr-x 1 root   root    16786 Jun  5  2013 check_snmp_css.pl
-rwxr-xr-x 1 root   root    33562 Jun  5  2013 check_snmp_env.pl
-rwxr-xr-x 1 root   root    23464 Jun  5  2013 check_snmp_generic.pl
-rwxr-xr-x 1 root   root    31919 Jun  5  2013 check_snmp_int.pl
-rwxr-xr-x 1 root   root    10108 Jun  5  2013 check_snmp_linkproof_nhr.pl
-rwxr-xr-x 1 root   root    22839 Jun  5  2013 check_snmp_load.pl
-rwxr-xr-x 1 root   root    22845 Jun  5  2013 check_snmp_load_wizard.pl
-rwxr-xr-x 1 root   root    18734 Jun  5  2013 check_snmp_mem.pl
-rwxr-xr-x 1 root   root    11898 Jun  5  2013 check_snmp_nsbox.pl
-rwxr-xr-x 1 apache apache  11222 Nov 21 09:51 check_snmp_patchlevel.pl
-rwxr-xr-x 1 root   root    26182 Jun  5  2013 check_snmp_process.pl
-rwxr-xr-x 1 root   root    26183 Jun  5  2013 check_snmp_process_wizard.pl
-rwxr-xr-x 1 root   root    25483 Jun  5  2013 check_snmp_storage.pl
-rwxr-xr-x 1 root   root    25484 Jun  5  2013 check_snmp_storage_wizard.pl
-rwxr-xr-x 1 root   root    14489 Jun  5  2013 check_snmp_vrrp.pl
-rwxr-xr-x 1 root   root    12058 Jun  5  2013 check_snmp_win.pl
-rwxr-xr-x 1 apache apache  15587 Nov 21 14:08 checkSolidFire.py
lrwxrwxrwx 1 root   root        9 Jun  5  2013 check_spop -> check_tcp
-rwxr-xr-x 1 root   root    69150 Jun  5  2013 check_ssh
lrwxrwxrwx 1 root   root        9 Jun  5  2013 check_ssmtp -> check_tcp
-rwxr-xr-x 1 root   root    74852 Jun  5  2013 check_swap
-rwxr-xr-x 1 root   root   123244 Jun  5  2013 check_tcp
-rwxr-xr-x 1 root   root    71296 Jun  5  2013 check_time
lrwxrwxrwx 1 root   root        9 Jun  5  2013 check_udp -> check_tcp
-rwxr-xr-x 1 root   root    84230 Jun  5  2013 check_ups
-rwxr-xr-x 1 root   root    68899 Jun  5  2013 check_users
-rwxr-xr-x 1 root   root     9776 Dec 17 09:56 check_vpn
-rwxr-xr-x 1 root   root     3019 Jun  5  2013 check_wave
-rwxr-xr-x 1 root   root      307 Jun  5  2013 check_webinject.sh
-rwxr-xr-x 1 root   root     7065 Jun  5  2013 check_win_snmp_disk.pl
-rwxr-xr-x 1 root   root     2405 Jun  5  2013 check_wmi_plus.conf
-rwxr-xr-x 1 root   root    46543 Jun  5  2013 check_wmi_plus.ini
-rwxr-xr-x 1 root   root   237155 Jun  5  2013 check_wmi_plus.pl
-rwxr-xr-x 1 root   root      897 Apr  7 12:30 check_zpools
-rwxr-xr-x 1 root   root    75075 Jun  5  2013 negate
-rwxr-xr-x 1 apache apache   2976 Dec  2 14:07 objectnotes.zip
-rwxr-xr-x 1 nagios nagios  42724 Jun  5  2013 process_perfdata.pl
-rwxr-xr-x 1 root   root    64666 Jun  5  2013 send_nsca
-rwxr-xr-x 1 root   root    68322 Jun  5  2013 urlize
-rwxr-xr-x 1 root   root     2035 Jun  5  2013 utils.pm
-rwxr-xr-x 1 root   root      862 Jun  5  2013 utils.sh
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: running scripts remotely

Post by sreinhardt »

That is interesting, this is a part of the plugins package, and should be added with the normal install. Let's go ahead and reinstall the plugins specifically and see if it comes back properly.

Code: Select all

cd /tmp
rm -rf xi*.tar.gz nagiosxi nagiosxi-*.tar.gz
wget http://assets.nagios.com/downloads/nagiosxi/xi-latest.tar.gz
tar xzf xi-latest.tar.gz
cd nagiosxi/subcomponents/nagiosplugins/
./install

ll /usr/local/nagios/libexec | grep ssh
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
jwu
Posts: 81
Joined: Wed Jul 24, 2013 2:54 pm

Re: running scripts remotely

Post by jwu »

I was able to get this work, feel free to close this thread.
here's FYI
http://support.nagios.com/forum/viewtop ... f=6&t=9541
I ran into the same issue, I was not able to get this issue resolved.
Only the test command was not working, it was working on the backend and was able to be added to Nagios.
maybe there is some configuration/permission issues that need to be modified.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: running scripts remotely

Post by abrist »

The test command is limited. It is not so smart about escaping, and it runs as apache, not nagios. Just FYI. Lockin' 'er up!
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked