I was trying to add an item to store the installation date of our Linux servers and ran into some odd behaviour with awk and system.run[] in testing. Looks like I can get the desired results with cut but would still be curious why it fails with awk. Thoughts?
Code:
[root@vigilance ~]# zabbix_get -sserver -ksystem.run["(sudo stat -c %z /root/install.log 2>/dev/null || echo 'unknown') | cut -d' ' -f1"]
2010-06-10
[root@vigilance ~]# zabbix_get -sserver -ksystem.run["(sudo stat -c %z /root/fake 2>/dev/null || echo 'unknown') | cut -d' ' -f1"]
unknown
[root@vigilance ~]# zabbix_get -sserver -ksystem.run["(sudo stat -c %z /root/install.log 2>/dev/null || echo 'unknown') | awk '{print $1}'"]
2010-06-10 02:49:31.000000000 -0500
[root@vigilance ~]# zabbix_get -sserver -ksystem.run["(sudo stat -c %z /root/fake 2>/dev/null || echo 'unknown') | awk '{print $1}'"]
unknown