Hi
I have cacti server with below information:
Cacti version: 0.8.8b
OS: Centos6.5 64bit
Poller: spine
I have a problem regarding to creating graphs by custom bash script. I wrote many custom scripts and generate graphs in CACTI but now I have an script that work fine when I run it manually but when I add it in "Data Input Methods" and create data source for it, after creating graph, all DSs return NaN value. I check cacti.log file and found that all items logged, but no values returned for them.
when I run spine manually everything work fine. would you please help me in this regard?
script:
#!/bin/bash
total() {
sqlplus -s userdb/passdb@sysdb << EOSQL
set termout off trimout on trimspool on echo off pagesize 60 linesize 132 space 0 feedback off verify off heading off colsep ,
column MML_Result format A60;
select 'Fired_MML' as "MML_Result", count(*) as "Count" from operator_log where opt_time >= (select TO_CHAR(SYSDATE -interval '1' minute, 'YYYYMMDDHH24MISS') from dual) and operator_name='wimaxadm' union select CASE opt_result WHEN 0 THEN 'Failed' when 1 then 'Success' end as MML_Result, count(*) as Count from operator_log where opt_time >= (select TO_CHAR(SYSDATE - interval '1' minute, 'YYYYMMDDHH24MISS') from dual) and operator_name='wimaxadm' group by opt_result union select descs as MML_Result, count(*) as Count from operator_log where opt_time >= (select TO_CHAR(SYSDATE - interval '1' minute, 'YYYYMMDDHH24MISS') from dual) and operator_name='wimaxadm' group by descs union select opt_reason as MML_Result,count(*) as Count from operator_log where opt_time >= (select TO_CHAR(SYSDATE - interval '1' minute, 'YYYYMMDDHH24MISS') from dual) and operator_name='wimaxadm' and opt_reason is not null group by opt_reason;
exit
EOSQL
}
fired_mml=`echo "$(total)" | grep Fired_MML | awk -F',' '{print $2}' | awk -F'[^0-9]*' '{print $2}'`
if [ $fired_mml == 0 ]
then
success=0
failed=0
else
success=`echo "$(total)" | grep Success | awk -F',' '{print $2}' | awk -F'[^0-9]*' '{print $2}'`
fi
if [ $fired_mml == $success ]
then
failed=0
else
failed=`echo "$(total)" | grep Failed | awk -F',' '{print $2}' | awk -F'[^0-9]*' '{print $2}'`
fi
if [ $fired_mml == 0 ]
then
prov_suc_rt=0
else
prov_suc_rt=`echo "$success * 100 / $fired_mml" | bc`
fi
echo "total:"$fired_mml"" "success:"$success"" "failed:"$failed"" "prov_suc_rt:"$prov_suc_rt
cacti log:
02/26/2014 07:57:02 AM - SPINE: Poller[0] Host[0] TH[1] DS[1559] SCRIPT: bash /usr/share/cacti/scripts/aaa_prov_suc.sh, output: total: success: failed: prov_suc_rt:
02/26/2014 07:58:03 AM - SPINE: Poller[0] Host[0] TH[1] DS[1559] SCRIPT: bash /usr/share/cacti/scripts/aaa_prov_suc.sh, output: total: success: failed: prov_suc_rt:
02/26/2014 07:59:03 AM - SPINE: Poller[0] Host[0] TH[1] DS[1559] SCRIPT: bash /usr/share/cacti/scripts/aaa_prov_suc.sh, output: total: success: failed: prov_suc_rt:
02/26/2014 08:00:02 AM - SPINE: Poller[0] Host[0] TH[1] DS[1559] SCRIPT: bash /usr/share/cacti/scripts/aaa_prov_suc.sh, output: total: success: failed: prov_suc_rt:
02/26/2014 08:01:02 AM - SPINE: Poller[0] Host[0] TH[1] DS[1559] SCRIPT: bash /usr/share/cacti/scripts/aaa_prov_suc.sh, output: total: success: failed: prov_suc_rt:
02/26/2014 08:02:02 AM - SPINE: Poller[0] Host[0] TH[1] DS[1559] SCRIPT: bash /usr/share/cacti/scripts/aaa_prov_suc.sh, output: total: success: failed: prov_suc_rt:
02/26/2014 08:03:03 AM - SPINE: Poller[0] Host[0] TH[1] DS[1559] SCRIPT: bash /usr/share/cacti/scripts/aaa_prov_suc.sh, output: total: success: failed: prov_suc_rt:
02/26/2014 08:04:02 AM - SPINE: Poller[0] Host[0] TH[1] DS[1559] SCRIPT: bash /usr/share/cacti/scripts/aaa_prov_suc.sh, output: total: success: failed: prov_suc_rt:
02/26/2014 08:05:02 AM - SPINE: Poller[0] Host[0] TH[1] DS[1559] SCRIPT: bash /usr/share/cacti/scripts/aaa_prov_suc.sh, output: total: success: failed: prov_suc_rt:
02/26/2014 08:06:02 AM - SPINE: Poller[0] Host[0] TH[1] DS[1559] SCRIPT: bash /usr/share/cacti/scripts/aaa_prov_suc.sh, output: total: success: failed: prov_suc_rt:
after running spine manually:
02/26/2014 08:19:24 AM - SPINE: Poller[0] Host[0] TH[1] DS[1559] SCRIPT: bash /usr/share/cacti/scripts/aaa_prov_suc.sh, output: total:3 success:2 failed:1 prov_suc_rt:67
thanks for your consideration.
polling data issue
Moderators: Developers, Moderators
Who is online
Users browsing this forum: No registered users and 4 guests