Nagios does not run my scrips

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
danox40997
Posts: 2
Joined: Tue Jul 07, 2015 5:21 pm

Nagios does not run my scrips

Post by danox40997 »

if you run this script runs out of nagios smoothly, but has problems running with nagios
why?? :(
#! /bin/bash
y=$(echo q | htop | aha --black --line-fix --title "Jobo web 1" | grep "[0-9]%" | sed 's/[a-z,A-Z,>,<,\,,=,\;,\",\|,\/,:,-]//g' | grep -o "\[.*\]" | tr -d ' ,[,%,]' | awk ' BEGIN { s = 0 ;} { s = s + $ 1; } END {print s /NR; } ')
#echo $y > /tmp/check_procesos
#echo $y
echo "Carga del procesador: %$y"
if [ $(echo "$y>90" |bc) -eq 1 ]; then
exit 2
elif [ $(echo "$y>80" | bc) -eq 1 ]; then
exit 1
else
exit 0
fi
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Nagios does not run my scrips

Post by jdalrymple »

Is it executable by the nagios user?

Code: Select all

chmod 755
then verify with su

Code: Select all

su -c /path/to/script/myscript nagios
Is selinux enabled - it will interfere with the Nagios process's ability to fork new processes.
danox40997
Posts: 2
Joined: Tue Jul 07, 2015 5:21 pm

Re: Nagios does not run my scrips

Post by danox40997 »

I use chmod 777
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Nagios does not run my scrips

Post by tgriep »

How are you trying to run this script as a command or as an event handler?
Can you show how you have this setup in XI and are you receiving any errors?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked