petrushinvs / mongodb-zabbix-templates-4.0

mongodb zabbix templates rewritten in python with mongodb 4 support
MIT License
19 stars 14 forks source link

monitoring->graphs no data,Pls help on this #4

Closed tlyw closed 5 years ago

tlyw commented 5 years ago

Monitoring->Latest data Data collector

Timestamp Value
07/04/2019 01:13:56 PM History opcounters1562217175 13 68 25 4499 83007 317240{"failed": 17, "chunk": 1, "total": 17, "processed": 0, "time": "0.000294"}
-- --
07/04/2019 01:12:56 PM [Errno 2] No such file or directory: '/tmp/192.168.21.150-opcounters'History opcounters1 0 0 0 0 0 0{"failed": 17, "chunk": 1, "total": 17, "processed": 0, "time": "0.000378"}

mongostat --host 192.168.21.150:9927 -u root -p123456 --authenticationDatabase admin --rowcount 1 insert query update delete getmore command dirty used flushes vsize res qrw arw net_in net_out conn set repl time 0 0 0 0 0 12|0 0.4% 0.4% 0 1.31G 103M 0|0 1|0 1.40k 70.9k 9 myrs PRI Jul 4 14:02:38.442

*Zabbix 4.2|Zabbix 4.0、mongodb-linux-x86_64-4.0.9、 mongodb-org-tools-4.0.10-1.el7.x86_64、mongodb-org-shell-4.0.10-1.el7.x86_64、python2.7、pymongo3.8.0、py-zabbix1.1.5

monitoring->graphs no data

image

petrushinvs commented 5 years ago

just rm all the files like /tmp/192.168.21.150-opcounters manually. the script runs under zabbix server user and can't open the file in /tmp directory if you tried to run the script manually under your shell access .

tlyw commented 5 years ago

Thank you for your reply @petrushinvs

[root@centos tmp]# rm -rf * [root@centos tmp]# systemctl restart zabbix-server zabbix-agent httpd

Monitoring->Latest data->Data collector

Timestamp Value
07/04/2019 02:30:56 PM History opcounters1562221796 13 143 25 4556 84489 330147{"failed": 17, "chunk": 1, "total": 17, "processed": 0, "time": "0.000431"}
-- --
07/04/2019 02:29:57 PM [Errno 2] No such file or directory: '/tmp/192.168.21.150-opcounters'History opcounters1 0 0 0 0 0 0{"failed": 17, "chunk": 1, "total": 17, "processed": 0, "time": "0.000432"}

monitoring->graphs no data

petrushinvs commented 5 years ago

Please check that {$MONGODB_ZABBIX_NAME} is properly set. Like this image

tlyw commented 5 years ago

{$MONGODB_ZABBIX_NAME} I did not fill in correctly before, but I have corrected it now. image

[root @ centos tmp] #systemctl restart zabbix-server zabbix-agent httpd

Timestamp Value
07/04/2019 03:30:56 PM History opcounters1562225395 13 203 25 4568 85659 337415{"failed": 17, "chunk": 1, "total": 17, "processed": 0, "time": "0.000314"}

monitoring->graphs no data

petrushinvs commented 5 years ago

It looks like there something wrong with data packet for zabbbix... pls append the line print(packet) at the end of mongod-db.py and send me Data collector lines

tlyw commented 5 years ago

image

Timestamp Value
07/04/2019 04:51:56 PM History opcounters1562230256 13 289 27 4586 87252 347278{"failed": 17, "chunk": 1, "total": 17, "processed": 0, "time": "0.000411"}[{"host": "consul1 ", "value": "1", "key": "mongodb_state"}, {"host": "consul1 ", "value": "OK", "key": "mongodb_errstr"}, {"host": "consul1 ", "value": "8", "key": "mongodb_conn"}, {"host": "consul1 ", "value": "myrs", "key": "mongodb_rs_name"}, {"host": "consul1 ", "value": "PRI", "key": "mongodb_rs_status"}, {"host": "consul1 ", "value": "1", "key": "mongodb_aclients_read"}, {"host": "consul1 ", "value": "0", "key": "mongodb_aclients_write"}, {"host": "consul1 ", "value": "1", "key": "mongodb_vsize"}, {"host": "consul1 ", "value": "0", "key": "mongodb_netin"}, {"host": "consul1 ", "value": "0", "key": "mongodb_netout"}, {"host": "consul1 ", "value": "0", "key": "mongodb_insert"}, {"host": "consul1 ", "value": "0", "key": "mongodb_update"}, {"host": "consul1 ", "value": "0", "key": "mongodb_delete"}, {"host": "consul1 ", "value": "0", "key": "mongodb_query"}, {"host": "consul1 ", "value": "20", "key": "mongodb_getmore"}, {"host": "consul1 ", "value": "120", "key": "mongodb_command"}, {"host": "consul1 ", "value": "140", "key": "mongodb_total_ops"}]
petrushinvs commented 5 years ago

It is strange, I have very similar line on my servers [{"host": "mongo1", "value": "1", "key": "mongodb_state"}, {"host": "mongo1", "value": "OK", "key": "mongodb_errstr"}, {"host": "mongo1", "value": "160", "key": "mongodb_conn"}, {"host": "mongo1", "value": "rs-raw1", "key": "mongodb_rs_name"}, {"host": "mongo1", "value": "PRI", "key": "mongodb_rs_status"}, {"host": "mongo1", "value": "21", "key": "mongodb_vsize"}, {"host": "mongo1", "value": "0", "key": "mongodb_netin"}, {"host": "mongo1", "value": "0", "key": "mongodb_netout"}, {"host": "mongo1", "value": "8751", "key": "mongodb_insert"}, {"host": "mongo1", "value": "11327", "key": "mongodb_update"}, {"host": "mongo1", "value": "6", "key": "mongodb_delete"}, {"host": "mongo1", "value": "177", "key": "mongodb_query"}, {"host": "mongo1", "value": "3407", "key": "mongodb_getmore"}, {"host": "mongo1", "value": "4815", "key": "mongodb_command"}, {"host": "mongo1", "value": "28784", "key": "mongodb_total_ops"}]

Pls check the zabbix-server log file for errors

tlyw commented 5 years ago

There is a difference in the returned data through the text comparison tool. Is it related to this?

image

I just checked the configuration and logs of the Zabbix server and found no error logs. [zabbix server]zabbix_agentd.log zabbix_server.log [zabbix client]zabbix_agentd.log

Thank you for taking the time to help me. ^_^

tlyw commented 5 years ago

Zabbix4.2->Zabbix4.0

zs.py image

[root@centos externalscripts]# ./zs.py {"failed": 0, "chunk": 1, "total": 2, "processed": 2, "time": "0.000161"} [{"host": "consul1", "value": "100", "key": "mongodb_conn"}, {"host": "consul1", "value": "1", "key": "mongodb_query"}]

It's strange. In theory, the effect should be the same.,but mongod-db.py -> {"failed": 16, "chunk": 1, "total": 16, "processed": 0, "time": "0.000326"}

tlyw commented 5 years ago

image

Macros->{$MONGODB_ZABBIX_NAME} The value of a variable does not contain spaces, but there is one more space at the end of the value of the variable when it is obtained. print("[muser:"+muser+",mpass:"+mpass+",mongohost:"+mongohost+",mongoport:"+mongoport+",zbhost:"+zbhost+"]") [muser:root,mpass:root,mongohost:192.168.21.150,mongoport:9927,zbhost:consul1 ]

image

image

image

petrushinvs commented 5 years ago

Thank you!