{"id":31,"date":"2003-10-24T15:54:15","date_gmt":"2003-10-24T15:54:15","guid":{"rendered":"https:\/\/143-42-55-146.ip.linodeusercontent.com\/?p=31"},"modified":"2003-10-24T15:54:15","modified_gmt":"2003-10-24T15:54:15","slug":"mrtg-a-snmpd","status":"publish","type":"post","link":"https:\/\/nax.cz\/?p=31","title":{"rendered":"MRTG a SNMPD"},"content":{"rendered":"<p>Dnes jsem se konecne dostal k tomu, abych rozebehl nejakeho demona ktery mi bude generovat statistiky zatizenosti serveru. Velice rychle jsem nasel projekt <a href=\"http:\/\/people.ee.ethz.ch\/~oetiker\/webtools\/mrtg\/\">Multi Router Traffic Grapher<\/a>, ktery pouziva snmp k zisteni udaju od routeru. Presne to co potrebuju. Dobry bude ze ten demon muze bezet na serveru a tim padem nebudu zatezovat 233MHz routrik tak aby se mohl soustredit jen a jen na routovani.<\/p>\n<p>Problem ale byl rozbehnout ten snmpd. Pokud vam vypise na dotaz<br \/>\n# snmpget 10.27.72.1  public interfaces.ifNumber.0<br \/>\nTimeout: No Response from 10.27.72.1.<br \/>\ntak to znamena ze bud vam nejede demon nebo mate spatne nastavene tzv community (coz je vlastne jakasy obdoba hesla).<\/p>\n<p>Po chvilce hrabani se v konfiguraku jsem se dostal do faze<br \/>\n# snmpget -v 1 10.27.72.1  public interfaces.ifNumber.0<br \/>\nError in packet<br \/>\nReason: (noSuchName) There is no such variable name in this MIB.<br \/>\nFailed object: interfaces.ifNumber.0<\/p>\n<p>MIB jsou soubory s definicema jak ziskat urcitou hodnotu. Uz jsem se videl jak se budu hrabat v nejakych drsnych souborech (konkretne v \/usr\/share\/snmp\/mibs\/). Nastesti guru guli mi poslal na mejl jednoduchoucky prikladek. Tady je:<\/p>\n<p>naxrouter:\/etc\/snmp# cat snmpd.conf<br \/>\nECTION: System Information Setup<br \/>\n#<br \/>\n# This section defines some of the information reported in<br \/>\n# the &#8222;system&#8220; mib group in the mibII tree.<\/p>\n<p># syslocation: The [typically physical] location of the system.<br \/>\n# arguments: location_string<\/p>\n<p>syslocation nax_Modrany<\/p>\n<p># sysservices: The proper value for the sysServices object.<br \/>\n# arguments: sysservices_number<\/p>\n<p>sysservices 78<\/p>\n<p># syscontact: The contact information for the administrator<br \/>\n# arguments: contact_string<\/p>\n<p>syscontact root@10.27.0.8<\/p>\n<p>##########################################################################<br \/>\n# SECTION: Access Control Setup<br \/>\n#<br \/>\n# This section defines who is allowed to talk to your running<br \/>\n# snmp agent.<\/p>\n<p># rouser: a SNMPv3 read-only user<br \/>\n# arguments: user [noauth|auth|priv] [restriction_oid]<\/p>\n<p>rouser public<\/p>\n<p># rocommunity: a SNMPv1\/SNMPv2c read-only access community name<br \/>\n# arguments: community [default|hostname|network\/bits] [oid]<\/p>\n<p>rocommunity public 127.0.0.1<br \/>\nrocommunity public 10.27.72.1<br \/>\nrocommunity public 10.27.72.2<\/p>\n<p>###########################################################################<br \/>\n# SECTION: Monitor Various Aspects of the Running Host<br \/>\n#<br \/>\n# The following check up on various aspects of a host.<\/p>\n<p># proc: Check for processes that should be running.<br \/>\n# proc NAME [MAX=0] [MIN=0]<br \/>\n#<br \/>\n# NAME: the name of the process to check for. It must match<br \/>\n# exactly (ie, http will not find httpd processes).<br \/>\n# MAX: the maximum number allowed to be running. Defaults to 0.<br \/>\n# MIN: the minimum number to be running. Defaults to 0.<br \/>\n#<br \/>\n# The results are reported in the prTable section of the UCD-SNMP-MIB tree<br \/>\n# Special Case: When the min and max numbers are both 0, it assumes<br \/>\n# you want a max of infinity and a min of 1.<\/p>\n<p>proc ssh 10 1<br \/>\n#pass .1.3.6.1.4.1.2021.255 \/usr\/local\/libexec\/ipfwsnmp .1.3.6.1.4.1.2021.255<\/p>\n<p>No a ted uz stacilo jen spravne pustit<br \/>\n[naxsite:\/var\/www\/mrtg 15:46:36 Fri Oct 24]<br \/>\n# cfgmaker &#8211;global &#8218;WorkDir: \/var\/www\/mrtg&#8216; &#8211;global &#8218;Options[_]: bits,growright&#8216; &#8211;output=\/var\/www\/mrtg\/mrtg.cfg public@10.27.72.7<\/p>\n<p>Coz mi vygenerovalo config, ktery jsem jeste kapanek poeditoval a ted uz se muzeme kochat statistikama. Jeste tam musim pridat statistiky ze serveru a zkusim tam pridat treba jeste  CPU vytizenost a podobny veci. Velice rychle jsem nasel projekt <a href=\"http:\/\/people.ee.ethz.ch\/~oetiker\/webtools\/mrtg\/\">Multi Router Traffic Grapher<\/a>, ktery pouziva snmp k zisteni udaju od routeru. Presne to co potrebuju. Dobry bude ze ten demon muze bezet na serveru a tim padem nebudu zatezovat 233MHz routrik tak aby se mohl soustredit jen a jen na routovani.<\/p>\n<p>Problem ale byl rozbehnout ten snmpd. Pokud vam vypise na dotaz<br \/>\n# snmpget 10.27.72.1  public interfaces.ifNumber.0<br \/>\nTimeout: No Response from 10.27.72.1.<br \/>\ntak to znamena ze bud vam nejede demon nebo mate spatne nastavene tzv community (coz je vlastne jakasy obdoba hesla).<\/p>\n<p>Po chvilce hrabani se v konfiguraku jsem se dostal do faze<br \/>\n# snmpget -v 1 10.27.72.1  public interfaces.ifNumber.0<br \/>\nError in packet<br \/>\nReason: (noSuchName) There is no such variable name in this MIB.<br \/>\nFailed object: interfaces.ifNumber.0<\/p>\n<p>MIB jsou soubory s definicema jak ziskat urcitou hodnotu. Uz jsem se videl jak se budu hrabat v nejakych drsnych souborech (konkretne v \/usr\/share\/snmp\/mibs\/). Nastesti guru guli mi poslal na mejl jednoduchoucky prikladek. Tady je:<\/p>\n<p>naxrouter:\/etc\/snmp# cat snmpd.conf<br \/>\nECTION: System Information Setup<br \/>\n#<br \/>\n# This section defines some of the information reported in<br \/>\n# the &#8222;system&#8220; mib group in the mibII tree.<\/p>\n<p># syslocation: The [typically physical] location of the system.<br \/>\n# arguments: location_string<\/p>\n<p>syslocation nax_Modrany<\/p>\n<p># sysservices: The proper value for the sysServices object.<br \/>\n# arguments: sysservices_number<\/p>\n<p>sysservices 78<\/p>\n<p># syscontact: The contact information for the administrator<br \/>\n# arguments: contact_string<\/p>\n<p>syscontact root@10.27.0.8<\/p>\n<p>##########################################################################<br \/>\n# SECTION: Access Control Setup<br \/>\n#<br \/>\n# This section defines who is allowed to talk to your running<br \/>\n# snmp agent.<\/p>\n<p># rouser: a SNMPv3 read-only user<br \/>\n# arguments: user [noauth|auth|priv] [restriction_oid]<\/p>\n<p>rouser public<\/p>\n<p># rocommunity: a SNMPv1\/SNMPv2c read-only access community name<br \/>\n# arguments: community [default|hostname|network\/bits] [oid]<\/p>\n<p>rocommunity public 127.0.0.1<br \/>\nrocommunity public 10.27.72.1<br \/>\nrocommunity public 10.27.72.2<\/p>\n<p>###########################################################################<br \/>\n# SECTION: Monitor Various Aspects of the Running Host<br \/>\n#<br \/>\n# The following check up on various aspects of a host.<\/p>\n<p># proc: Check for processes that should be running.<br \/>\n# proc NAME [MAX=0] [MIN=0]<br \/>\n#<br \/>\n# NAME: the name of the process to check for. It must match<br \/>\n# exactly (ie, http will not find httpd processes).<br \/>\n# MAX: the maximum number allowed to be running. Defaults to 0.<br \/>\n# MIN: the minimum number to be running. Defaults to 0.<br \/>\n#<br \/>\n# The results are reported in the prTable section of the UCD-SNMP-MIB tree<br \/>\n# Special Case: When the min and max numbers are both 0, it assumes<br \/>\n# you want a max of infinity and a min of 1.<\/p>\n<p>proc ssh 10 1<br \/>\n#pass .1.3.6.1.4.1.2021.255 \/usr\/local\/libexec\/ipfwsnmp .1.3.6.1.4.1.2021.255<\/p>\n<p>No a ted uz stacilo jen spravne pustit<br \/>\n[naxsite:\/var\/www\/mrtg 15:46:36 Fri Oct 24]<br \/>\n# cfgmaker &#8211;global &#8218;WorkDir: \/var\/www\/mrtg&#8216; &#8211;global &#8218;Options[_]: bits,growright&#8216; &#8211;output=\/var\/www\/mrtg\/mrtg.cfg public@10.27.72.7<\/p>\n<p>Coz mi vygenerovalo config, ktery jsem jeste kapanek poeditoval a ted uz se muzeme kochat statistikama <a href=\"http:\/\/nax.hn.org\/mrtg\/\">tady<\/a>. Jeste tam musim pridat statistiky ze serveru a zkusim tam pridat treba jeste  CPU vytizenost a podobny veci. Zacnu treba <a href=\"http:\/\/people.ee.ethz.ch\/~oetiker\/webtools\/mrtg\/mibhelp.html\">tady<\/a>.<\/p>\n<p>Jeste jsem do \/var\/www\/mrtg\/mrtg.cfg pridal radek<br \/>\nRunAsDaemon: Yes<br \/>\naby se to startovalo rovnou jako demon a upravil \/etc\/init.d\/skeleton. Trochu problem byl s zabijenim ale vyresil to prikaz<br \/>\nkill -9 `ps -ef | awk &#8218;{print $1&#8243; &#8222;$2}&#8216; | grep $NAME | awk &#8218;{print $2}&#8217;`<br \/>\nrespektive<br \/>\nkill -9 `cat \/var\/www\/mrtg\/$NAME.pid`<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Dnes jsem se konecne dostal k tomu, abych rozebehl nejakeho demona ktery mi bude generovat statistiky zatizenosti serveru. Velice rychle jsem nasel projekt Multi Router Traffic Grapher, ktery pouziva snmp k zisteni udaju od routeru. Presne to co potrebuju. Dobry bude ze ten demon muze bezet na serveru a tim padem nebudu zatezovat 233MHz routrik [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-31","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/nax.cz\/index.php?rest_route=\/wp\/v2\/posts\/31","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nax.cz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nax.cz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nax.cz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nax.cz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=31"}],"version-history":[{"count":0,"href":"https:\/\/nax.cz\/index.php?rest_route=\/wp\/v2\/posts\/31\/revisions"}],"wp:attachment":[{"href":"https:\/\/nax.cz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=31"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nax.cz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=31"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nax.cz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=31"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}