Nagios-Monitoring the webservices - nagios

I am new to Nagios.We need to configure in nagios for monitoring a web service.
We have given below command in nagios server:
check_http_I!XX.X.XXX.X!-k 'SOAPAction: "urn:LEOACTIVEService"' -r '<ns:_LEO_ERROR_FND>N</ns:_LEO_ERROR_FND>' -T text/xml -P '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"<soapenv:Header/><soapenv:Body><leo:leoactive><\!--Optional:--><leo:param0><\!--Optional:--><leo:_EXTRACTS><\!--Optional:--><leo:_LEO_ERROR_FND></leo:_LEO_ERROR_FND></leo:_EXTRACTS></leo:param0></leo:leoactive></soapenv:Body></soapenv:Envelope>' -p 10010 -u
http://XX.X.XXX.X:10010/web/services/LEOACTIVEService/LEOACTIVE
Please advise getting error.
Not sure if any error in configuration script.Kindly let me know if any further information required.
Thanks In Advance!!

Related

PHP Script to copy database from one server to another

I have a scenario where I need to copy production database to my dev database on daily basis. Both are different servers. What I have thought of writing a cronjob that will do the stuff. I have written a php script. I am connecting to remote production server via sshpass, taking its dump and then populating that dump.
exec("sshpass -p 'mypassword' ssh root#IP_ADDRESS:PORT");
exec("mysqldump -u root -p DB > production_dump.sql");
exec("mysql -u root -p test < production_dump.sql");
But at first line it throws error of stating
ssh: Could not resolve hostname IP_ADDRESS:PORT: Name or service not known
I have tried given solution on internet but non of them worked. Can any on please explain what I am doing wrong?
Your command is failing because it's not formatted right. You need to use one of the following formats:
sshpass -p 'mypassword' ssh root#IP_ADDRESS PORT
sshpass -p 'mypassword' ssh root#IP_ADDRESS -p PORT
sshpass -p 'mypassword' ssh ssh://root#IP_ADDRESS:PORT
However, I'm not sure if the rest of the script will work, especially if it starts asking for a password. A bash script would be the way to go.

Nagios Invalid Password

First I get this error "connect to address 10.0.0.102 and port 12489: Connection refused", then I made some changes according to forums and I changed nclient.ini file. I adjusted the allowed hosts and password.
Then server side the Status Information is changed. Now I get this error in Nagios Admin Panel:
NSClient - ERROR: Invalid password.
However, at Nagios XI Server I checked password and it's same as in nsclient.ini file on client side.
I used this command to check:
/usr/local/nagios/libexec/check_nt -H 'hostname' -s nagpasswd -p 12489 -v CPULOAD -w 80 -c 90 -l 5,80,90,10,80,9 NSClient
What might be the issue? Any help would be perfect.
after changing the password , you need to restart your nagios service once

PgBouncer - Can users in "admin_users" use "auth_query" to connect instead of userlist.txt?

