Error: -bash: check_nrpe: command not found - nagios

I am using Nagios XI. I issued following command from the Nagios Server:
nagiossrv root [libexec] > check_nrpe -H 128.19.5.131 -t 30 -c check_users -w 5 -c 10
It is giving me following error:
-bash: check_nrpe: command not found
I have also added the IP address of the Nagios server (nagiossrv) to the /usr/local/nagios/etc/nrpe.cfg file at the host's (128.19.5.131) side.
What is the issue?

After a little research, I got above error resolved. Just had to enter the command as follows:
nagiossrv root [libexec] > /usr/local/nagios/libexec/check_nrpe -H 128.19.5.131 -t 30 -c check_users -a '-w 5 -c 10'
And the output would look like:
USERS OK - 1 users currently logged in |users=1;5;10;0

Related

Retrieve rows in DB corresponding to particular ID using kubectl

I am trying to fetch the no. of rows for a particular ID using kubectl but instead getting some extra data.
Command:
kubectl exec abc-db-0 -n cicd --kubeconfig /root/admin.conf -- bash -c "psql -U postgres -d db -f /tmp/queryInstanceId.sql -v v1=full_test | grep [0-9]"
Actual Output of above command:
Defaulting container name to abc-db.
Use 'kubectl describe pod/abc-db-0 -n cicd' to see all of the containers in this pod.
(0 rows)
Expected Output:
(0 rows)
Could anyone please let me know what I am doing wrong here?
Note:
The first 2 lines always comes when we login to the DB manually but in output I only want (0 rows)
The first two lines are output by kubectl exec because the Pod has multiple containers. It is sort of a warning that it picked the first one, which might not be the one you wanted use.
You can specify the target container in your command (-c containername):
kubectl exec abc-db-0 -n cicd --kubeconfig /root/admin.conf -c abc-db -- bash -c "psql -U postgres -d db -f /tmp/queryInstanceId.sql -v v1=full_test | grep [0-9]"
Or you can redirect the standard error with kubectl ... 2>/dev/null (os specific):
kubectl exec abc-db-0 -n cicd --kubeconfig /root/admin.conf -c -- bash -c "psql -U postgres -d db -f /tmp/queryInstanceId.sql -v v1=full_test | grep [0-9]" 2>/dev/null

Atmel studio 7 : unrecognized option `-mrelax'

I downloaded freeRTOS Basic Example -EVK1100 from the example Gallery provided by Atmel Studio and try to build it, i got this error
recipe for target 'src/asf/avr32/utils/startup/trampoline_uc3.o' failed
the Build output gives :
Building file: ../src/asf/avr32/utils/startup/trampoline_uc3.s
Invoking: AVR32/GNU Assembler : 4.4.7
C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr32\avr32-gnu-toolchain\bin\avr32-as.exe: unrecognized option `-mrelax'
make: *** [src/asf/avr32/utils/startup/trampoline_uc3.o] Error 1
"C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr32\avr32-gnu-toolchain\bin\avr32-as.exe" -mpart=uc3a0512 -mrelax -I "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\UC3A_DFP\1.0.53\include\AT32UC3A0512" -I "../thirdparty/freertos/demo/avr32_uc3_example/at32uc3a0512_evk1105" -I "../src/ASF/avr32/utils" -I "../src/config" -I "../src/ASF/avr32/boards/evk1105" -I "../src/ASF/thirdparty/freertos/demo/common/include" -I "../src/ASF/common/utils" -I "../src" -I "../src/ASF/avr32/boards" -I "../src/ASF/thirdparty/freertos/demo/avr32_uc3_example" -I "../src/ASF/avr32/drivers/tc" -I "../src/ASF/avr32/drivers/gpio" -I "../src/ASF/thirdparty/freertos/freertos-7.0.0/source/include" -I "../src/ASF/common/boards" -I "../src/ASF/thirdparty/freertos/demo/avr32_uc3_example/at32uc3a0512_evk1105" -I "../src/ASF/avr32/utils/preprocessor" -I "../src/ASF/avr32/drivers/intc" -I "../src/ASF/thirdparty/freertos/freertos-7.0.0/source/portable/gcc/avr32_uc3" -I "../src/ASF/avr32/drivers/pm" -I "../src/ASF/avr32/drivers/usart" -I "../src/ASF/avr32/drivers/flashc" -g -o "src/asf/avr32/utils/startup/trampoline_uc3.o" "../src/asf/avr32/utils/startup/trampoline_uc3.s"
C:\Users\xxx\Documents\Atmel Studio\7.0\FREERTOS_UC3_EXAMPLE2\FREERTOS_UC3_EXAMPLE2\Debug\Makefile(518,1): error: recipe for target 'src/asf/avr32/utils/startup/trampoline_uc3.o' failed
I believe that the linker complains about the option -mrelax`unrecognized option -mrelax.
This reference shows that i have to check relax branches, but i can't find the option in my version
I wonder if there is a patch to apply to my linker so it can recognize this option or to check/uncheck some options in the project file or ....
I'am using
Atmel Studio 7 (version 7.0.934)
Windows 10
Thanks in advance
The example project is built successfully after upgrading Atmel Studio to the last version.
To get the latest version :
help > check for updates

BCP utility:"Copy direction must be either 'in', 'out' or 'format'"

I get below mentioned error when I run BCP command for trusted connection:
Copy direction must be either 'in', 'out' or 'format'.
I tried searching MSDN, where it specifies that servername passed could be incorrect.
The command I am trying is:
bcp %SQL_database%..TABLE1 in \FileSERVER\file.dat -f\fileserver\Formats\file.fmt -eERR.txt -m1000000 -C -T RAW -S%SQL_server%
When I pass a username and password instead of using the -T option, it works. The command is executed from command prompt by passing parameters from command line.
Your -C and -T options are flip-flopped - -C -T RAW instead of -C RAW -T.
Check the bcp utility's online documentation for confirmation that -C rather than -T should precede RAW.
Try this instead:
bcp %SQL_database%..TABLE1 in \FileSERVER\file.dat -f\fileserver\Formats\file.fmt -eERR.txt -m1000000 -C RAW -T -S%SQL_server%
My guess is that you probably misplaced the -T option when switching to a trusted connection (with the -T option) from integrated security (with the -U and -P options).

how do i pass in a command to sqsh and get the output to a file in one go?

I'm trying to set up a simple loop to periodically query a database table in bash. Normally I seem to have to do:
sqsh -s SERV -U user -P passwd -D db -L bcp_colsep=','
then within sqsh I have to type:
select * from some_table where foo=bar
\go -m bcp > /path/to/output.out
I was trying to use the -C option to sqsh to pass in the command like this:
sqsh -s SERV -U user -P passwd -D db -L bcp_colsep=',' -C 'select * from some_table where foo=bar \go -m bcp > /path/to/output.out'
but I keep getting:
Incorrect syntax near '\'.
How can I get the desired effect?
When you use the -C option to pass on a SQL statement to sqsh, the \go command will be implicitly executed. To get the output in 'bcp' result style you need to set the variable 'style=bcp' using the -L parameter or use -mbcp as a commandline parameter and just redirect the output to a file, or use the sqsh -o parameter to specify a filename for output. So basically your command would look like:
sqsh -S SERV -U user -P passwd -D db -L bcp_colsep=',' -m bcp \
-C 'select * from some_table where foo=bar' > /path/to/output.out
HTH, Martin

what does make[1]:entering a/b.c.edu/e/r/t/d...

I have seen something like in a lab for writing Unix shell in C.
make[1]: Entering directory `/a/cs.amu.edu/p/i/i/labs/lab/src'
./driver.pl -t t1.txt -s ./tsh -a "p"
1) what does it mean?
I have a homework that lists it.
I simply typed
make
and
./driver.pl -t t1.txt -s ./tsh -a "p"
and things worked for me, but when i typed
make[1]: Entering directory `/a/cs.amu.edu/p/i/i/labs/lab/src'
./driver.pl -t t1.txt -s ./tsh -a "p"
into linux terminal it gave something like this:
loop$
what is the difference between make and make[1]:....?
2) Also hw asks me to submit by this command:
cp tsh.c $(HANDINDIR)/$(TEAM)-$(VERSION)-tsh.c
where HANDINDIR gives a path, similar to /a/cs.amu.edu/p/i/i/labs/handin.
If i simply type this command will i be able to handin the work?
Any help is appreciated
make[1]: Entering directory `/a/cs.amu.edu/p/i/i/labs/lab/src'
./driver.pl -t t1.txt -s ./tsh -a "p"
The first line isn't a command. It's just an informational message that make is changing its current directory. Also, Makefiles can call other Makefiles, and the [1] indicates how many levels deep that is - again, that's just informational.
To get the same effect from a prompt, you would need to type:
cd /a/cs.amu.edu/p/i/i/labs/lab/src
./driver.pl -t t1.txt -s ./tsh -a "p"

Resources