I need to monitor physical interfaces link status in zabbix, and wondering, if there an internal zabbix check for that, or i need to write my own. If so, how to determine if there is cable plugged in network card, and there is an voltage in the interface.
So yes a UserParameter it is (even in Zabbix 3.0) and it's reasonably easy to setup, at least on modern Linux boxes. By parametrizing the UserParameter (if you follow...), it's possible to define a single Parameter to support monitoring of multiple NICs; here's how:
/etc/zabbix/zabbix_agentd.d/
Create a new file for the definition or amend an existing one; I did this:
cat > /etc/zabbix/zabbix_agentd.d/userparameter_niclink.conf << EOF
UserParameter=net.if.link[*],cat /sys/class/net/$1/carrier
EOF
service zabbix-agent restart
net.if.link[em1]
, That's it; go to Latest data; wait 30 secs or so and your NIC state should start populating. It might also be useful to define a Trigger against the Item to be alerted if the link goes down.
Here are some other ways to detect a NIC link's state; the above cat /sys/class/net/${nic}/carrier
works well for me (Ubuntu 14.04 server, physical NIC).