Hi Guys,
***Preface (Feel free to skip)***
Something I've been wanting for a while was a way to monitor what version of CentOS/Debian/Ubuntu was running. In a large environment, it's easy for a box to slip through the cracks and get stuck running Debian Lenny.
What I wanted to do was retrieve that data periodically, without enabling remote commands OR defining a UserParameter. User parameters are my last resort.
RHEL derivatives maintain a file - /etc/redhat-release. Debian derivatives maintain /etc/debian_version (although Ubuntu uses /etc/issue instead). These files indicate what version of the OS is installed.
Unfortunately, Zabbix Agent doesn't have an easy way of retrieving a single line of text from a file and storing it (at least that I was able to find. The log file functionality just didn't cut it for this kind of work. After some labor in the IRC, though...
***The Solution***
Create a Value Map:
Name: OS Checksum Map
Mappings:
2451495184 ⇒ CentOS 5.5
2620017813 ⇒ CentOS 5.6
etc...
(run cksum /etc/redhat-release to get the checksums of other versions)
Create a new item:
Description: CentOS Version
Type: Zabbix Agent
Key: vfs.file.cksum[/etc/redhat-release]
Info Type: Numeric (unsigned)
Data Type: Decimal
Update Interval: 7200 (or whatever you like)
Show Value: OS Checksum Map
Bingo presto - Zabbix checksums the release file, and the value map translates that into the OS version.
***Preface (Feel free to skip)***
Something I've been wanting for a while was a way to monitor what version of CentOS/Debian/Ubuntu was running. In a large environment, it's easy for a box to slip through the cracks and get stuck running Debian Lenny.
What I wanted to do was retrieve that data periodically, without enabling remote commands OR defining a UserParameter. User parameters are my last resort.

RHEL derivatives maintain a file - /etc/redhat-release. Debian derivatives maintain /etc/debian_version (although Ubuntu uses /etc/issue instead). These files indicate what version of the OS is installed.
Unfortunately, Zabbix Agent doesn't have an easy way of retrieving a single line of text from a file and storing it (at least that I was able to find. The log file functionality just didn't cut it for this kind of work. After some labor in the IRC, though...
***The Solution***
Create a Value Map:
Name: OS Checksum Map
Mappings:
2451495184 ⇒ CentOS 5.5
2620017813 ⇒ CentOS 5.6
etc...
(run cksum /etc/redhat-release to get the checksums of other versions)
Create a new item:
Description: CentOS Version
Type: Zabbix Agent
Key: vfs.file.cksum[/etc/redhat-release]
Info Type: Numeric (unsigned)
Data Type: Decimal
Update Interval: 7200 (or whatever you like)
Show Value: OS Checksum Map
Bingo presto - Zabbix checksums the release file, and the value map translates that into the OS version.
Comment