From: Pierre B. <pi...@ba...> - 2007-01-19 09:51:55
|
Hi there, I'm using munin at work and at home on various Linux distributions and I find it's a very nice program. I've just installed FreeBSD 6.2 on some machine and configured it as a munin-node. To install the munin-node scripts I (obviously) did: cd /usr/ports/sysutils/munin-node/ make install And then I've got the following munin plugins installed on my FreeBSD 6.2system: [root@fire] /usr/local/share/munin/plugins>ls acpi netstat amavis apache_accesses ntp_ apache_processes ntp_states apache_volume nut_misc apc_envunit_ nut_volts apc_nis open_files bind9 perdition bind9_rndc ping_ courier_ plugins.history courier_mta_mailqueue pm3users_ courier_mta_mailstats pop_stats courier_mta_mailvolume postfix_mailqueue cpu postfix_mailstats cupsys_pages postfix_mailvolume df processes df_inode ps_ dhcpd3 psu_ exim_mailqueue samba exim_mailqueue_alt sendmail_mailqueue exim_mailstats sendmail_mailstats foldingathome sendmail_mailtraffic foldingathome_rank smart_ foldingathome_wu snmp__df hddtemp snmp__fc_if_ hddtemp2 snmp__fc_if_err_ hddtemp_smartctl snmp__if_ hddtempd snmp__if_err_ if_ snmp__load if_errcoll_ snmp__processes snmp__sensors_fsc_bx_fan ipac-ng snmp__sensors_fsc_bx_temp ircu snmp__sensors_fsc_fan load snmp__sensors_fsc_temp loggrep snmp__sensors_mbm_fan mailman snmp__sensors_mbm_temp mailscanner snmp__sensors_mbm_volt mbmon_ snmp__users memory spamstats mhttping squid_cache multips squid_icp munin_graph squid_requests munin_update squid_traffic mysql_bytes surfboard mysql_isam_space_ swap mysql_queries sybase_space mysql_slowqueries mysql_threads vmstat named I have then gotten the following munin plugins from Debian 3.1 (sarge) install: iostat nfs_client users uptime Of course Perl scripts run on both Linux and FreeBSD. But, some Linux scripts do not work on FreeBSD, mainly because they rely on the /proc filesystem, which is present in Linux but not in FreeBSD. Well, actually you *can* mount a proc filesystem in FreeBSD by adding the following line to your /etc/fstab: linprocfs /compat/linux/proc linprocfs rw 0 0 And then creating a symbolic link: ln -s /usr/compat/linux/proc /proc ... but: 1) Not everybody wants to mount the linprocfs filesystem in FreeBSD. 2) The FreeBSD linproc filesystem isn't mounted as /proc but as /compat/linux/proc 3) The FreeBSD linproc filesystem doesn't have all the features the Linux /proc filesystem has. So we've got these four plugins: iostat, nfs_client, users, uptime, let's see how we can migrate them from Linux to FreeBSD: The easiest is users. You don't have to change a single thing when installing in in FreeBSD. It does not use the /proc filesystem at all. It uses the who command: open (WHO,"who|tr -s ' '|cut -d' ' -f2|cut -d'/' -f1|"); Second in difficulty is the uptime script. It relies on the /proc filesystem. But if you mount the linproc filesystem in FreeBSD and do ln -s /usr/compat/linux/proc /proc, the script will work in FreeBSD. You may ask: "Well, why don't you rewrite the script so that it calls the uptime command instead of relying on the /proc filesystem ?" That would work, *but* then the script will report the uptime as an integer (number of days) and not as a real number like the current uptime script does. So the graph would be completely different. Third and fourth in difficulty are iostat and nfs_client. They both try to access directories that do not exist in the linproc filesystem. Error messages from iostat: [root@fire] /usr/local/share/munin/plugins>./iostat grep: /proc/partitions: No such file or directory Error messages from nfs_client: [root@fire] /usr/local/share/munin/plugins>./nfs_client getattr.value grep: /proc/net/rpc/nfs: No such file or directory setattr.value grep: /proc/net/rpc/nfs: No such file or directory (18 more lines, not included) It would be nice if someone had already migrated these scripts to FreeBSD :) Thank you, -- Pierre Bauduin Linux enthusiast since 1996 Debian GNU/Linux user Red Hat Certified Engineer website: http://pierre.baudu.in/ mail/msn/gaim: pi...@ba... |