I am trying to authenticate the users listed in "admin_users" by using the "auth_query" instead of hardcoding the passwords in userlist.txt... but I don't think this is possible in the latest version of pgbouncer (v1.8.1).
Please someone tell me I'm wrong!
Below is an example of the problem, and I can find no workaround. In fact, I've got a bug and an enhancement logged with the project... but I'd love for someone to point out some silly mistake I've made:
https://github.com/pgbouncer/pgbouncer/issues/302 (Crashing bug)
https://github.com/pgbouncer/pgbouncer/issues/303 (Enhancement request)
EXAMPLE
pgbouncer.ini
[databases]
* = host=localhost port=5432 auth_user=pgbouncer
[pgbouncer]
auth_query = SELECT uname, phash FROM pgbouncer.user_lookup($1);
admin_users = postgres,gclough
userlist.txt
"pgbouncer" "password"
Logins work to both the database (port 5432) and pgbouncer (port 6432):
[root#localhost pgbouncer]# /usr/pgsql-9.6/bin/psql -h 127.0.0.1 -U gclough -p 5432 postgres
Password for user gclough:
psql (9.6.9)
Type "help" for help.
postgres=# \q
[root#localhost pgbouncer]# /usr/pgsql-9.6/bin/psql -h 127.0.0.1 -U gclough -p 6432 postgres
Password for user gclough:
psql (9.6.9)
Type "help" for help.
postgres=# \q
But if I try to login to pgbouncer, then it fails:
[root#localhost pgbouncer]# /usr/pgsql-9.6/bin/psql -h 127.0.0.1 -U gclough -p 6432 pgbouncer
psql: ERROR: No such user: gclough
Unless I put my user into userlist.txt:
"pgbouncer" "password"
"gclough" "trustno1"
Then it works:
[root#localhost pgbouncer]# /usr/pgsql-9.6/bin/psql -h 127.0.0.1 -U gclough -p 6432 pgbouncer
Password for user gclough:
psql (9.6.9, server 1.8.1/bouncer)
Type "help" for help.
pgbouncer=#
My money is on the bet that this is pgBouncer issue #278.
The auth_query setting is not yet known when the [database] section is parsed, so pgBouncer is not smart enough to know that it should use that query.
Reorder the configuration file such that the [pgbouncer] section is before the [databases] section and see if that makes a difference.

Using Nagios check_log command doesn't work

Firstly, sorry for my english.
I try to configure a probe in nagios for monitor log files and notify me when Nagios find string like "Exception" or "Error".
I use Nagios with Centreon.
So, when I execute my command :
$USER1$/check_log -F path/for/log.files -q /Exception/
Nagios return : "Log check error: Log file path/for/log.files does not exist!"
When i check in my server the path, the files exists, all (root, group and other) can read the file. So the problem doesn't seem to come of rights management.
The client for supervisor is a CentOS. I have already install nrpe client, and configure allowed host etc ...
I looked everywhere for someone who had the same error but find nothing.
If someone can help me, it would be so nice !
If you need further informations for help me, please, don't hesitate, i'm not sur that i'm explain in good way my problem.
Regards.
On Nagios server side, you must define something like this:
define service {
service_description service_name
host_name your_remote_hostname
use your_template
check_command ext_check!check_log!-f path/for/log.files -g /Exception/
}
In commands.cfg or in similar file on Nagios server:
define command{
command_name ext_check
command_line $USER1$/check_nrpe -t 30 -H $HOSTADDRESS$ -p 5666 -c $ARG1$ -a $ARG2$
}
On client/monitored host you must edit nrpe.cfg file:
command[check_log]=/opt/nagios/plugins/check_log $ARG1$
after that, you must restart nrpe service and reload Nagios configuration.

Mysqldump connecting issue

I'm trying to make dump with next command:
mysqldump -v -u root -p -h 127.0.0.1 -P 3308 -x --add-drop-table
--add-locks --create-options -K -e -q -A > database.sql
The result (after password input) is message "Connecting to 127.0.0.1...". After this is nothing (no any errors, just waiting).
database.sql is empty file.
Why I see no any activity? Is it bug?
From http://linuxcommand.org/man_pages/mysqldump1.html
The password to use when connecting to the server. If you use the
short option form (-p), you cannot have a space between the option and
the password. If you omit the password value following the --password
or -p option on the command line, you are prompted for one.
The system may be waiting for you to input a password.
If you want to avoid that just add the password in the command. Assuming your password is "FLOWER":
mysqldump -v -u root -pFLOWER -h 127.0.0.1 -P 3308 -x --add-drop-table --add-locks --create-options -K -e -q -A > database.sql
This problem, as you describe it, can be caused by the mysql server not running or not being available on the host (in your case, localhost), or it is running but not on that port.
What kind of a system is it? If it is a flavor of linux/unix, you can run
ps -ef|egrep mysql
to see if the mysql server is running. Check the equivalent command on Windows or whatever else you may be running. Also, you can verify that this is the problem by seeing if this works:
mysql -u root -p -h 127.0.0.1 -P 3308
The solution is to start the server:
/etc/init.d/mysqld start
or the equivalent on your system.
Note: if it is running, determine what port it is on - it is possible that you are not specifying the right port number. The default is 3306 - it is unusual that you are using a non-standard port.

Resources