diff options
Diffstat (limited to 'scripts/snmp')
-rw-r--r-- | scripts/snmp/vyatta-snmp.pl | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/scripts/snmp/vyatta-snmp.pl b/scripts/snmp/vyatta-snmp.pl index 6c80eaa0..fcbeeb3f 100644 --- a/scripts/snmp/vyatta-snmp.pl +++ b/scripts/snmp/vyatta-snmp.pl @@ -36,6 +36,7 @@ my $snmp_init = '/opt/vyatta/sbin/snmpd.init'; my $snmp_conf = '/etc/snmp/snmpd.conf'; my $snmp_snmpv3_user_conf = '/usr/share/snmp/snmpd.conf'; my $snmp_snmpv3_createuser_conf = '/var/lib/snmp/snmpd.conf'; +my $versionfile = '/opt/vyatta/etc/version'; sub snmp_restart { system("$snmp_init restart > /dev/null 2>&1 &"); @@ -54,13 +55,30 @@ sub snmp_start { snmp_restart(); } +sub get_version { + my $version = "unknown-version"; + + if (open (my $f, '<', $versionfile)) { + while (<$f>) { + chomp; + if (m/^Version\s*:\s*(.*)$/) { + $version = $1; + last; + } + } + close $f; + } + return $version; +} + sub snmp_get_constants { my $output; - + my $version = get_version(); + my $date = `date`; chomp $date; $output = "#\n# autogenerated by vyatta-snmp.pl on $date\n#\n"; - $output .= "sysDescr Vyatta\n"; + $output .= "sysDescr Vyatta $version\n"; $output .= "sysObjectID 1.3.6.1.4.1.30803\n"; $output .= "sysServices 14\n"; $output .= "smuxpeer .1.3.6.1.4.1.3317.1.2.2\n"; # ospfd |