Hi,
I've bene using NetXMS for a long time, but I recently moved to a new set of servers and rain into some strange problems.
I have the following script:
#! /bin/bash
LOG_FILE="/var/log/rating_engine.log"
STATE=`/etc/init.d/vrrpd show_state`;
if [[ ! -f "/tmp/ccup_running.lock" ]]; then
if [ "$STATE" = "State is master." ]; then
LAST_RUN=`tac $LOG_FILE | grep -m 1 "Billing ended" | tr -s ' ' | cut -d ' ' -f 1,2`
LAST_RUN_DATE=$(date -ud "$LAST_RUN" +'%s')
CURRENT_DATE=`date +%s`
TIME_DIFF=$((CURRENT_DATE-LAST_RUN_DATE))
if [ $TIME_DIFF -gt 180 ];then
echo "1"
else
echo "0"
fi
else
echo "0"
fi
else
echo "0"
fi
The script returns 0 or 1, as needed, but on the NetXMS server I only have 0s
In all older versions it has been working fine. On the new ones (NetXMS Core Agent Version 4.1.333 Build 4.1-333-gf37ab67d18 (UNICODE) in this case), the server always sees 0.
When I try nxget from the server, I get:
tac: write error: Broken pipe
Also I noticed the when I try to add this as a new parameter for that node, I see the data type as "string" I am returning 0 or 1, and used to set these as Integer. How can I change the data type from the agent?
I've bene using NetXMS for a long time, but I recently moved to a new set of servers and rain into some strange problems.
I have the following script:
#! /bin/bash
LOG_FILE="/var/log/rating_engine.log"
STATE=`/etc/init.d/vrrpd show_state`;
if [[ ! -f "/tmp/ccup_running.lock" ]]; then
if [ "$STATE" = "State is master." ]; then
LAST_RUN=`tac $LOG_FILE | grep -m 1 "Billing ended" | tr -s ' ' | cut -d ' ' -f 1,2`
LAST_RUN_DATE=$(date -ud "$LAST_RUN" +'%s')
CURRENT_DATE=`date +%s`
TIME_DIFF=$((CURRENT_DATE-LAST_RUN_DATE))
if [ $TIME_DIFF -gt 180 ];then
echo "1"
else
echo "0"
fi
else
echo "0"
fi
else
echo "0"
fi
The script returns 0 or 1, as needed, but on the NetXMS server I only have 0s
In all older versions it has been working fine. On the new ones (NetXMS Core Agent Version 4.1.333 Build 4.1-333-gf37ab67d18 (UNICODE) in this case), the server always sees 0.
When I try nxget from the server, I get:
tac: write error: Broken pipe
Also I noticed the when I try to add this as a new parameter for that node, I see the data type as "string" I am returning 0 or 1, and used to set these as Integer. How can I change the data type from the agent?