{"id":256,"date":"2017-05-22T06:42:52","date_gmt":"2017-05-22T06:42:52","guid":{"rendered":"http:\/\/www.web-workers.ch\/?p=256"},"modified":"2018-03-20T20:37:15","modified_gmt":"2018-03-20T20:37:15","slug":"how-to-install-webmin-and-mrtg-on-centos-7","status":"publish","type":"post","link":"https:\/\/www.web-workers.ch\/index.php\/2017\/05\/22\/how-to-install-webmin-and-mrtg-on-centos-7\/","title":{"rendered":"How to install Webmin and MRTG on CentOS 7"},"content":{"rendered":"<h2>Install Webmin<\/h2>\n<p>Install Webmin requirements and install Webmin via RPM directly from the website.<\/p>\n<p><code># yum -y install perl-Net-SSLeay<br \/>\n# yum -y install perl-Encode-Detect<br \/>\n# rpm -ihv https:\/\/netix.dl.sourceforge.net\/project\/webadmin\/webmin\/1.840\/webmin-1.840-1.noarch.rpm<\/code><\/p>\n<h2>Install&nbsp;Apache<\/h2>\n<p>Here we are performing a basic installation of the apache web server, start the webserver afterwards and enable the service on boot.<\/p>\n<p><code># yum -y install httpd<br \/>\n# systemctl start httpd.service<br \/>\n# systemctl enable httpd.service<\/code><\/p>\n<h2>Install&nbsp;MRTG<\/h2>\n<p>Below command is for MRTG and the SNMP installation including utilities and dependencies.<\/p>\n<p><code># yum -y install net-snmp mrtg net-snmp-utils<\/code><\/p>\n<h2>Configure SNMP<\/h2>\n<p>Edit the configuration file, below an example of a non-restrictive SNMP configuration.<\/p>\n<p><code># vi \/etc\/snmp\/snmpd.conf<\/code><\/p>\n<p><code>###############################################################################<\/code><code>#<\/code><code># snmpd.conf:<\/code><code># An example configuration file for configuring the ucd-snmp snmpd agent.<\/code><code>#<\/code><code>###############################################################################<\/code><code>#<\/code><code># This file is intended to only be as a starting point. Many more<\/code><code># configuration directives exist than are mentioned in this file. For<\/code><code># full details, see the snmpd.conf(5) manual page.<\/code><code>#<\/code><code># All lines beginning with a '#' are comments and are intended for you<\/code><code># to read. All other lines are configuration commands for the agent.<\/code><code><br \/>\n###############################################################################<\/code><code># Access Control<\/code><code>###############################################################################<\/code><code># As shipped, the snmpd demon will only respond to queries on the<\/code><code># system mib group until this file is replaced or modified for<\/code><code># security purposes. Examples are shown below about how to increase the<\/code><code># level of access.<\/code><code># By far, the most common question I get about the agent is \"why won't<\/code><code># it work?\", when really it should be \"how do I configure the agent to<\/code><code># allow me to access it?\"<\/code><code>#<\/code><code># By default, the agent responds to the \"public\" community for read<\/code><code># only access, if run out of the box without any configuration file in<\/code><code># place. The following examples show you other ways of configuring<\/code><code># the agent so that you can change the community names, and give<\/code><code># yourself write access to the mib tree as well.<\/code><code>#<\/code><code># For more information, read the FAQ as well as the snmpd.conf(5)<\/code><code># manual page.<\/code><code># Here is a commented out example configuration that allows less<\/code><code># restrictive access.<\/code><code># YOU SHOULD CHANGE THE \"COMMUNITY\" TOKEN BELOW TO A NEW KEYWORD ONLY<\/code><code># KNOWN AT YOUR SITE. YOU *MUST* CHANGE THE NETWORK TOKEN BELOW TO<\/code><code># SOMETHING REFLECTING YOUR LOCAL NETWORK ADDRESS SPACE.<\/code><code><br \/>\n# sec.name source community<\/code><code>com2sec local localhost public<\/code><code>com2sec dmznet 10.0.1.0\/24 public<\/code><code>com2sec lannet 192.168.1.0\/24 public<\/code><code><br \/>\n# group.name sec.model sec.name<\/code><code>group RWGroup any local<\/code><code>group ROGroup any dmznet<\/code><code>group ROGroup any lannet<\/code><code><br \/>\n# incl\/excl subtree mask<\/code><code>view all included .1 80<\/code><code>## context sec.model sec.level prefix read write notify<\/code><code>access ROGroup \"\" any noauth 0 all none none<\/code><code>access RWGroup \"\" any noauth 0 all all all<\/code><code><br \/>\n###############################################################################<\/code><code># System contact information<\/code><code>#<\/code><code># It is also possible to set the sysContact and sysLocation system<\/code><code># variables through the snmpd.conf file:<\/code><code>syslocation Unknown (edit \/etc\/snmp\/snmpd.conf)<\/code><code>syscontact Root &lt;root@localhost&gt; (configure \/etc\/snmp\/snmp.local.conf)<\/code><code><br \/>\n###############################################################################<\/code><code># Logging<\/code><code>#<\/code><code># We do not want annoying \"Connection from UDP: \" messages in syslog.<\/code><code># If the following option is commented out, snmpd will print each incoming<\/code><code># connection, which can be useful for debugging.<\/code><code>dontLogTCPWrappersConnects yes<\/code><code><br \/>\n# -----------------------------------------------------------------------------<\/code><\/p>\n<p>Start the service and enable the service on boot.<\/p>\n<p><code># systemctl start snmpd.service<\/code><code># systemctl enable snmpd.service<\/code><\/p>\n<p>Test if your SNMP service is responding to SNMP requests<\/p>\n<p><code># snmpwalk -v2c -c public localhost system<\/code><\/p>\n<h2>Configure&nbsp;MRTG<\/h2>\n<p>Create a configuration file for MRTG data storage. Run the command below and redirect the output to the MRTG configuration file.<\/p>\n<p><code># cfgmaker --ifref=descr --ifdesc=descr --global 'WorkDir: \/var\/www\/html\/mrtg' public@172.24.0.69 &gt; \/etc\/mrtg\/172.24.0.69.cfg<\/code><\/p>\n<p>I suggest to create a configuration file for each host you want to query\/observe. If you have a configuration file for every host, merge them into \/etc\/mrtg\/mrtg.cfg.<\/p>\n<p>Additionally I&#8217;ve added those global configuration settings to \/etc\/mrtg\/mrtg.cfg<\/p>\n<p><code>HtmlDir: \/var\/www\/mrtg<br \/>\nImageDir: \/var\/www\/mrtg<br \/>\nLogDir: \/var\/lib\/mrtg<br \/>\nThreshDir: \/var\/lib\/mrtg<br \/>\nRefresh: 300<br \/>\nInterval: 5<br \/>\nLanguage: german<br \/>\nOptions[_]: growright, nobanner, noborder, transparent<\/code><br \/>\nCreate Index File on MRTG&nbsp;document root through below command.<\/p>\n<p><code># indexmaker&nbsp;--columns=1 \/etc\/mrtg\/mrtg.cfg &gt; \/var\/www\/html\/mrtg\/index.html<\/code><br \/>\nMake MRTG executing every minute.<\/p>\n<p><code>#&nbsp;crontab -e<\/code><br \/>\nAdd the following line and save :x!<\/p>\n<p><code>*\/1 * * * * env LANG=C \/usr\/bin\/mrtg \/etc\/mrtg\/mrtg.cfg --logging \/var\/log\/mrtg.log<br \/>\n<\/code><\/p>\n<h2>Configure&nbsp;Apache<\/h2>\n<p>Edit the Apache config file for MRTG&#8217;s virtual directory:<\/p>\n<p><code># vi \/etc\/httpd\/conf.d\/mrtg.conf<\/code><br \/>\nMake sure you disable the local access only:<\/p>\n<p><code>#<br \/>\n# This configuration file maps the mrtg output (generated daily)<br \/>\n# into the URL space. By default these results are only accessible<br \/>\n# from the local host.<br \/>\n#<br \/>\nAlias \/mrtg \/var\/www\/mrtg<br \/>\n&lt;Location \/mrtg&gt;<br \/>\n# Require local<br \/>\n# Require ip 10.1.2.3<br \/>\n# Require host example.org<br \/>\n&lt;\/Location&gt;<\/code><br \/>\nRestart Apache webserver:<\/p>\n<p><code># systemctl restart httpd.service<\/code><br \/>\nOpen MRTG website:<\/p>\n<p><code>http:\/\/server-ipaddress\/mrtg<\/code><br \/>\nThank you ?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Install Webmin Install Webmin requirements and install Webmin via RPM directly from the website. # yum -y install perl-Net-SSLeay # yum -y install perl-Encode-Detect # rpm -ihv https:\/\/netix.dl.sourceforge.net\/project\/webadmin\/webmin\/1.840\/webmin-1.840-1.noarch.rpm Install&nbsp;Apache Here [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":298,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4,8,6],"tags":[54,63,61,35,46,43,49,75,89,52,66,44,29,70,62,94,42,93,103],"class_list":["post-256","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-networking","category-security","tag-access","tag-ad","tag-address","tag-apache","tag-file","tag-http","tag-https","tag-ie","tag-ipad","tag-log","tag-mrtg","tag-root","tag-server","tag-snmp","tag-tcp","tag-udp","tag-url","tag-webmin","tag-yum"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.web-workers.ch\/wp-content\/uploads\/2017\/05\/mrtg11.png?fit=1366%2C457&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8sxjX-48","jetpack-related-posts":[],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.web-workers.ch\/index.php\/wp-json\/wp\/v2\/posts\/256","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.web-workers.ch\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.web-workers.ch\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.web-workers.ch\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.web-workers.ch\/index.php\/wp-json\/wp\/v2\/comments?post=256"}],"version-history":[{"count":12,"href":"https:\/\/www.web-workers.ch\/index.php\/wp-json\/wp\/v2\/posts\/256\/revisions"}],"predecessor-version":[{"id":534,"href":"https:\/\/www.web-workers.ch\/index.php\/wp-json\/wp\/v2\/posts\/256\/revisions\/534"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.web-workers.ch\/index.php\/wp-json\/wp\/v2\/media\/298"}],"wp:attachment":[{"href":"https:\/\/www.web-workers.ch\/index.php\/wp-json\/wp\/v2\/media?parent=256"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.web-workers.ch\/index.php\/wp-json\/wp\/v2\/categories?post=256"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.web-workers.ch\/index.php\/wp-json\/wp\/v2\/tags?post=256"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}