Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with Centreon - Use of uninitialized value #13

Closed
netbja opened this issue Jan 28, 2023 · 6 comments
Closed

Issue with Centreon - Use of uninitialized value #13

netbja opened this issue Jan 28, 2023 · 6 comments

Comments

@netbja
Copy link

netbja commented Jan 28, 2023

Hello,
This perl script working fine on my Linux Centreon server when I use it on console (command line). But when I create a check command and service template, the status is:

Use of uninitialized value $haproxy in split at /usr/lib/centreon/plugins/[check_haproxy_stats.pl](http://check_haproxy_stats.pl/) line 233.
Unable to retrieve haproxy stats at /usr/lib/centreon/plugins/[check_haproxy_stats.pl](http://check_haproxy_stats.pl/) line 235.
@tatref
Copy link
Owner

tatref commented Jan 28, 2023

Can you try adding the --dump option to print info?

@netbja
Copy link
Author

netbja commented Jan 28, 2023

Here is the dump:

./check_haproxy_stats.pl --url='https://server1.domain.local/' --username='haproxy' --password='xxxxxxxxx' --warning='85' --critical='95' -p back_pgsql,pgsql_6432 -d

# pxname,svname,qcur,qmax,scur,smax,slim,stot,bin,bout,dreq,dresp,ereq,econ,eresp,wretr,wredis,status,weight,act,bck,chkfail,chkdown,lastchg,downtime,qlimit,pid,iid,sid,throttle,lbtot,tracked,type,rate,rate_lim,rate_max,check_status,check_code,check_duration,hrsp_1xx,hrsp_2xx,hrsp_3xx,hrsp_4xx,hrsp_5xx,hrsp_other,hanafail,req_rate,req_rate_max,req_tot,cli_abrt,srv_abrt,comp_in,comp_out,comp_byp,comp_rsp,lastsess,last_chk,last_agt,qtime,ctime,rtime,ttime,agent_status,agent_code,agent_duration,check_desc,agent_desc,check_rise,check_fall,check_health,agent_rise,agent_fall,agent_health,addr,cookie,mode,algo,conn_rate,conn_rate_max,conn_tot,intercepted,dcon,dses,
haproxy_admin,FRONTEND,,,1,4,6000,64938,23543255,724070535,0,0,46,,,,,OPEN,,,,,,,,,1,2,0,,,,0,1,0,180,,,,0,59663,0,5279,78,0,,1,180,65021,,,0,0,0,0,,,,,,,,,,,,,,,,,,,,,http,,1,179,65566,59664,0,0,
haproxy_admin,BACKEND,0,0,0,1,600,78,23543255,724070535,0,0,,78,0,0,0,UP,0,0,0,,0,3683831,,,1,2,0,,0,,1,0,,15,,,,0,0,0,0,78,0,,,,78,1,0,0,0,0,0,0,,,0,0,1,23,,,,,,,,,,,,,,http,roundrobin,,,,,,,
back_pgsql,server1::server-pg.domain.local,0,0,0,2,,64,16392,819,,0,,0,0,0,0,UP,100,1,0,0,0,3683831,0,,1,3,1,,1,,2,0,,6,L4OK,,0,,,,,,,,,,,65,0,,,,,382495,,via agent : up (PostgreSQL Primary is running.),0,0,0,46,L7OK,0,67,Layer4 check passed,Layer7 check passed,3,2,4,1,1,1,[10.10.10.146:5432](http://10.10.10.146:5432/),,tcp,,,,,,,,
back_pgsql,server1::server-pg.domain.local,0,0,0,0,,0,0,0,,0,,0,0,0,0,MAINT,0,1,0,0,1,3683823,3683823,,1,3,2,,0,,2,0,,0,,,,,,,,,,,,,,0,0,,,,,-1,,via agent : up (PostgreSQL Secondary is running.),0,0,0,0,L7OK,0,45,,Layer7 check passed,,,,1,1,1,[10.10.10.125:5432](http://10.10.10.125:5432/),,tcp,,,,,,,,
back_pgsql,BACKEND,0,0,0,2,300,65,16392,819,0,0,,0,0,0,0,UP,100,1,0,,0,3683831,0,,1,3,0,,1,,1,0,,6,,,,,,,,,,,,,,65,0,0,0,0,0,382495,,,0,0,0,46,,,,,,,,,,,,,,tcp,roundrobin,,,,,,,
pgsql_6432,FRONTEND,,,0,2,3000,65,16392,819,0,0,1,,,,,OPEN,,,,,,,,,1,4,0,,,,0,0,0,6,,,,,,,,,,,0,0,0,,,0,0,0,0,,,,,,,,,,,,,,,,,,,,,tcp,,0,6,65,,0,0,

@tatref
Copy link
Owner

tatref commented Jan 28, 2023

That's strange

Are you sure you're running the script with the same parameters from Centreon? Try to add the dump parameter from Centreon and see what you get

@netbja
Copy link
Author

netbja commented Jan 28, 2023

Sure, here is the result with -d parameter

Use of uninitialized value $haproxy in print at /usr/lib/centreon/plugins/check_haproxy_stats.pl line 228.

@tatref
Copy link
Owner

tatref commented Jan 29, 2023

I'm not sure why this happens. Seems like the script can't find something in the CSV, or can't get the CSV at all.

You should double check the Centreon command line, you should expect the same thing from CLI or Centreon.

@netbja
Copy link
Author

netbja commented Jan 29, 2023

Hello tartef,
I finally found the problem, the password has a ";" in it and since Centreon hides the password, I couldn't see that the password was truncated. I decided to reveal the password by unchecking the password type in the command and found that my password was truncated by the ";".
Everything is OK now by adding a \ in front of the ";"
Thank you for your support.

@netbja netbja closed this as completed Jan 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants